js/src/shared/ModuleBrowser/ModuleBrowserDescriptions.js
//KB.Backbone.ModuleBrowserModuleDescription
var tplModuleTemplateDescription = require('templates/backend/modulebrowser/module-template-description.hbs');
var tplModuleDescription = require('templates/backend/modulebrowser/module-description.hbs');
module.exports = Backbone.View.extend({
initialize: function (options) {
this.options = options || {};
this.Browser = options.browser;
this.Browser.on('browser:close', this.close, this);
},
events:{
'click .kb-js-create-module' : 'createModule'
},
update: function () {
var that = this;
this.$el.empty();
if (this.model.get('template')) {
this.$el.html(tplModuleTemplateDescription( {module: this.model.toJSON(), i18n: KB.i18n}));
} else {
this.$el.html(tplModuleDescription({module: this.model.toJSON(), i18n: KB.i18n}));
}
if (this.model.get('settings').helptext !== false) {
this.$el.append(this.model.get('settings').helptext);
}
},
close: function () {
// this.unbind();
// this.remove();
// delete this.$el;
// delete this.el;
},
createModule: function(){
this.Browser.createModule(this.model);
}
});