Browse Source

Remove _.template from EditorView

pull/3677/head
Artur Arseniev 5 years ago
parent
commit
9d5df17bb9
  1. 34
      src/code_manager/view/EditorView.js

34
src/code_manager/view/EditorView.js

@ -1,24 +1,28 @@
import { template } from 'underscore';
import Backbone from 'backbone';
import html from 'utils/html';
import { View } from 'backbone';
export default Backbone.View.extend({
template: template(`
<div class="<%= pfx %>editor" id="<%= pfx %><%= codeName %>">
<div id="<%= pfx %>title"><%= label %></div>
<div id="<%= pfx %>code"></div>
</div>`),
export default class EditorView extends View {
template({ pfx, codeName, label }) {
return html`
<div class="${pfx}editor" id="${pfx}${codeName}">
<div id="${pfx}title">${label}</div>
<div id="${pfx}code"></div>
</div>
`;
}
initialize(o) {
this.config = o.config || {};
this.pfx = this.config.stylePrefix;
},
}
render() {
var obj = this.model.toJSON();
obj.pfx = this.pfx;
this.$el.html(this.template(obj));
this.$el.attr('class', this.pfx + 'editor-c');
this.$el.find('#' + this.pfx + 'code').append(this.model.get('input'));
const { model, pfx, $el } = this;
const obj = model.toJSON();
obj.pfx = pfx;
$el.html(this.template(obj));
$el.attr('class', `${pfx}editor-c`);
$el.find(`#${pfx}code`).append(model.get('input'));
return this;
}
});
}

Loading…
Cancel
Save