Fixes #3909 - Wrong size for textareas in triggers and core workflow.
This commit is contained in:
parent
93fcc862e5
commit
6489fc7602
4 changed files with 38 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' )
|
||||
|
||||
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
|
||||
item
|
||||
|
|
|
@ -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('<hr><h1>Fixes #3909 - Wrong size for textareas in triggers and core workflow.</h1><form id="form21"></form>')
|
||||
var el = $('#form21')
|
||||
new App.ControllerForm({
|
||||
el: el,
|
||||
model: {
|
||||
configure_attributes: [
|
||||
{ name: '3909_textarea_expanding', display: 'Textarea1', tag: 'textarea', rows: 6, limit: 100, null: true },
|
||||
{ name: '3909_textarea_no_expanding', display: 'Textarea2', tag: 'textarea', rows: 6, limit: 100, null: false, expanding: false },
|
||||
],
|
||||
},
|
||||
autofocus: true
|
||||
});
|
||||
|
||||
new Promise( (resolve, reject) => {
|
||||
App.Delay.set(resolve, 200);
|
||||
}).then( function() {
|
||||
assert.equal(el.find('textarea[name="3909_textarea_expanding"]').parent().hasClass('expanding-wrapper'), true, '3909_textarea_expanding has correct class')
|
||||
assert.equal(el.find('textarea[name="3909_textarea_no_expanding"]').parent().hasClass('expanding-wrapper'), false, '3909_textarea_no_expanding has correct class')
|
||||
})
|
||||
.finally(done)
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue