Browse Source

Add getElInput to Trait

refactor-traits
Artur Arseniev 7 years ago
parent
commit
db35f5b9bc
  1. 2
      dist/css/grapes.min.css
  2. 1
      src/styles/scss/_gjs_traits.scss
  3. 16
      src/trait_manager/view/TraitView.js

2
dist/css/grapes.min.css

File diff suppressed because one or more lines are too long

1
src/styles/scss/_gjs_traits.scss

@ -32,6 +32,7 @@
justify-content: flex-start;
padding: 5px 10px;
font-weight: lighter;
align-items: center;
&s {
font-size: $fontSizeS;

16
src/trait_manager/view/TraitView.js

@ -167,25 +167,29 @@ export default Backbone.View.extend({
return !isUndefined(value) ? value : '';
},
getElInput() {
return this.elInput;
},
/**
* Renders input
* @private
* */
renderField() {
const { $el, target, appendInput } = this;
let tpl = this.getInputEl();
if (this.createInput) {
tpl = this.createInput({ component: target });
}
const inputOpts = { component: target };
const inputs = $el.find('[data-input]');
const el = inputs[inputs.length - 1];
let tpl = this.createInput
? this.createInput(inputOpts)
: this.getInputEl();
if (isString(tpl)) {
el.innerHTML = tpl;
this.elInput = el.firstChild;
} else {
appendInput ? el.appendChild(tpl) : el.insertBefore(tpl, el.firstChild);
this.elInput = tpl;
}
},

Loading…
Cancel
Save