From 23e25bf600a61b419108d154b452fa18fed0f7ce Mon Sep 17 00:00:00 2001 From: Samy Laumonier <159024@supinfo.com> Date: Mon, 18 Apr 2016 19:04:41 +0200 Subject: [PATCH 1/2] Handle multiple selects --- components/afFormGroup/afFormGroup.js | 1 + inputTypes/select-multiple/select-multiple.js | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/components/afFormGroup/afFormGroup.js b/components/afFormGroup/afFormGroup.js index d318215..fb6be05 100644 --- a/components/afFormGroup/afFormGroup.js +++ b/components/afFormGroup/afFormGroup.js @@ -46,6 +46,7 @@ Template.afFormGroup_materialize.rendered = function() { var placeholder = _this.data.afFieldInputAtts.placeholder; var skipActiveLabelTypes = [ 'select', + 'select-multiple', 'checkbox', 'checkbox-group', 'boolean-checkbox', diff --git a/inputTypes/select-multiple/select-multiple.js b/inputTypes/select-multiple/select-multiple.js index 4a58e1f..50a299c 100644 --- a/inputTypes/select-multiple/select-multiple.js +++ b/inputTypes/select-multiple/select-multiple.js @@ -1,10 +1,6 @@ Template.afSelectMultiple_materialize.helpers({ + atts: Utility.attsToggleInvalidClass, optionAtts: Utility.optionAtts }); -Template.afSelectMultiple_materialize.helpers({ - atts: function() { - var atts = Utility.attsToggleInvalidClass.call(this); - return AutoForm.Utility.addClass(atts, 'browser-default'); - } -}); +Template.afSelectMultiple_materialize.onRendered(Utility.initializeSelect); From fd35dc90f603ff8740f51daa50e01cef7d23a29f Mon Sep 17 00:00:00 2001 From: Samy Laumonier <159024@supinfo.com> Date: Fri, 17 Jun 2016 13:07:17 +0200 Subject: [PATCH 2/2] Custom HTML attributes for option tags in select tags --- utilities/option-atts.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/utilities/option-atts.js b/utilities/option-atts.js index f3a3c7f..4fba7a7 100644 --- a/utilities/option-atts.js +++ b/utilities/option-atts.js @@ -1,11 +1,13 @@ Utility.optionAtts = function() { - var atts, item; - item = this; - atts = { - value: item.value - }; - if (item.selected) { + var atts = _.pick(this, 'value'); + + if (this.selected) { atts.selected = ''; } + + if (!_.isEmpty(this.htmlAtts)) { + _.extend(atts, this.htmlAtts); + } + return atts; };