1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-28 19:05:55 +00:00
Radarr/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
2013-08-05 19:01:32 -07:00

39 lines
1.1 KiB
JavaScript

'use strict';
define(
[
'marionette',
'Shared/Toolbar/Radio/RadioButtonView',
'Config'
], function (Marionette, RadioButtonView, Config) {
return Marionette.CollectionView.extend({
className: 'btn-group',
itemView : RadioButtonView,
attributes: {
'data-toggle': 'buttons-radio'
},
initialize: function (options) {
this.menu = options.menu;
if (this.menu.storeState) {
this.setActive();
}
},
setActive: function () {
var storedKey = Config.getValue(this.menu.menuKey, this.menu.defaultAction);
this.collection.each(function (model) {
if (model.get('key').toLocaleLowerCase() === storedKey.toLowerCase()) {
model.set('active', true);
}
else {
model.set('active, false');
}
});
}
});
});