Browse Source

Update href trait value. Closes #2411

pull/2436/head
Artur Arseniev 7 years ago
parent
commit
68f5cc61a9
  1. 2
      src/i18n/locale/en.js
  2. 2
      src/i18n/locale/it.js
  3. 2
      src/trait_manager/config/config.js
  4. 11
      src/trait_manager/model/Trait.js
  5. 2
      src/trait_manager/view/TraitSelectView.js

2
src/i18n/locale/en.js

@ -108,7 +108,7 @@ export default {
// In a trait like select, these are used to translate option names // In a trait like select, these are used to translate option names
options: { options: {
target: { target: {
'': 'This window', false: 'This window',
_blank: 'New window' _blank: 'New window'
} }
} }

2
src/i18n/locale/it.js

@ -94,7 +94,7 @@ export default {
}, },
options: { options: {
target: { target: {
'': 'Questa finestra', false: 'Questa finestra',
_blank: 'Nuova finestra' _blank: 'Nuova finestra'
} }
} }

2
src/trait_manager/config/config.js

@ -6,5 +6,5 @@ export default {
appendTo: '', appendTo: '',
// Default options for the target input // Default options for the target input
optionsTarget: [{ value: '' }, { value: '_blank' }] optionsTarget: [{ value: false }, { value: '_blank' }]
}; };

11
src/trait_manager/model/Trait.js

@ -64,12 +64,19 @@ export default Backbone.Model.extend({
const target = this.target; const target = this.target;
const name = this.get('name'); const name = this.get('name');
if (isUndefined(value)) return; if (isUndefined(value)) return;
let valueToSet = value;
if (value === 'false') {
valueToSet = false;
} else if (value === 'true') {
valueToSet = true;
}
if (this.get('changeProp')) { if (this.get('changeProp')) {
target.set(name, value, opts); target.set(name, valueToSet, opts);
} else { } else {
const attrs = { ...target.get('attributes') }; const attrs = { ...target.get('attributes') };
attrs[name] = value; attrs[name] = valueToSet;
target.set('attributes', attrs, opts); target.set('attributes', attrs, opts);
} }
}, },

2
src/trait_manager/view/TraitSelectView.js

@ -54,7 +54,7 @@ export default TraitView.extend({
input += '</select>'; input += '</select>';
this.$input = $(input); this.$input = $(input);
let val = model.getTargetValue() || model.get('value'); const val = model.getTargetValue();
!isUndefined(val) && this.$input.val(val); !isUndefined(val) && this.$input.val(val);
} }

Loading…
Cancel
Save