Co-Authored-By: Jean-Michel Claus <jmc@edx.org> Co-Authored-By: Brian Talbot <btalbot@edx.org> Co-Authored-By: Tim Babych <tim@edx.org> Co-Authored-By: Oleg Marshev <oleg@edx.org> Co-Authored-By: Chris Rodriguez <crodriguez@edx.org>
35 lines
867 B
JavaScript
35 lines
867 B
JavaScript
;(function (define, undefined) {
|
|
'use strict';
|
|
define(['backbone'], function (Backbone) {
|
|
var TabModel = Backbone.Model.extend({
|
|
defaults: {
|
|
'identifier': '',
|
|
'name': '',
|
|
'icon': '',
|
|
'is_active': false,
|
|
'is_closable': false
|
|
},
|
|
|
|
activate: function () {
|
|
this.collection.each(_.bind(function(model) {
|
|
// Inactivate all other models.
|
|
if (model !== this) {
|
|
model.inactivate();
|
|
}
|
|
}, this));
|
|
this.set('is_active', true);
|
|
},
|
|
|
|
inactivate: function () {
|
|
this.set('is_active', false);
|
|
},
|
|
|
|
isActive: function () {
|
|
return this.get('is_active');
|
|
}
|
|
});
|
|
|
|
return TabModel;
|
|
});
|
|
}).call(this, define || RequireJS.define);
|