* fix: multi lines and spaces issues * fix: eslint operator-linebreak issue * fix: eslint quotes issue * fix: remaining quotes issues * fix: eslint object curly newline issue * fix: eslint object curly spacing issue * fix: eslint brace-style issues * fix: react jsx indent and props issues * fix: eslint trailing spaces issues * fix: eslint linbreak style issue * fix: eslint space unary operator issue * fix: eslint line around directives issue * fix: void and typeof space unary ops issue
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
/**
|
|
* A generic header view class.
|
|
*/
|
|
(function(define) {
|
|
'use strict';
|
|
|
|
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;
|
|
HtmlUtils.setHtml(
|
|
this.$el,
|
|
this.template(json)
|
|
);
|
|
if (this.headerActionsView) {
|
|
this.headerActionsView.setElement(this.$('.page-header-secondary')).render();
|
|
}
|
|
return this;
|
|
}
|
|
});
|
|
|
|
return HeaderView;
|
|
});
|
|
}).call(this, define || RequireJS.define);
|