mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-14 00:53:57 -07:00
shared toolbar radio button style is working. just need to store state.
This commit is contained in:
parent
6636b77489
commit
fe554849c2
15 changed files with 183 additions and 142 deletions
34
UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
Normal file
34
UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/Radio/RadioButtonView', 'Config'], function () {
|
||||
NzbDrone.Shared.Toolbar.RadioButtonCollectionView = Backbone.Marionette.CollectionView.extend({
|
||||
className: 'btn-group',
|
||||
itemView : NzbDrone.Shared.Toolbar.RadioButtonView,
|
||||
|
||||
attributes: {
|
||||
'data-toggle': 'buttons-radio'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
this.menu = options.menu;
|
||||
|
||||
if (this.menu.storeState) {
|
||||
this.setActive();
|
||||
}
|
||||
},
|
||||
|
||||
setActive: function () {
|
||||
var storedKey = NzbDrone.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');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue