You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js

40 lines
1.1 KiB

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