moved add series to require.

pull/4/head
kay.one 12 years ago
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,6 +1,10 @@
"use strict";
define(['app'], function () {
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
define(
[
'backbone',
'sugar'
], function (Backbone) {
return Backbone.Model.extend({
mutators: {
freeSpaceString: function () {
return this.get('freeSpace').bytes(2) + " Free";
@ -11,4 +15,4 @@ define(['app'], function () {
freeSpace: 0
}
});
});
});

@ -4,3 +4,5 @@
{{/each}}
<option value="addNew">Add a diffrent path</option>
</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,8 +1,10 @@
"use strict";
define(['app',
define(
[
'app',
'Settings/SettingsLayout',
'Form/FormBuilder',
'AddSeries/AddSeriesLayout',
'Form/FormBuilder',
'Series/Index/SeriesIndexLayout',
'Calendar/CalendarLayout',
'Shared/NotificationView',
@ -16,8 +18,8 @@ define(['app',
'History/HistoryLayout',
'Shared/FormatHelpers',
'Shared/TemplateHelpers',
'Shared/Footer/View'],
function (App, SettingsLayout) {
'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);
},
_isInTab: function (element) {
return;
var self = this;
$(document).on('click', 'a[href]', function (event) {
self._handleClick(event, router);
});
},
_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 {

@ -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,10 +1,11 @@
"use strict";
define([
define(
[
'app',
'Shared/Toolbar/Radio/RadioButtonCollectionView',
'Shared/Toolbar/Button/ButtonCollectionView',
'Shared/Toolbar/ButtonCollection'
], function () {
], function () {
NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
@ -72,8 +73,7 @@ define([
switch (buttonGroup.type) {
case 'radio':
{
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView(
{
buttonGroupView = new NzbDrone.Shared.Toolbar.RadioButtonCollectionView({
collection: groupCollection,
menu : buttonGroup
});
@ -81,8 +81,7 @@ define([
}
default :
{
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView(
{
buttonGroupView = new NzbDrone.Shared.Toolbar.ButtonCollectionView({
collection: groupCollection,
menu : buttonGroup
});
@ -96,7 +95,7 @@ define([
return NzbDrone.Shared.Toolbar.ToolbarLayout;
});
});

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