moved add series to require.

pull/24/head
kay.one 12 years ago
parent 24c77b4047
commit 72772bed5a

@ -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,6 +1,10 @@
"use strict"; "use strict";
define(['app'], function () { define(
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({ [
'backbone',
'sugar'
], function (Backbone) {
return Backbone.Model.extend({
mutators: { mutators: {
freeSpaceString: function () { freeSpaceString: function () {
return this.get('freeSpace').bytes(2) + " Free"; return this.get('freeSpace').bytes(2) + " Free";

@ -4,3 +4,5 @@
{{/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,8 +1,10 @@
"use strict"; "use strict";
define(['app', define(
[
'app',
'Settings/SettingsLayout', 'Settings/SettingsLayout',
'Form/FormBuilder',
'AddSeries/AddSeriesLayout', 'AddSeries/AddSeriesLayout',
'Form/FormBuilder',
'Series/Index/SeriesIndexLayout', 'Series/Index/SeriesIndexLayout',
'Calendar/CalendarLayout', 'Calendar/CalendarLayout',
'Shared/NotificationView', 'Shared/NotificationView',
@ -16,8 +18,8 @@ define(['app',
'History/HistoryLayout', 'History/HistoryLayout',
'Shared/FormatHelpers', 'Shared/FormatHelpers',
'Shared/TemplateHelpers', 'Shared/TemplateHelpers',
'Shared/Footer/View'], 'Shared/Footer/View'
function (App, SettingsLayout) { ], 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) {
return;
}, },
_handleClick: function (event) { _handleClick: function (event, router) {
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 {

@ -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,5 +1,6 @@
"use strict"; "use strict";
define([ define(
[
'app', 'app',
'Shared/Toolbar/Radio/RadioButtonCollectionView', 'Shared/Toolbar/Radio/RadioButtonCollectionView',
'Shared/Toolbar/Button/ButtonCollectionView', 'Shared/Toolbar/Button/ButtonCollectionView',
@ -72,8 +73,7 @@ define([
switch (buttonGroup.type) { switch (buttonGroup.type) {
case 'radio': case 'radio':
{ {
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView( buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView({
{
collection: groupCollection, collection: groupCollection,
menu : buttonGroup menu : buttonGroup
}); });
@ -81,8 +81,7 @@ define([
} }
default : default :
{ {
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView( buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView({
{
collection: groupCollection, collection: groupCollection,
menu : buttonGroup menu : buttonGroup
}); });

@ -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…
Cancel
Save