Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1160x 1160x 1160x 3669x 3669x 11451x 11451x 1160x 3669x 3669x 3669x 3669x 3669x 7338x 7338x 3669x | define(
['backbone', 'underscore'],
function (Backbone, _) {
'use strict';
var Indicator = Backbone.Model.extend({
defaults: {
value: null,
className: 'AknNotificationMenu-count',
emptyClass: 'AknNotificationMenu-count--hidden',
nonEmptyClass: ''
}
});
var IndicatorView = Backbone.View.extend({
model: Indicator,
template: _.template(
'<span class="<%= className %> <%= value ? nonEmptyClass : emptyClass %>"><%= value %></span>'
),
initialize: function () {
this.listenTo(this.model, 'change', this.render);
this.render();
},
render: function () {
this.$el.html(this.template(this.model.toJSON()));
return this;
}
});
return function (opts) {
var el = opts.el || null;
delete opts.el;
var indicator = new Indicator(opts);
var indicatorView = new IndicatorView({el: el, model: indicator});
indicator.setElement = function () {
indicatorView.setElement.apply(indicatorView, arguments);
return indicatorView.render();
};
return indicator;
};
}
);
|