2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-21 01:43:58 +00:00
|
|
|
define(
|
|
|
|
[
|
2013-06-24 23:41:59 +00:00
|
|
|
'marionette',
|
2013-06-21 01:43:58 +00:00
|
|
|
'Shared/Toolbar/Radio/RadioButtonView',
|
|
|
|
'Config'
|
2013-06-24 23:41:59 +00:00
|
|
|
], function (Marionette, RadioButtonView, Config) {
|
|
|
|
return Marionette.CollectionView.extend({
|
2013-06-21 01:43:58 +00:00
|
|
|
className: 'btn-group',
|
2013-06-24 23:41:59 +00:00
|
|
|
itemView : RadioButtonView,
|
2013-04-26 04:45:45 +00:00
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
attributes: {
|
|
|
|
'data-toggle': 'buttons-radio'
|
|
|
|
},
|
2013-04-26 04:45:45 +00:00
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
initialize: function (options) {
|
|
|
|
this.menu = options.menu;
|
2013-04-26 04:45:45 +00:00
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
if (this.menu.storeState) {
|
|
|
|
this.setActive();
|
|
|
|
}
|
|
|
|
},
|
2013-04-26 04:45:45 +00:00
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
setActive: function () {
|
2013-08-04 01:27:12 +00:00
|
|
|
var storedKey = Config.getValue(this.menu.menuKey, this.menu.defaultAction);
|
2013-04-26 04:45:45 +00:00
|
|
|
|
2013-06-21 01:43:58 +00:00
|
|
|
this.collection.each(function (model) {
|
|
|
|
if (model.get('key').toLocaleLowerCase() === storedKey.toLowerCase()) {
|
|
|
|
model.set('active', true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
model.set('active, false');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2013-04-26 04:45:45 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|