mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
moved add series to require.
This commit is contained in:
parent
24c77b4047
commit
72772bed5a
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
define(
|
||||
[
|
||||
'App',
|
||||
'app',
|
||||
'backbone',
|
||||
'Series/SeriesModel'
|
||||
], function (App, Backbone, SeriesModel) {
|
||||
|
@ -1,15 +1,17 @@
|
||||
"use strict";
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'backbone',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'mixins/backbone.signalr.mixin'
|
||||
], function () {
|
||||
], function (Backbone, RootFolderModel) {
|
||||
|
||||
var rootFolderCollection = Backbone.Collection.extend({
|
||||
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',
|
||||
'AddSeries/RootFolders/CollectionView',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'AddSeries/RootFolders/Model',
|
||||
'Mixins/AutoComplete'
|
||||
], function (Marionette, RootFolderCollectionView, RootFolderCollection, RootFolderModel) {
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
"use strict";
|
||||
define(['app'], function () {
|
||||
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
|
||||
mutators: {
|
||||
freeSpaceString: function () {
|
||||
return this.get('freeSpace').bytes(2) + " Free";
|
||||
}
|
||||
},
|
||||
define(
|
||||
[
|
||||
'backbone',
|
||||
'sugar'
|
||||
], function (Backbone) {
|
||||
return Backbone.Model.extend({
|
||||
mutators: {
|
||||
freeSpaceString: function () {
|
||||
return this.get('freeSpace').bytes(2) + " Free";
|
||||
}
|
||||
},
|
||||
|
||||
defaults: {
|
||||
freeSpace: 0
|
||||
}
|
||||
defaults: {
|
||||
freeSpace: 0
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -3,4 +3,6 @@
|
||||
<option value="{{id}}">{{path}}</option>
|
||||
{{/each}}
|
||||
<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="span2">
|
||||
<a href="{{traktUrl}}" target="_blank">
|
||||
<img class="add-series-poster" src="{{remotePoster}}" {{defaultImg}}>
|
||||
<img class="add-series-poster" src="{{remotePoster}}"
|
||||
{{defaultImg}}>
|
||||
</a>
|
||||
</div>
|
||||
<div class="span9">
|
||||
@ -19,12 +20,13 @@
|
||||
<icon class="icon-plus"></icon>
|
||||
</div>
|
||||
{{#unless isExisting}}
|
||||
{{rootFolderSelection}}
|
||||
{{> RootFolderSelectionPartial rootFolders}}
|
||||
{{/unless}}
|
||||
<div class='pull-right'>
|
||||
{{qualityProfileSelection}}
|
||||
{{> QualityProfileSelectionPartial qualityProfiles}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{debug}}
|
||||
|
@ -3,11 +3,12 @@ define(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Config',
|
||||
'Quality/QualityProfileCollection',
|
||||
'AddSeries/RootFolders/Collection',
|
||||
'Series/SeriesCollection',
|
||||
'Shared/Messenger',
|
||||
'Quality/QualityProfileCollection'
|
||||
], function (App, Marionette, Config, SeriesCollection, Messenger, QualityProfiles) {
|
||||
'Config',
|
||||
'Shared/Messenger'
|
||||
], function (App, Marionette, QualityProfiles, RootFolders, SeriesCollection, Config, Messenger) {
|
||||
|
||||
return Marionette.ItemView.extend({
|
||||
|
||||
@ -88,8 +89,15 @@ define(
|
||||
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";
|
||||
define(['app',
|
||||
'Settings/SettingsLayout',
|
||||
'Form/FormBuilder',
|
||||
'AddSeries/AddSeriesLayout',
|
||||
'Series/Index/SeriesIndexLayout',
|
||||
'Calendar/CalendarLayout',
|
||||
'Shared/NotificationView',
|
||||
'Shared/NotFoundView',
|
||||
'MainMenuView',
|
||||
'Series/Details/SeriesDetailsLayout',
|
||||
'Series/EpisodeCollection',
|
||||
'Logs/Layout',
|
||||
'Release/Layout',
|
||||
'Missing/MissingLayout',
|
||||
'History/HistoryLayout',
|
||||
'Shared/FormatHelpers',
|
||||
'Shared/TemplateHelpers',
|
||||
'Shared/Footer/View'],
|
||||
function (App, SettingsLayout) {
|
||||
define(
|
||||
[
|
||||
'app',
|
||||
'Settings/SettingsLayout',
|
||||
'AddSeries/AddSeriesLayout',
|
||||
'Form/FormBuilder',
|
||||
'Series/Index/SeriesIndexLayout',
|
||||
'Calendar/CalendarLayout',
|
||||
'Shared/NotificationView',
|
||||
'Shared/NotFoundView',
|
||||
'MainMenuView',
|
||||
'Series/Details/SeriesDetailsLayout',
|
||||
'Series/EpisodeCollection',
|
||||
'Logs/Layout',
|
||||
'Release/Layout',
|
||||
'Missing/MissingLayout',
|
||||
'History/HistoryLayout',
|
||||
'Shared/FormatHelpers',
|
||||
'Shared/TemplateHelpers',
|
||||
'Shared/Footer/View'
|
||||
], function (App, SettingsLayout, AddSeriesLayout) {
|
||||
var controller = Backbone.Marionette.Controller.extend({
|
||||
|
||||
series : function () {
|
||||
@ -39,7 +41,7 @@ define(['app',
|
||||
|
||||
addSeries: function (action) {
|
||||
this._setTitle('Add Series');
|
||||
App.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout({action: action}));
|
||||
App.mainRegion.show(new AddSeriesLayout({action: action}));
|
||||
},
|
||||
|
||||
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";
|
||||
define(function () {
|
||||
|
||||
//This module will automatically route all links through backbone router rather than
|
||||
//causing links to reload pages.
|
||||
|
||||
var routeBinder = {
|
||||
|
||||
bind: function (router) {
|
||||
|
||||
this._router = router;
|
||||
|
||||
$(document).on('click', 'a[href]', this._handleClick);
|
||||
var self = this;
|
||||
$(document).on('click', 'a[href]', function (event) {
|
||||
self._handleClick(event, router);
|
||||
});
|
||||
},
|
||||
|
||||
_isInTab: function (element) {
|
||||
return;
|
||||
},
|
||||
|
||||
_handleClick: function (event) {
|
||||
_handleClick: function (event, router) {
|
||||
var $target = $(event.target);
|
||||
|
||||
//check if tab nav
|
||||
@ -47,7 +42,7 @@ define(function () {
|
||||
|
||||
|
||||
if (!href.startsWith('http')) {
|
||||
this._router.navigate(href, { trigger: true });
|
||||
router.navigate(href, { trigger: true });
|
||||
}
|
||||
|
||||
else {
|
||||
|
21
UI/Router.js
21
UI/Router.js
@ -1,11 +1,13 @@
|
||||
"use strict";
|
||||
require(
|
||||
[
|
||||
'app',
|
||||
'marionette',
|
||||
'Controller'
|
||||
], function (Marionette, Controller) {
|
||||
'Controller',
|
||||
'RouteBinder'
|
||||
], function (App, Marionette, Controller, RouterBinder) {
|
||||
|
||||
return Marionette.AppRouter.extend({
|
||||
NzbDrone.Router = Marionette.AppRouter.extend({
|
||||
|
||||
controller: Controller,
|
||||
appRoutes : {
|
||||
@ -25,5 +27,18 @@ require(
|
||||
':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',
|
||||
'Series/SeriesCollection',
|
||||
'Series/Edit/EditSeriesView',
|
||||
'Series/Delete/DeleteSeriesView'
|
||||
'Series/Delete/DeleteSeriesView',
|
||||
'Shared/FormatHelpers'
|
||||
|
||||
], function () {
|
||||
NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
|
||||
|
@ -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;
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
15
UI/app.js
15
UI/app.js
@ -148,10 +148,9 @@ define(
|
||||
[
|
||||
'marionette',
|
||||
'shared/modal/region',
|
||||
'router',
|
||||
'Instrumentation/StringFormat',
|
||||
'Instrumentation/ErrorHandler'
|
||||
], function (Marionette, ModalRegion, Router, RouteBinder) {
|
||||
], function (Marionette, ModalRegion) {
|
||||
|
||||
require(
|
||||
[
|
||||
@ -175,12 +174,6 @@ define(
|
||||
Details: {}
|
||||
};
|
||||
|
||||
window.NzbDrone.AddSeries = {
|
||||
New : {},
|
||||
Existing : {},
|
||||
RootFolders: {}
|
||||
};
|
||||
|
||||
window.NzbDrone.Episode = {
|
||||
Search : {},
|
||||
Summary : {},
|
||||
@ -236,16 +229,12 @@ define(
|
||||
window.NzbDrone.start();
|
||||
|
||||
|
||||
NzbDrone.Router = new Router();
|
||||
Backbone.history.start({ pushState: true });
|
||||
|
||||
RouteBinder.bind(NzbDrone.Router);
|
||||
//NzbDrone.footerRegion.show(new FooterView());
|
||||
|
||||
|
||||
window.require(
|
||||
[
|
||||
'Routing'
|
||||
'Router'
|
||||
]);
|
||||
|
||||
return NzbDrone;
|
||||
|
Loading…
Reference in New Issue
Block a user