Browse Source

Add type class to trait element

pull/2872/head
Artur Arseniev 6 years ago
parent
commit
eaa21f3503
  1. 15
      src/trait_manager/view/TraitView.js

15
src/trait_manager/view/TraitView.js

@ -37,12 +37,13 @@ export default Backbone.View.extend({
this.target = target; this.target = target;
const { ppfx } = this; const { ppfx } = this;
this.clsField = `${ppfx}field ${ppfx}field-${type}`; this.clsField = `${ppfx}field ${ppfx}field-${type}`;
[['change:value', this.onValueChange], ['remove', this.removeView]].forEach( [
([event, clb]) => { ['change:value', this.onValueChange],
model.off(event, clb); ['remove', this.removeView]
this.listenTo(model, event, clb); ].forEach(([event, clb]) => {
} model.off(event, clb);
); this.listenTo(model, event, clb);
});
model.view = this; model.view = this;
this.listenTo(model, 'change:label', this.render); this.listenTo(model, 'change:label', this.render);
this.listenTo(model, 'change:placeholder', this.rerender); this.listenTo(model, 'change:placeholder', this.rerender);
@ -261,7 +262,7 @@ export default Backbone.View.extend({
const hasLabel = this.hasLabel && this.hasLabel(); const hasLabel = this.hasLabel && this.hasLabel();
const cls = `${pfx}trait`; const cls = `${pfx}trait`;
this.$input = null; this.$input = null;
let tmpl = `<div class="${cls}"> let tmpl = `<div class="${cls} ${cls}--${type}">
${hasLabel ? `<div class="${ppfx}label-wrp" data-label></div>` : ''} ${hasLabel ? `<div class="${ppfx}label-wrp" data-label></div>` : ''}
<div class="${ppfx}field-wrp ${ppfx}field-wrp--${type}" data-input> <div class="${ppfx}field-wrp ${ppfx}field-wrp--${type}" data-input>
${ ${

Loading…
Cancel
Save