diff --git a/app/assets/javascripts/app/controllers/_ui_element/_application_selector.coffee b/app/assets/javascripts/app/controllers/_ui_element/_application_selector.coffee index b6b2015ee..179362102 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/_application_selector.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/_application_selector.coffee @@ -96,6 +96,8 @@ class App.UiElement.ApplicationSelector # ignore passwords and relations if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false config = _.clone(row) + if config.tag is 'textarea' + config.expanding = false if config.type is 'email' || config.type is 'tel' config.type = 'text' for operatorRegEx, operator of operators_type diff --git a/app/assets/javascripts/app/controllers/_ui_element/core_workflow_condition.coffee b/app/assets/javascripts/app/controllers/_ui_element/core_workflow_condition.coffee index 22d5e981a..da94185f7 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/core_workflow_condition.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/core_workflow_condition.coffee @@ -153,6 +153,8 @@ class App.UiElement.core_workflow_condition extends App.UiElement.ApplicationSel # ignore passwords and relations if row.type isnt 'password' && row.name.substr(row.name.length-4,4) isnt '_ids' && row.searchable isnt false config = _.clone(row) + if config.tag is 'textarea' + config.expanding = false if config.tag is 'select' config.multiple = true config.default = undefined diff --git a/app/assets/javascripts/app/controllers/_ui_element/textarea.coffee b/app/assets/javascripts/app/controllers/_ui_element/textarea.coffee index 3987bd43f..4ed6e555f 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/textarea.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/textarea.coffee @@ -4,16 +4,17 @@ class App.UiElement.textarea fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 ) item = $( App.view('generic/textarea')( attribute: attribute ) + '
' ) - a = -> - visible = $( item[0] ).is(':visible') - if visible && !$( item[0] ).expanding('active') - $( item[0] ).expanding() - $( item[0] ).on('focus', -> + if attribute.expanding isnt false + a = -> visible = $( item[0] ).is(':visible') if visible && !$( item[0] ).expanding('active') - $( item[0] ).expanding().focus() - ) - App.Delay.set(a, 80) + $( item[0] ).expanding() + $( item[0] ).on('focus', -> + visible = $( item[0] ).is(':visible') + if visible && !$( item[0] ).expanding('active') + $( item[0] ).expanding().focus() + ) + App.Delay.set(a, 80) if attribute.upload @@ -41,4 +42,4 @@ class App.UiElement.textarea debug: false ) App.Delay.set(u, 100, undefined, 'form_upload') - item \ No newline at end of file + item diff --git a/public/assets/tests/qunit/form.js b/public/assets/tests/qunit/form.js index 1562b53cf..e9edd224e 100644 --- a/public/assets/tests/qunit/form.js +++ b/public/assets/tests/qunit/form.js @@ -1607,3 +1607,27 @@ QUnit.test("form with external links", assert => { assert.equal('https://example.com/?q=133', el.find('input[name="a"]').parents('.controls').find('a[href]').attr('href')) assert.equal('https://example.com/?q=abc%20d', el.find('select[name="b"]').parents('.controls').find('a[href]').attr('href')) }); + +QUnit.test("Fixes #3909 - Wrong size for textareas in triggers and core workflow.", assert => { + var done = assert.async(1) + $('#qunit').append('