PROD-2196
This commit is contained in:
committed by
Ali-D-Akbar
parent
bee77a2c7f
commit
3ed0f7d8ea
@@ -3,26 +3,33 @@
|
||||
*/
|
||||
(function(define) {
|
||||
'use strict';
|
||||
define(['backbone', 'text!templates/components/header/header.underscore'],
|
||||
function(Backbone, headerTemplate) {
|
||||
var HeaderView = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.template = _.template(headerTemplate);
|
||||
this.headerActionsView = options.headerActionsView;
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
this.render();
|
||||
},
|
||||
define([
|
||||
'backbone',
|
||||
'text!templates/components/header/header.underscore',
|
||||
'edx-ui-toolkit/js/utils/html-utils'
|
||||
],
|
||||
function(Backbone, headerTemplate, HtmlUtils) {
|
||||
var HeaderView = Backbone.View.extend({
|
||||
initialize: function(options) {
|
||||
this.template = HtmlUtils.template(headerTemplate);
|
||||
this.headerActionsView = options.headerActionsView;
|
||||
this.listenTo(this.model, 'change', this.render);
|
||||
this.render();
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var json = this.model.attributes;
|
||||
this.$el.html(this.template(json));
|
||||
if (this.headerActionsView) {
|
||||
this.headerActionsView.setElement(this.$('.page-header-secondary')).render();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
render: function() {
|
||||
var json = this.model.attributes;
|
||||
HtmlUtils.setHtml(
|
||||
this.$el,
|
||||
this.template(json)
|
||||
);
|
||||
if (this.headerActionsView) {
|
||||
this.headerActionsView.setElement(this.$('.page-header-secondary')).render();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
return HeaderView;
|
||||
});
|
||||
return HeaderView;
|
||||
});
|
||||
}).call(this, define || RequireJS.define);
|
||||
|
||||
Reference in New Issue
Block a user