mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
moved add series to require.
This commit is contained in:
parent
24c77b4047
commit
72772bed5a
16 changed files with 181 additions and 185 deletions
|
@ -1,103 +1,102 @@
|
|||
"use strict";
|
||||
define([
|
||||
'app',
|
||||
'Shared/Toolbar/Radio/RadioButtonCollectionView',
|
||||
'Shared/Toolbar/Button/ButtonCollectionView',
|
||||
'Shared/Toolbar/ButtonCollection'
|
||||
], function () {
|
||||
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Shared/Toolbar/Radio/RadioButtonCollectionView',
|
||||
'Shared/Toolbar/Button/ButtonCollectionView',
|
||||
'Shared/Toolbar/ButtonCollection'
|
||||
], function () {
|
||||
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
|
||||
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||
|
||||
regions: {
|
||||
left_1 : '.x-toolbar-left-1',
|
||||
left_2 : '.x-toolbar-left-2',
|
||||
right_1: '.x-toolbar-right-1',
|
||||
right_2: '.x-toolbar-right-2'
|
||||
},
|
||||
regions: {
|
||||
left_1 : '.x-toolbar-left-1',
|
||||
left_2 : '.x-toolbar-left-2',
|
||||
right_1: '.x-toolbar-right-1',
|
||||
right_2: '.x-toolbar-right-2'
|
||||
},
|
||||
|
||||
initialize: function (options) {
|
||||
initialize: function (options) {
|
||||
|
||||
if (!options) {
|
||||
throw 'options needs to be passed';
|
||||
}
|
||||
|
||||
if (!options.context) {
|
||||
throw 'context needs to be passed';
|
||||
}
|
||||
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.toolbarContext = options.context;
|
||||
|
||||
},
|
||||
|
||||
|
||||
onShow: function () {
|
||||
if (this.left) {
|
||||
_.each(this.left, this._showToolbarLeft, this);
|
||||
}
|
||||
if (this.right) {
|
||||
_.each(this.right, this._showToolbarRight, this);
|
||||
}
|
||||
},
|
||||
|
||||
_showToolbarLeft: function (element, index) {
|
||||
this._showToolbar(element, index, 'left');
|
||||
},
|
||||
|
||||
_showToolbarRight: function (element, index) {
|
||||
this._showToolbar(element, index, 'right');
|
||||
},
|
||||
|
||||
|
||||
_showToolbar: function (buttonGroup, index, position) {
|
||||
|
||||
var groupCollection = new NzbDrone.Shared.Toolbar.ButtonCollection();
|
||||
|
||||
_.each(buttonGroup.items, function (button) {
|
||||
|
||||
if (buttonGroup.storeState && !button.key) {
|
||||
throw 'must provide key for all buttons when storSstate is enabled';
|
||||
if (!options) {
|
||||
throw 'options needs to be passed';
|
||||
}
|
||||
|
||||
var model = new NzbDrone.Shared.Toolbar.ButtonModel(button);
|
||||
model.set('menuKey', buttonGroup.menuKey);
|
||||
model.ownerContext = this.toolbarContext;
|
||||
groupCollection.add(model);
|
||||
|
||||
}, this);
|
||||
|
||||
var buttonGroupView;
|
||||
|
||||
switch (buttonGroup.type) {
|
||||
case 'radio':
|
||||
{
|
||||
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView(
|
||||
{
|
||||
collection: groupCollection,
|
||||
menu : buttonGroup
|
||||
});
|
||||
break;
|
||||
if (!options.context) {
|
||||
throw 'context needs to be passed';
|
||||
}
|
||||
default :
|
||||
{
|
||||
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView(
|
||||
{
|
||||
collection: groupCollection,
|
||||
menu : buttonGroup
|
||||
});
|
||||
break;
|
||||
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.toolbarContext = options.context;
|
||||
|
||||
},
|
||||
|
||||
|
||||
onShow: function () {
|
||||
if (this.left) {
|
||||
_.each(this.left, this._showToolbarLeft, this);
|
||||
}
|
||||
if (this.right) {
|
||||
_.each(this.right, this._showToolbarRight, this);
|
||||
}
|
||||
},
|
||||
|
||||
_showToolbarLeft: function (element, index) {
|
||||
this._showToolbar(element, index, 'left');
|
||||
},
|
||||
|
||||
_showToolbarRight: function (element, index) {
|
||||
this._showToolbar(element, index, 'right');
|
||||
},
|
||||
|
||||
|
||||
_showToolbar: function (buttonGroup, index, position) {
|
||||
|
||||
var groupCollection = new NzbDrone.Shared.Toolbar.ButtonCollection();
|
||||
|
||||
_.each(buttonGroup.items, function (button) {
|
||||
|
||||
if (buttonGroup.storeState && !button.key) {
|
||||
throw 'must provide key for all buttons when storSstate is enabled';
|
||||
}
|
||||
|
||||
var model = new NzbDrone.Shared.Toolbar.ButtonModel(button);
|
||||
model.set('menuKey', buttonGroup.menuKey);
|
||||
model.ownerContext = this.toolbarContext;
|
||||
groupCollection.add(model);
|
||||
|
||||
}, this);
|
||||
|
||||
var buttonGroupView;
|
||||
|
||||
switch (buttonGroup.type) {
|
||||
case 'radio':
|
||||
{
|
||||
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView({
|
||||
collection: groupCollection,
|
||||
menu : buttonGroup
|
||||
});
|
||||
break;
|
||||
}
|
||||
default :
|
||||
{
|
||||
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView({
|
||||
collection: groupCollection,
|
||||
menu : buttonGroup
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this[position + '_' + (index + 1).toString()].show(buttonGroupView);
|
||||
}
|
||||
});
|
||||
|
||||
return NzbDrone.Shared.Toolbar.ToolbarLayout;
|
||||
|
||||
this[position + '_' + (index + 1).toString()].show(buttonGroupView);
|
||||
}
|
||||
});
|
||||
|
||||
return NzbDrone.Shared.Toolbar.ToolbarLayout;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue