app/assets/javascripts/pageflow/dist/ui.js in pageflow-15.1.2 vs app/assets/javascripts/pageflow/dist/ui.js in pageflow-15.2.0
- old
+ new
@@ -1139,10 +1139,11 @@
* @mixin
*/
var inputView = {
ui: {
+ label: 'label',
labelText: 'label .name',
inlineHelp: 'label .inline_help'
},
/**
@@ -1184,10 +1185,11 @@
if (!this.inlineHelpText()) {
this.ui.inlineHelp.hide();
}
+ this.setLabelFor();
this.updateDisabled();
this.setupVisibleBinding();
},
/**
@@ -1218,9 +1220,16 @@
return _.compact([findTranslation(keys, {
defaultValue: '',
html: true
}), this.options.additionalInlineHelpText]).join(' ');
+ },
+ setLabelFor: function setLabelFor() {
+ if (this.ui.input && this.ui.label.length === 1 && !this.ui.input.attr('id')) {
+ var id = 'input_' + this.model.modelName + '_' + this.options.propertyName;
+ this.ui.input.attr('id', id);
+ this.ui.label.attr('for', id);
+ }
},
updateDisabled: function updateDisabled() {
if (this.ui.input) {
this.updateDisabledAttribute(this.ui.input);
}