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

Loading…
Cancel
Save