From 2a3aef0ca646db995e5f91e0dfde01c053263020 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 13 Aug 2014 22:27:44 +0200 Subject: [PATCH] Improved use of .expanding(), removed log messages. --- .../controllers/_application_controller_form.js.coffee | 8 ++++++-- .../app/controllers/widget/organization.js.coffee | 10 +++++++--- .../javascripts/app/controllers/widget/user.js.coffee | 10 +++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index baa108aaf..56450de6b 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -654,9 +654,13 @@ class App.ControllerForm extends App.Controller item = $( App.view('generic/textarea')( attribute: attribute ) + '
' ) a = => - $( item[0] ).expanding() - $( item[0] ).on('focus', -> + visible = $( item[0] ).is(":visible") + if visible && !$( item[0] ).expanding('active') $( item[0] ).expanding() + $( item[0] ).on('focus', -> + visible = $( item[0] ).is(":visible") + if visible && !$( item[0] ).expanding('active') + $( item[0] ).expanding() ) App.Delay.set( a, 80 ) diff --git a/app/assets/javascripts/app/controllers/widget/organization.js.coffee b/app/assets/javascripts/app/controllers/widget/organization.js.coffee index fb0b59445..82a386080 100644 --- a/app/assets/javascripts/app/controllers/widget/organization.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/organization.js.coffee @@ -42,11 +42,15 @@ class App.WidgetOrganization extends App.Controller ) a = => - @el.find('textarea').expanding() - @el.find('textarea').on('focus', => + visible = @el.find('textarea').is(":visible") + if visible && !@el.find('textarea').expanding('active') @el.find('textarea').expanding() + @el.find('textarea').on('focus', (e) => + visible = @el.find('textarea').is(":visible") + if visible && !@el.find('textarea').expanding('active') + @el.find('textarea').expanding() ) - @delay( a, 80 ) + @delay( a, 40 ) # enable user popups @userPopups() diff --git a/app/assets/javascripts/app/controllers/widget/user.js.coffee b/app/assets/javascripts/app/controllers/widget/user.js.coffee index 23d41cd65..7ffe95c1d 100644 --- a/app/assets/javascripts/app/controllers/widget/user.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/user.js.coffee @@ -72,11 +72,15 @@ class App.WidgetUser extends App.ControllerDrox ) a = => - @el.find('textarea').expanding() - @el.find('textarea').on('focus', => + visible = @el.find('textarea').is(":visible") + if visible && !@el.find('textarea').expanding('active') @el.find('textarea').expanding() + @el.find('textarea').on('focus', (e) => + visible = @el.find('textarea').is(":visible") + if visible && !@el.find('textarea').expanding('active') + @el.find('textarea').expanding() ) - @delay( a, 80 ) + @delay( a, 40 ) @userTicketPopups( selector: '.user-tickets'