From f289b6767ff566546408f6f01b2760764e8849bc Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 23 Mar 2018 09:30:18 +0100 Subject: [PATCH] Elastic: Don't set form-control class on input[type=button] --- skins/elastic/ui.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/skins/elastic/ui.js b/skins/elastic/ui.js index c7b764ffb..7bf94d0f3 100644 --- a/skins/elastic/ui.js +++ b/skins/elastic/ui.js @@ -648,7 +648,7 @@ function rcube_elastic_ui() $.each(['warning', 'error', 'information', 'confirmation'], function() { var type = this; - $('.box' + type, context).each(function() { + $('.box' + type + ':not(.ui.alert)', context).each(function() { alert_style(this, type, true); }); }); @@ -680,7 +680,8 @@ function rcube_elastic_ui() } // Forms - $('input:not(.button,[type=file],[type=radio],[type=checkbox]),select,textarea', $('.propform', context)).addClass('form-control'); + var supported_controls = 'input:not(.button,[type=button],[type=file],[type=radio],[type=checkbox]),select,textarea'; + $(supported_controls, $('.propform', context)).addClass('form-control'); $('[type=checkbox]', $('.propform', context)).addClass('form-check-input'); $('table.propform', context).each(function() { var text_rows = 0, form_rows = 0; @@ -739,7 +740,11 @@ function rcube_elastic_ui() // Other forms, e.g. Contact advanced search $('fieldset.propform:not(.groupped) div.row', context).each(function() { - var has_input = $('input:not([type=hidden]),select,textarea', this).addClass('form-control').length > 0; + var has_input = $('input:not([type=hidden]),select,textarea', this).length > 0; + + if (has_input) { + $(supported_controls, this).addClass('form-control'); + } $(this).children().last().addClass('col-sm-8' + (!has_input ? ' form-control-plaintext' : '')); $(this).children().first().addClass('col-sm-4 col-form-label'); @@ -750,9 +755,13 @@ function rcube_elastic_ui() $('fieldset.propform.groupped fieldset', context).each(function() { $('.row', this).each(function() { var label, first, - has_input = $('input,select,textarea', this).addClass('form-control').length > 0, + has_input = $('input,select,textarea', this).length > 0, items = $(this).children(); + if (has_input) { + $(supported_controls, this).addClass('form-control'); + } + if (items.length < 2) { return; } @@ -779,7 +788,8 @@ function rcube_elastic_ui() $('.propform > .prop.block:not(.row)', context).each(function() { $(this).addClass('form-group row').each(function() { $('label', this).addClass('col-form-label').wrap($('
')); - $('input,select,textarea', this).addClass('form-control').wrap($('
')); + $('input,select,textarea', this).wrap($('
')); + $(supported_controls, this).addClass('form-control'); }); }); @@ -834,7 +844,7 @@ function rcube_elastic_ui() $('.toolbarmenu select', context).addClass('form-control'); if (context != document) { - $('select,textarea,input:not([type=checkbox],[type=radio],[type=file])', context).addClass('form-control'); + $(supported_controls, context).addClass('form-control'); } // The same for some other checkboxes