mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-12 16:13:58 -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,7 +1,7 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
'App',
|
'app',
|
||||||
'backbone',
|
'backbone',
|
||||||
'Series/SeriesModel'
|
'Series/SeriesModel'
|
||||||
], function (App, Backbone, SeriesModel) {
|
], function (App, Backbone, SeriesModel) {
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
'app',
|
'backbone',
|
||||||
'AddSeries/RootFolders/Model',
|
'AddSeries/RootFolders/Model',
|
||||||
'mixins/backbone.signalr.mixin'
|
'mixins/backbone.signalr.mixin'
|
||||||
], function () {
|
], function (Backbone, RootFolderModel) {
|
||||||
|
|
||||||
var rootFolderCollection = Backbone.Collection.extend({
|
var rootFolderCollection = Backbone.Collection.extend({
|
||||||
url : NzbDrone.Constants.ApiRoot + '/rootfolder',
|
url : NzbDrone.Constants.ApiRoot + '/rootfolder',
|
||||||
model: NzbDrone.AddSeries.RootFolders.RootFolderModel
|
model: RootFolderModel
|
||||||
});
|
});
|
||||||
|
|
||||||
return new rootFolderCollection().BindSignalR();
|
var collection = new rootFolderCollection().BindSignalR();
|
||||||
|
|
||||||
|
return collection;
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,8 +4,8 @@ define(
|
||||||
[
|
[
|
||||||
'marionette',
|
'marionette',
|
||||||
'AddSeries/RootFolders/CollectionView',
|
'AddSeries/RootFolders/CollectionView',
|
||||||
'AddSeries/RootFolders/Model',
|
|
||||||
'AddSeries/RootFolders/Collection',
|
'AddSeries/RootFolders/Collection',
|
||||||
|
'AddSeries/RootFolders/Model',
|
||||||
'Mixins/AutoComplete'
|
'Mixins/AutoComplete'
|
||||||
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel) {
|
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel) {
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(['app'], function () {
|
define(
|
||||||
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
|
[
|
||||||
mutators: {
|
'backbone',
|
||||||
freeSpaceString: function () {
|
'sugar'
|
||||||
return this.get('freeSpace').bytes(2) + " Free";
|
], function (Backbone) {
|
||||||
}
|
return Backbone.Model.extend({
|
||||||
},
|
mutators: {
|
||||||
|
freeSpaceString: function () {
|
||||||
|
return this.get('freeSpace').bytes(2) + " Free";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
freeSpace: 0
|
freeSpace: 0
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
|
@ -3,4 +3,6 @@
|
||||||
<option value="{{id}}">{{path}}</option>
|
<option value="{{id}}">{{path}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<option value="addNew">Add a diffrent path</option>
|
<option value="addNew">Add a diffrent path</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
{{debug}}
|
|
@ -1,13 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
define(
|
|
||||||
[
|
|
||||||
'AddSeries/RootFolders/Collection',
|
|
||||||
'handlebars'
|
|
||||||
], function (rootFolders, Handlebars) {
|
|
||||||
|
|
||||||
Handlebars.registerHelper('rootFolderSelection', function () {
|
|
||||||
var templateFunction = Marionette.TemplateCache.get('AddSeries/RootFolders/RootFolderSelectionTemplate');
|
|
||||||
return new Handlebars.SafeString(templateFunction(rootFolders.toJSON()));
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -2,7 +2,8 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span2">
|
<div class="span2">
|
||||||
<a href="{{traktUrl}}" target="_blank">
|
<a href="{{traktUrl}}" target="_blank">
|
||||||
<img class="add-series-poster" src="{{remotePoster}}" {{defaultImg}}>
|
<img class="add-series-poster" src="{{remotePoster}}"
|
||||||
|
{{defaultImg}}>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
|
@ -19,12 +20,13 @@
|
||||||
<icon class="icon-plus"></icon>
|
<icon class="icon-plus"></icon>
|
||||||
</div>
|
</div>
|
||||||
{{#unless isExisting}}
|
{{#unless isExisting}}
|
||||||
{{rootFolderSelection}}
|
{{> RootFolderSelectionPartial rootFolders}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<div class='pull-right'>
|
<div class='pull-right'>
|
||||||
{{qualityProfileSelection}}
|
{{> QualityProfileSelectionPartial qualityProfiles}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{debug}}
|
||||||
|
|
|
@ -3,11 +3,12 @@ define(
|
||||||
[
|
[
|
||||||
'app',
|
'app',
|
||||||
'marionette',
|
'marionette',
|
||||||
'Config',
|
'Quality/QualityProfileCollection',
|
||||||
|
'AddSeries/RootFolders/Collection',
|
||||||
'Series/SeriesCollection',
|
'Series/SeriesCollection',
|
||||||
'Shared/Messenger',
|
'Config',
|
||||||
'Quality/QualityProfileCollection'
|
'Shared/Messenger'
|
||||||
], function (App, Marionette, Config, SeriesCollection, Messenger, QualityProfiles) {
|
], function (App, Marionette, QualityProfiles, RootFolders, SeriesCollection, Config, Messenger) {
|
||||||
|
|
||||||
return Marionette.ItemView.extend({
|
return Marionette.ItemView.extend({
|
||||||
|
|
||||||
|
@ -88,8 +89,15 @@ define(
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
serializeData: function () {
|
||||||
|
var data = this.model.toJSON();
|
||||||
|
data.rootFolders = RootFolders.toJSON();
|
||||||
|
data.qualityProfiles = QualityProfiles.toJSON();
|
||||||
|
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(['app',
|
define(
|
||||||
'Settings/SettingsLayout',
|
[
|
||||||
'Form/FormBuilder',
|
'app',
|
||||||
'AddSeries/AddSeriesLayout',
|
'Settings/SettingsLayout',
|
||||||
'Series/Index/SeriesIndexLayout',
|
'AddSeries/AddSeriesLayout',
|
||||||
'Calendar/CalendarLayout',
|
'Form/FormBuilder',
|
||||||
'Shared/NotificationView',
|
'Series/Index/SeriesIndexLayout',
|
||||||
'Shared/NotFoundView',
|
'Calendar/CalendarLayout',
|
||||||
'MainMenuView',
|
'Shared/NotificationView',
|
||||||
'Series/Details/SeriesDetailsLayout',
|
'Shared/NotFoundView',
|
||||||
'Series/EpisodeCollection',
|
'MainMenuView',
|
||||||
'Logs/Layout',
|
'Series/Details/SeriesDetailsLayout',
|
||||||
'Release/Layout',
|
'Series/EpisodeCollection',
|
||||||
'Missing/MissingLayout',
|
'Logs/Layout',
|
||||||
'History/HistoryLayout',
|
'Release/Layout',
|
||||||
'Shared/FormatHelpers',
|
'Missing/MissingLayout',
|
||||||
'Shared/TemplateHelpers',
|
'History/HistoryLayout',
|
||||||
'Shared/Footer/View'],
|
'Shared/FormatHelpers',
|
||||||
function (App, SettingsLayout) {
|
'Shared/TemplateHelpers',
|
||||||
|
'Shared/Footer/View'
|
||||||
|
], function (App, SettingsLayout, AddSeriesLayout) {
|
||||||
var controller = Backbone.Marionette.Controller.extend({
|
var controller = Backbone.Marionette.Controller.extend({
|
||||||
|
|
||||||
series : function () {
|
series : function () {
|
||||||
|
@ -39,7 +41,7 @@ define(['app',
|
||||||
|
|
||||||
addSeries: function (action) {
|
addSeries: function (action) {
|
||||||
this._setTitle('Add Series');
|
this._setTitle('Add Series');
|
||||||
App.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout({action: action}));
|
App.mainRegion.show(new AddSeriesLayout({action: action}));
|
||||||
},
|
},
|
||||||
|
|
||||||
calendar: function () {
|
calendar: function () {
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
define(['app', 'Quality/QualityProfileCollection','handlebars'], function (app, qualityProfiles,Handlebars) {
|
|
||||||
|
|
||||||
Handlebars.registerHelper('qualityProfileSelection', function () {
|
|
||||||
|
|
||||||
var templateFunction = Marionette.TemplateCache.get('Quality/QualityProfileSelectionTemplate');
|
|
||||||
return new Handlebars.SafeString(templateFunction(qualityProfiles.toJSON()));
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,23 +1,18 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define(function () {
|
define(function () {
|
||||||
|
|
||||||
//This module will automatically route all links through backbone router rather than
|
//This module will automatically route all links through backbone router rather than
|
||||||
//causing links to reload pages.
|
//causing links to reload pages.
|
||||||
|
|
||||||
var routeBinder = {
|
var routeBinder = {
|
||||||
|
|
||||||
bind: function (router) {
|
bind: function (router) {
|
||||||
|
var self = this;
|
||||||
this._router = router;
|
$(document).on('click', 'a[href]', function (event) {
|
||||||
|
self._handleClick(event, router);
|
||||||
$(document).on('click', 'a[href]', this._handleClick);
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_isInTab: function (element) {
|
_handleClick: function (event, router) {
|
||||||
return;
|
|
||||||
},
|
|
||||||
|
|
||||||
_handleClick: function (event) {
|
|
||||||
var $target = $(event.target);
|
var $target = $(event.target);
|
||||||
|
|
||||||
//check if tab nav
|
//check if tab nav
|
||||||
|
@ -47,7 +42,7 @@ define(function () {
|
||||||
|
|
||||||
|
|
||||||
if (!href.startsWith('http')) {
|
if (!href.startsWith('http')) {
|
||||||
this._router.navigate(href, { trigger: true });
|
router.navigate(href, { trigger: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|
21
UI/Router.js
21
UI/Router.js
|
@ -1,11 +1,13 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
require(
|
require(
|
||||||
[
|
[
|
||||||
|
'app',
|
||||||
'marionette',
|
'marionette',
|
||||||
'Controller'
|
'Controller',
|
||||||
], function (Marionette, Controller) {
|
'RouteBinder'
|
||||||
|
], function (App, Marionette, Controller, RouterBinder) {
|
||||||
|
|
||||||
return Marionette.AppRouter.extend({
|
NzbDrone.Router = Marionette.AppRouter.extend({
|
||||||
|
|
||||||
controller: Controller,
|
controller: Controller,
|
||||||
appRoutes : {
|
appRoutes : {
|
||||||
|
@ -25,5 +27,18 @@ require(
|
||||||
':whatever' : 'notFound'
|
':whatever' : 'notFound'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
NzbDrone.addInitializer(function () {
|
||||||
|
|
||||||
|
NzbDrone.Router = new NzbDrone.Router();
|
||||||
|
Backbone.history.start({ pushState: true });
|
||||||
|
|
||||||
|
RouterBinder.bind(NzbDrone.Router);
|
||||||
|
// NzbDrone.footerRegion.show(new FooterView());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return NzbDrone.Router;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ define([
|
||||||
'Quality/QualityProfileCollection',
|
'Quality/QualityProfileCollection',
|
||||||
'Series/SeriesCollection',
|
'Series/SeriesCollection',
|
||||||
'Series/Edit/EditSeriesView',
|
'Series/Edit/EditSeriesView',
|
||||||
'Series/Delete/DeleteSeriesView'
|
'Series/Delete/DeleteSeriesView',
|
||||||
|
'Shared/FormatHelpers'
|
||||||
|
|
||||||
], function () {
|
], function () {
|
||||||
NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
|
NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
|
||||||
|
|
|
@ -1,103 +1,102 @@
|
||||||
"use strict";
|
"use strict";
|
||||||
define([
|
define(
|
||||||
'app',
|
[
|
||||||
'Shared/Toolbar/Radio/RadioButtonCollectionView',
|
'app',
|
||||||
'Shared/Toolbar/Button/ButtonCollectionView',
|
'Shared/Toolbar/Radio/RadioButtonCollectionView',
|
||||||
'Shared/Toolbar/ButtonCollection'
|
'Shared/Toolbar/Button/ButtonCollectionView',
|
||||||
], function () {
|
'Shared/Toolbar/ButtonCollection'
|
||||||
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
|
], function () {
|
||||||
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
|
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
|
||||||
|
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
|
||||||
|
|
||||||
regions: {
|
regions: {
|
||||||
left_1 : '.x-toolbar-left-1',
|
left_1 : '.x-toolbar-left-1',
|
||||||
left_2 : '.x-toolbar-left-2',
|
left_2 : '.x-toolbar-left-2',
|
||||||
right_1: '.x-toolbar-right-1',
|
right_1: '.x-toolbar-right-1',
|
||||||
right_2: '.x-toolbar-right-2'
|
right_2: '.x-toolbar-right-2'
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
|
|
||||||
if (!options) {
|
if (!options) {
|
||||||
throw 'options needs to be passed';
|
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';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var model = new NzbDrone.Shared.Toolbar.ButtonModel(button);
|
if (!options.context) {
|
||||||
model.set('menuKey', buttonGroup.menuKey);
|
throw 'context needs to be passed';
|
||||||
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 :
|
|
||||||
{
|
this.left = options.left;
|
||||||
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView(
|
this.right = options.right;
|
||||||
{
|
this.toolbarContext = options.context;
|
||||||
collection: groupCollection,
|
|
||||||
menu : buttonGroup
|
},
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
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;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
15
UI/app.js
15
UI/app.js
|
@ -148,10 +148,9 @@ define(
|
||||||
[
|
[
|
||||||
'marionette',
|
'marionette',
|
||||||
'shared/modal/region',
|
'shared/modal/region',
|
||||||
'router',
|
|
||||||
'Instrumentation/StringFormat',
|
'Instrumentation/StringFormat',
|
||||||
'Instrumentation/ErrorHandler'
|
'Instrumentation/ErrorHandler'
|
||||||
], function (Marionette, ModalRegion, Router, RouteBinder) {
|
], function (Marionette, ModalRegion) {
|
||||||
|
|
||||||
require(
|
require(
|
||||||
[
|
[
|
||||||
|
@ -175,12 +174,6 @@ define(
|
||||||
Details: {}
|
Details: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.NzbDrone.AddSeries = {
|
|
||||||
New : {},
|
|
||||||
Existing : {},
|
|
||||||
RootFolders: {}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.NzbDrone.Episode = {
|
window.NzbDrone.Episode = {
|
||||||
Search : {},
|
Search : {},
|
||||||
Summary : {},
|
Summary : {},
|
||||||
|
@ -236,16 +229,12 @@ define(
|
||||||
window.NzbDrone.start();
|
window.NzbDrone.start();
|
||||||
|
|
||||||
|
|
||||||
NzbDrone.Router = new Router();
|
|
||||||
Backbone.history.start({ pushState: true });
|
|
||||||
|
|
||||||
RouteBinder.bind(NzbDrone.Router);
|
|
||||||
//NzbDrone.footerRegion.show(new FooterView());
|
//NzbDrone.footerRegion.show(new FooterView());
|
||||||
|
|
||||||
|
|
||||||
window.require(
|
window.require(
|
||||||
[
|
[
|
||||||
'Routing'
|
'Router'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return NzbDrone;
|
return NzbDrone;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue