parent
6636b77489
commit
fe554849c2
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/ButtonModel'], function () {
|
||||
NzbDrone.Shared.Toolbar.ButtonCollection = Backbone.Collection.extend({
|
||||
model: NzbDrone.Shared.Toolbar.ButtonModel
|
||||
});
|
||||
});
|
||||
|
@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/CommandView'], function () {
|
||||
NzbDrone.Shared.Toolbar.ButtonGroupView = Backbone.Marionette.CollectionView.extend({
|
||||
className: 'btn-group',
|
||||
itemView : NzbDrone.Shared.Toolbar.CommandView
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.ActionTypes =
|
||||
{
|
||||
RouteTrigger: 'RouteTrigger',
|
||||
CallBack : 'CallBack'
|
||||
};
|
||||
|
||||
NzbDrone.Shared.Toolbar.ButtonModel = Backbone.Model.extend({
|
||||
defaults: {
|
||||
'target' : '/nzbdrone/route',
|
||||
'title' : '',
|
||||
'active' : false,
|
||||
'tooltip': undefined }
|
||||
});
|
||||
});
|
@ -1,7 +0,0 @@
|
||||
"use strict";
|
||||
define(['app', 'Shared/Toolbar/CommandModel'], function () {
|
||||
NzbDrone.Shared.Toolbar.CommandCollection = Backbone.Collection.extend({
|
||||
model: NzbDrone.Shared.Toolbar.CommandModel
|
||||
});
|
||||
});
|
||||
|
@ -1,17 +0,0 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.CommandTypes =
|
||||
{
|
||||
RouteTrigger: 'RouteTrigger'
|
||||
};
|
||||
|
||||
NzbDrone.Shared.Toolbar.CommandModel = Backbone.Model.extend({
|
||||
defaults: {
|
||||
'target' : '/nzbdrone/route',
|
||||
'title' : 'Title Goes Here',
|
||||
'alignment': 'left',
|
||||
'tooltip' : undefined
|
||||
}
|
||||
});
|
||||
});
|
@ -1,21 +0,0 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.CommandView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Shared/Toolbar/CommandTemplate',
|
||||
className: 'btn',
|
||||
|
||||
events: {
|
||||
'click': 'onClick'
|
||||
},
|
||||
|
||||
onClick: function () {
|
||||
window.alert('click');
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
|
||||
NzbDrone.Shared.Toolbar.RadioButtonView = Backbone.Marionette.ItemView.extend({
|
||||
template : 'Shared/Toolbar/ButtonTemplate',
|
||||
className: 'btn',
|
||||
|
||||
events: {
|
||||
'click': 'invokeCallback'
|
||||
},
|
||||
|
||||
|
||||
onRender: function () {
|
||||
if (this.model.get('active')) {
|
||||
this.$el.addClass('active');
|
||||
this.invokeCallback();
|
||||
}
|
||||
},
|
||||
|
||||
invokeCallback: function () {
|
||||
|
||||
if (!this.model.ownerContext) {
|
||||
throw 'ownerContext must be set.';
|
||||
}
|
||||
|
||||
|
||||
var callback = this.model.get('callback');
|
||||
if (callback) {
|
||||
callback.call(this.model.ownerContext);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue