1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

moved most of addseries to use require.js

This commit is contained in:
Keivan Beigi 2013-02-13 18:28:56 -08:00 committed by kay.one
parent 5e26596623
commit 52d815b1d4
39 changed files with 21945 additions and 10312 deletions

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram />

View File

@ -204,12 +204,14 @@
<Content Include="_backboneApp\AddSeries\Existing\ImportSeriesView.js" />
<Content Include="_backboneApp\AddSeries\Existing\UnmappedFolderModel.js" />
<Content Include="_backboneApp\AddSeries\Existing\RootFolderCompositeViewTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirView.js" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirItemTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirModel.js" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootDirCollection.js" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderView.js" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderItemTemplate.html" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderModel.js" />
<Content Include="_backboneApp\AddSeries\RootFolders\RootFolderCollection.js" />
<Content Include="_backboneApp\Content\jquery.dataTables.bootstrap.css" />
<Content Include="_backboneApp\JsLibraries\jquery.js" />
<Content Include="_backboneApp\Routing.js" />
<Content Include="_backboneApp\JsLibraries\backbone.modelbinder.js" />
<Content Include="_backboneApp\AddSeries\New\AddNewSeriesTemplate.html" />
<Content Include="_backboneApp\AddSeries\New\AddNewSeriesView.js" />
@ -220,6 +222,7 @@
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.extensions.js" />
<Content Include="_backboneApp\JsLibraries\jquery.dataTables-1.10.0-dev.js" />
<Content Include="_backboneApp\JsLibraries\jquery.dataTables.bootstrap.pagination.js" />
<Content Include="_backboneApp\JsLibraries\require-jquery.js" />
<Content Include="_backboneApp\Quality\qualityProfileModel.js" />
<Content Include="_backboneApp\Quality\qualityProfileCollection.js" />
<Content Include="_backboneApp\Quality\qualityTypeModel.js" />
@ -432,11 +435,11 @@
<Content Include="_backboneApp\Shared\SpinnerTemplate.html" />
<Content Include="_backboneApp\Shared\SpinnerView.js" />
<Content Include="Eloquera.config" />
<Content Include="ClassDiagram1.cd" />
<None Include="_backboneApp\JsLibraries\jquery-1.8.2.intellisense.js" />
<Content Include="_backboneApp\JsLibraries\backbone.collectionbinder.js" />
<Content Include="_backboneApp\JsLibraries\backbone.debug.js" />
<Content Include="_backboneApp\JsLibraries\handlebars.js" />
<Content Include="_backboneApp\JsLibraries\jquery.js" />
<Content Include="_backboneApp\JsLibraries\jquery-ui-1.9.0.js" />
<Content Include="_backboneApp\JsLibraries\backbone.marionette.viewswapper.js" />
<Content Include="_backboneApp\JsLibraries\sugar.js" />

View File

@ -4,12 +4,10 @@
@using Cassette.Scripts
@using Cassette.Stylesheets
@using NzbDrone.Web
@using NzbDrone.Web.Backbone.NzbDrone
@using NzbDrone.Web.Helpers
@{
Bundles.Reference<StylesheetBundle>(CassetteBundleConfiguration.BASE_STYLE);
Bundles.Reference<ScriptBundle>(CassetteBundleConfiguration.NZBDRONE);
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -65,9 +63,7 @@
<div id="footer-region" class="span20"></div>
</div>
</div>
@Bundles.RenderScripts()
<script type="text/javascript">
NzbDrone.start();
</script>
<script data-main="/_backboneApp/app" src="/_backboneApp/JsLibraries/require-jquery.js"></script>
<script src="/_backboneApp/Routing.js"></script>
</body>
</html>

View File

@ -1,11 +1,13 @@
/// <reference path="../app.js" />
/// <reference path="New/AddNewSeriesView.js" />
/// <reference path="RootFolders/RootDirView.js" />
/// <reference path="../Quality/qualityProfileCollection.js" />
/// <reference path="../Shared/SpinnerView.js" />
/// <reference path="Existing/ImportSeriesView.js" />
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
define([
'app',
'AddSeries/RootFolders/RootFolderView',
'AddSeries/RootFolders/RootFolderCollection',
'AddSeries/New/AddNewSeriesView',
'AddSeries/Existing/ImportSeriesView',
'Quality/QualityProfileCollection'
],
function () {
NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
template: 'AddSeries/addSeriesLayoutTemplate',
regions: {
@ -20,7 +22,6 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
rootFoldersTab: '.x-root-folders-tab'
},
events: {
'click .x-add-new-tab': 'showAddNew',
'click .x-import-existing-tab': 'showImport',
@ -55,10 +56,9 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
NzbDrone.Router.navigate('series/add/rootfolders');
},
rootFolderCollection: new NzbDrone.AddSeries.RootDirCollection(),
rootFolderCollection: new NzbDrone.AddSeries.RootFolders.RootFolderCollection(),
qualityProfileCollection: new NzbDrone.Quality.QualityProfileCollection(),
initialize: function (context, action, query) {
if (action) {
this.action = action.toLowerCase();
@ -74,7 +74,7 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
this.qualityProfileCollection.fetch();
this.rootFolderCollection.fetch();
this.addNew.show(new NzbDrone.AddSeries.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
this.addNew.show(new NzbDrone.AddSeries.New.AddNewSeriesView({ rootFolders: this.rootFolderCollection, qualityProfiles: this.qualityProfileCollection }));
this.importExisting.show(new NzbDrone.AddSeries.Existing.ImportSeriesView({ collection: this.rootFolderCollection, quality: this.qualityProfileCollection }));
this.rootFolders.show(new NzbDrone.AddSeries.RootDirView({ collection: this.rootFolderCollection }));
@ -106,6 +106,6 @@ NzbDrone.AddSeries.AddSeriesLayout = Backbone.Marionette.Layout.extend({
this.ui.importExistingTab.show();
}
},
});
});
});

View File

@ -1,11 +1,9 @@
'use strict';
/// <reference path="../../app.js" />
/// <reference path="UnmappedFolderModel.js" />
/// <reference path="../../Series/SeriesModel.js" />
/// <reference path="../SearchResultCollection.js" />
define(['app', 'AddSeries/Existing/UnmappedFolderModel', 'AddSeries/SearchResultCollection', 'Series/SeriesModel'], function () {
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView.extend({
template: 'AddSeries/Existing/FolderMatchResultViewTemplatate',
events: {
@ -42,9 +40,9 @@ NzbDrone.AddSeries.Existing.FolderMatchResultView = Backbone.Marionette.ItemView
});
}
});
});
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.CompositeView.extend({
template: 'AddSeries/Existing/UnmappedFolderCompositeViewTemplatate',
itemViewContainer: '.x-folder-name-match-results',
@ -93,9 +91,9 @@ NzbDrone.AddSeries.Existing.UnmappedFolderCompositeView = Backbone.Marionette.Co
});
});
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.CompositeView.extend({
template: "AddSeries/Existing/RootFolderCompositeViewTemplate",
itemViewContainer: ".x-existing-folder-container",
@ -123,9 +121,9 @@ NzbDrone.AddSeries.Existing.RootFolderCompositeView = Backbone.Marionette.Compos
});
});
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.Existing.RootFolderCompositeView,
@ -147,8 +145,5 @@ NzbDrone.AddSeries.Existing.ImportSeriesView = Backbone.Marionette.CollectionVie
}
});
});

View File

@ -1,11 +1,14 @@
'use strict';
/// <reference path="../../app.js" />
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
define(['app'], function () {
});
NzbDrone.AddSeries.Existing.UnmappedFolderModel = Backbone.Model.extend({
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({
});
NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.extend({
model: NzbDrone.AddSeries.Existing.UnmappedFolderModel,
@ -25,10 +28,8 @@ NzbDrone.AddSeries.Existing.UnmappedFolderCollection = Backbone.Collection.exten
var rootFolder = rootFolderModel.get('path');
_.each(rootFolderModel.get('unmappedFolders'), function (folder) {
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({rootFolder:rootFolder, folder: folder, quality: qualityCollection }));
this.push(new NzbDrone.AddSeries.Existing.UnmappedFolderModel({ rootFolder: rootFolder, folder: folder, quality: qualityCollection }));
}, this);
}
});
});

View File

@ -1,8 +1,6 @@
'use strict;'
/// <reference path="../../app.js" />
/// <reference path="SearchResultView.js" />
define(['app', 'AddSeries/New/SearchResultView'], function () {
NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
NzbDrone.AddSeries.New.AddNewSeriesView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/New/AddNewSeriesTemplate',
route: 'Series/add/new',
@ -65,7 +63,7 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
}
},
abortExistingRequest : function () {
abortExistingRequest: function () {
if (this.currentSearchRequest && this.currentSearchRequest.readyState > 0 && this.currentSearchRequest.readyState < 4) {
console.log('aborting previous pending search request.');
this.currentSearchRequest.abort();
@ -81,4 +79,5 @@ NzbDrone.AddSeries.AddNewSeriesView = Backbone.Marionette.Layout.extend({
context.searchResult.show(context.resultView);
}
});
});

View File

@ -1,11 +1,8 @@
'use strict';
/*global NzbDrone, Backbone*/
/// <reference path="../../app.js" />
/// <reference path="../SearchResultModel.js" />
/// <reference path="../../Series/SeriesModel.js" />
/// <reference path="../SearchResultCollection.js" />
NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
define(['app', 'AddSeries/SearchResultCollection', 'AddSeries/SearchResultModel', 'Series/SeriesModel'], function () {
NzbDrone.AddSeries.New.SearchItemView = Backbone.Marionette.ItemView.extend({
template: "AddSeries/New/SearchResultTemplate",
className: 'search-item',
@ -57,9 +54,9 @@ NzbDrone.AddSeries.SearchItemView = Backbone.Marionette.ItemView.extend({
}
});
}
});
});
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.SearchItemView,
@ -68,4 +65,5 @@ NzbDrone.AddSeries.SearchResultView = Backbone.Marionette.CollectionView.extend(
initialize: function () {
this.listenTo(this.collection, 'reset', this.render);
}
});
});

View File

@ -1,8 +0,0 @@
/// <reference path="../../app.js" />
/// <reference path="RootDirModel.js" />
NzbDrone.AddSeries.RootDirCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/rootdir',
model: NzbDrone.AddSeries.RootDirModel,
});

View File

@ -1,13 +0,0 @@
/// <reference path="../../app.js" />
NzbDrone.AddSeries.RootDirModel = Backbone.Model.extend({
mutators: {
freeSpaceString: function () {
return this.get('freeSpace').bytes(2) + " Free";
}
},
defaults: {
freeSpace: 0,
}
});

View File

@ -1,90 +0,0 @@
'use strict;'
/// <reference path="../../app.js" />
/// <reference path="RootDirModel.js" />
/// <reference path="RootDirCollection.js" />
/// <reference path="../../Shared/AutoComplete.js" />
NzbDrone.AddSeries.RootDirItemView = Backbone.Marionette.ItemView.extend({
template: 'AddSeries/RootFolders/RootDirItemTemplate',
tagName: 'tr',
events: {
'click .x-remove': 'removeFolder',
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
removeFolder: function () {
this.model.destroy({ wait: true });
this.model.collection.remove(this.model);
},
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.RootDirItemView,
tagName: 'table',
className: 'table table-hover',
});
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/RootFolders/RootDirTemplate',
route: 'series/add/rootdir',
ui: {
pathInput: '.x-path input'
},
regions: {
currentDirs: '#current-dirs',
},
events: {
'click .x-add': 'addFolder',
},
collection: new NzbDrone.AddSeries.RootDirCollection(),
onRender: function () {
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
this.collection.fetch();
this.ui.pathInput.folderAutoComplete();
},
addFolder: function () {
var newDir = new NzbDrone.AddSeries.RootDirModel(
{
Path: this.ui.pathInput.val()
});
var self = this;
this.collection.create(newDir, {
wait: true, success: function () {
self.collection.fetch();
}
});
},
search: function (context) {
var term = context.ui.seriesSearch.val();
if (term === "") {
context.collection.reset();
} else {
console.log(term);
context.collection.fetch({ data: $.param({ term: term }) });
}
},
});

View File

@ -0,0 +1,10 @@
define(['app', 'AddSeries/RootFolders/RootFolderModel'], function () {
NzbDrone.AddSeries.RootFolders.RootFolderCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/rootdir',
model: NzbDrone.AddSeries.RootFolders.RootFolderModel,
});
});

View File

@ -0,0 +1,13 @@
define(['app'], function () {
NzbDrone.AddSeries.RootFolders.RootFolderModel = Backbone.Model.extend({
mutators: {
freeSpaceString: function () {
return this.get('freeSpace').bytes(2) + " Free";
}
},
defaults: {
freeSpace: 0,
}
});
});

View File

@ -0,0 +1,91 @@
'use strict;'
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Shared/AutoComplete'], function () {
NzbDrone.AddSeries.RootFolderItemView = Backbone.Marionette.ItemView.extend({
template: 'AddSeries/RootFolders/RootFolderItemTemplate',
tagName: 'tr',
events: {
'click .x-remove': 'removeFolder',
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
removeFolder: function () {
this.model.destroy({ wait: true });
this.model.collection.remove(this.model);
},
});
NzbDrone.AddSeries.RootDirListView = Backbone.Marionette.CollectionView.extend({
itemView: NzbDrone.AddSeries.RootFolderItemView,
tagName: 'table',
className: 'table table-hover',
});
NzbDrone.AddSeries.RootDirView = Backbone.Marionette.Layout.extend({
template: 'AddSeries/RootFolders/RootFolderTemplate',
route: 'series/add/rootdir',
ui: {
pathInput: '.x-path input'
},
regions: {
currentDirs: '#current-dirs',
},
events: {
'click .x-add': 'addFolder',
},
collection: new NzbDrone.AddSeries.RootFolders.RootFolderCollection(),
onRender: function () {
this.currentDirs.show(new NzbDrone.AddSeries.RootDirListView({ collection: this.collection }));
this.collection.fetch();
this.ui.pathInput.folderAutoComplete();
},
addFolder: function () {
var newDir = new NzbDrone.AddSeries.RootFolders.RootFolderModel(
{
Path: this.ui.pathInput.val()
});
var self = this;
this.collection.create(newDir, {
wait: true, success: function () {
self.collection.fetch();
}
});
},
search: function (context) {
var term = context.ui.seriesSearch.val();
if (term === "") {
context.collection.reset();
} else {
console.log(term);
context.collection.fetch({ data: $.param({ term: term }) });
}
},
});
});

View File

@ -1,10 +1,10 @@
/// <reference path="../app.js" />
/// <reference path="SearchResultModel.js" />
"use strict";
NzbDrone.AddSeries.SearchResultCollection = Backbone.Collection.extend({
"use strict";
define(['app', 'AddSeries/SearchResultModel'], function () {
NzbDrone.AddSeries.SearchResultCollection = Backbone.Collection.extend({
url: NzbDrone.Constants.ApiRoot + '/series/lookup',
model: NzbDrone.AddSeries.SearchResultModel
});
});

View File

@ -1,7 +1,7 @@
/// <reference path="../app.js" />
/// <reference path="RootFolders/RootDirCollection.js" />
/// <reference path="../Quality/qualityProfileCollection.js" />
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
define(['app', 'AddSeries/RootFolders/RootFolderCollection', 'Quality/QualityProfileCollection'], function () {
NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
mutators: {
seriesYear: function () {
var date = Date.utc.create(this.get('firstAired')).format('({yyyy})');
@ -17,7 +17,9 @@ NzbDrone.AddSeries.SearchResultModel = Backbone.Model.extend({
defaults: {
qualityProfiles: new NzbDrone.Quality.QualityProfileCollection(),
rootFolders: new NzbDrone.AddSeries.RootDirCollection()
rootFolders: new NzbDrone.AddSeries.RootFolders.RootFolderModel()
}
});
});

View File

@ -8,7 +8,7 @@ namespace NzbDrone.Web.Backbone.NzbDrone
public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
{
public const string BASE_STYLE = "BASE_STYLE";
public const string NZBDRONE = "NZBDRONE";
//public const string NZBDRONE = "NZBDRONE";
internal const string FONTS = "FONTS";
private const string APP_PATH = "_backboneApp";
@ -17,7 +17,7 @@ public void Configure(BundleCollection bundles)
{
bundles.AddUrlWithAlias<StylesheetBundle>("//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300'", FONTS);
bundles.AddPerIndividualFile<ScriptBundle>(APP_PATH);
//bundles.AddPerIndividualFile<ScriptBundle>(APP_PATH);
bundles.Add<StylesheetBundle>(BASE_STYLE, new[]{
APP_PATH + "\\Content\\Bootstrap\\bootstrap.less",
@ -28,15 +28,17 @@ public void Configure(BundleCollection bundles)
},
bundle => bundle.AddReference("/" + FONTS));
bundles.Add<ScriptBundle>("~/_backboneApp/JsLibraries/backbone.js");
/* bundles.Add<ScriptBundle>("~/_backboneApp/JsLibraries/backbone.js");
bundles.Add<ScriptBundle>(NZBDRONE, new[]{
APP_PATH + "\\app.js",
APP_PATH + "\\routing.js",
APP_PATH + "\\Series\\Index\\IndexLayout.js",
APP_PATH + "\\AddSeries\\AddSeriesLayout.js",
APP_PATH + "\\Shared\\NotificationView.js",
});
});*/
/* bundles.Add<ScriptBundle>(NZBDRONE, new[]{

View File

@ -1,6 +1,6 @@
/// <reference path="handlebars.js" />
_.extend(Marionette.TemplateCache.prototype, {

define(['underscore', 'marionette', 'handlebars', 'jquery'], function (_, Marionette, Handlebars, $) {
_.extend(Marionette.TemplateCache.prototype, {
loadTemplate: function (templateId) {
@ -11,7 +11,7 @@ _.extend(Marionette.TemplateCache.prototype, {
$.ajax({
url: '_backboneApp//' + templateId + '.html',
cache:false,
cache: false,
async: false
}).done(function (data) {
@ -24,11 +24,13 @@ _.extend(Marionette.TemplateCache.prototype, {
return template;
}
});
});
_.extend(Marionette.TemplateCache.prototype, {
_.extend(Marionette.TemplateCache.prototype, {
compileTemplate: function (rawTemplate) {
return Handlebars.compile(rawTemplate);
}
});
});

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
/// <reference path="../app.js" />
/// <reference path="qualityProfileModel.js" />
define(['app', 'Quality/QualityProfileModel'], function () {
NzbDrone.Quality.QualityProfileCollection = Backbone.Collection.extend({
NzbDrone.Quality.QualityProfileCollection = Backbone.Collection.extend({
model: NzbDrone.Quality.QualityProfileModel,
url: NzbDrone.Constants.ApiRoot + '/qualityprofiles'
});
});

View File

@ -1,6 +1,5 @@
/// <reference path="../app.js" />
NzbDrone.Quality.QualityProfileModel = Backbone.Model.extend({
define(['app'], function () {
NzbDrone.Quality.QualityProfileModel = Backbone.Model.extend({
initialize: function () {
this.validators = {};
@ -44,4 +43,6 @@ NzbDrone.Quality.QualityProfileModel = Backbone.Model.extend({
//allowed: {},
Cutoff: null
}
});
});

View File

@ -0,0 +1,38 @@
require(['app', 'AddSeries/AddSeriesLayout'], function () {
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function (action, query) {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout(this, action, query));
},
series: function (action, query) {
NzbDrone.mainRegion.show(new NzbDrone.Series.IndexLayout(this, action, query));
},
notFound: function () {
alert('route not found');
}
});
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({
controller: new NzbDrone.Controller(),
appRoutes: {
'series': 'series',
'series/index': 'series',
'series/add': 'addSeries',
'series/add/:action(/:query)': 'addSeries',
':whatever': 'notFound'
}
});
NzbDrone.addInitializer(function () {
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();
});
});

View File

@ -1,6 +1,6 @@
'use strict';
/*global NzbDrone, Backbone*/
/// <reference path="../app.js" />
/// <reference path="SeriesModel.js" />
NzbDrone.Series.DeleteSeriesView = Backbone.Marionette.ItemView.extend({

View File

@ -1,6 +1,6 @@
'use strict';
/*global NzbDrone, Backbone*/
/// <reference path="../app.js" />
/// <reference path="SeriesModel.js" />
/// <reference path="DeleteSeriesView.js" />
/// <reference path="../Quality/qualityProfileCollection.js" />

View File

@ -1,5 +1,5 @@
'use strict;'
/// <reference path="../../app.js" />
/// <reference path="../SeriesCollection.js" />
/// <reference path="SeriesItemView.js" />
/// <reference path="../../JsLibraries/jquery.dataTables.bootstrap.pagination.js" />

View File

@ -1,6 +1,6 @@
'use strict';
/*global NzbDrone, Backbone*/
/// <reference path="../../app.js" />
/// <reference path="../SeriesModel.js" />
/// <reference path="../SeriesCollection.js" />
/// <reference path="../EditSeriesView.js" />

View File

@ -1,4 +1,4 @@
/// <reference path="../app.js" />

/// <reference path="SeriesModel.js" />
NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({

View File

@ -1,4 +1,7 @@
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
define(['app'], function () {
NzbDrone.Series.SeriesModel = Backbone.Model.extend({
url: NzbDrone.Constants.ApiRoot + '/series',
mutators: {
@ -18,16 +21,6 @@
return date.format('{MM}/{dd}/{yyyy}');
},
formatedDateString: function () {
var dateSource = this.get('nextAiring');
if (!dateSource) return '';
var date = Date.create(dateSource);
return date.format('{Weekday} {Month} {dd}, {yyyy} {12hr}:{mm} {TT}');
},
percentOfEpisodes: function () {
var episodeCount = this.get('episodeCount');
var episodeFileCount = this.get('episodeFileCount');
@ -45,4 +38,6 @@
episodeFileCount: 0,
episodeCount: 0
}
});
});

View File

@ -1,4 +1,6 @@
$.fn.folderAutoComplete = function () {
define(['bootstrap'], function () {
$.fn.folderAutoComplete = function () {
$(this).typeahead({
source: function (query, process) {
$.ajax({
@ -13,4 +15,6 @@
},
minLength: 3
});
}
};
});

View File

@ -1,4 +1,5 @@
ModalRegion = Backbone.Marionette.Region.extend({
define('modalRegion', ['Marionette'], function (Marionette) {
return Marionette.Region.extend({
el: "#modal-region",
constructor: function () {
@ -21,4 +22,7 @@
hideModal: function () {
this.$el.modal('hide');
}
});
});

View File

@ -1,4 +1,5 @@
/// <reference path="../app.js" />

NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
mutators: {

View File

@ -1,4 +1,4 @@
/// <reference path="../app.js" />

/// <reference path="NotificationModel.js" />
NzbDrone.Shared.NotificationItemView = Backbone.Marionette.ItemView.extend({

View File

@ -1,6 +1,4 @@
/// <reference path="../app.js" />
NzbDrone.Shared.SpinnerView = Backbone.Marionette.ItemView.extend({
NzbDrone.Shared.SpinnerView = Backbone.Marionette.ItemView.extend({
template: 'Shared/SpinnerTemplate',
className: 'nz-spinner row',

View File

@ -1,97 +1,85 @@
/// <reference path="JsLibraries/jquery.js" />
/// <reference path="JsLibraries/underscore.js" />
/// <reference path="JsLibraries/sugar.js" />
/// <reference path="JsLibraries/backbone.js" />
/// <reference path="JsLibraries/handlebars.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/backbone.mutators.js" />
/// <reference path="JsLibraries/backbone.shortcuts.js" />
/// <reference path="JsLibraries/backbone.marionette.js" />
/// <reference path="JsLibraries/backbone.marionette.extend.js" />
/// <reference path="JsLibraries/backbone.marionette.viewswapper.js" />
/// <reference path="JsLibraries/backbone.modelbinder.js" />
/// <reference path="JsLibraries/bootstrap.js" />
/// <reference path="Shared/ModalRegion.js" />
require.config({
if (typeof console === undefined) {
window.console = { log: function () { } };
}
paths: {
'backbone': 'JsLibraries/backbone',
'underscore': 'JsLibraries/underscore',
'marionette': 'JsLibraries/backbone.marionette',
'handlebars': 'JsLibraries/handlebars',
'bootstrap': 'JsLibraries/bootstrap',
},
NzbDrone = new Backbone.Marionette.Application();
NzbDrone.Series = {};
NzbDrone.Series.Index = {};
NzbDrone.AddSeries = {};
NzbDrone.AddSeries.New = {};
NzbDrone.AddSeries.Existing = {};
NzbDrone.AddSeries.RootFolders = {};
NzbDrone.Quality = {};
NzbDrone.Shared = {};
shim: {
bootstrap: {
deps: ["jquery"],
},
underscore: {
exports: '_'
},
backbone: {
deps: ["underscore", "jquery"],
exports: "Backbone"
},
marionette: {
deps: ["backbone"],
exports: "Marionette"
},
handlebars: {
exports: "Handlebars"
}
}
});
/*
_.templateSettings = {
interpolate: /\{\{([\s\S]+?)\}\}/g
};
*/
define('app', ['jquery', 'JsLibraries/backbone.modelbinder', 'marionette', 'handlebars', 'JsLibraries/backbone.marionette.extend'],
function (jquery, modelBinder, marionette, handlebars) {
NzbDrone.ModelBinder = new Backbone.ModelBinder();
NzbDrone.Constants = {
window.$ = jquery;
window.jquery = jquery;
window.Backbone.ModelBinder = modelBinder;
window.Backbone.Marionette = marionette;
window.Handlebars = handlebars;
window.NzbDrone = new Backbone.Marionette.Application();
window.NzbDrone.Series = {};
window.NzbDrone.Series.Index = {};
window.NzbDrone.AddSeries = {};
window.NzbDrone.AddSeries.New = {};
window.NzbDrone.AddSeries.Existing = {};
window.NzbDrone.AddSeries.RootFolders = {};
window.NzbDrone.Quality = {};
window.NzbDrone.Shared = {};
window.NzbDrone.Constants = {
ApiRoot: '/api'
};
};
NzbDrone.Events = {
DisplayInMainRegion: 'DisplayInMainRegion'
};
NzbDrone.Controller = Backbone.Marionette.Controller.extend({
addSeries: function (action, query) {
NzbDrone.mainRegion.show(new NzbDrone.AddSeries.AddSeriesLayout(this, action, query));
},
series: function (action, query) {
NzbDrone.mainRegion.show(new NzbDrone.Series.IndexLayout(this, action, query));
},
notFound: function () {
alert('route not found');
}
});
NzbDrone.Router = Backbone.Marionette.AppRouter.extend({
controller: new NzbDrone.Controller(),
// "someMethod" must exist at controller.someMethod
appRoutes: {
'series': 'series',
'series/index': 'series',
'series/add': 'addSeries',
'series/add/:action(/:query)': 'addSeries',
':whatever': 'notFound'
}
});
NzbDrone.addInitializer(function (options) {
window.NzbDrone.addInitializer(function (options) {
console.log('starting application');
NzbDrone.registerHelpers();
NzbDrone.ModelBinder = new Backbone.ModelBinder();
NzbDrone.addRegions({
mainRegion: '#main-region',
notificationRegion: '#notification-region',
modalRegion: ModalRegion
});
NzbDrone.Router = new NzbDrone.Router();
Backbone.history.start();
});
NzbDrone.registerHelpers = function() {
//TODO: move this out of here
Handlebars.registerHelper("formatStatus", function (status, monitored) {
if (!monitored) return '<i class="icon-pause grid-icon" title="Not Monitored"></i>';
if (status === 'Continuing') return '<i class="icon-play grid-icon" title="Continuing"></i>';
return '<i class="icon-stop grid-icon" title="Ended"></i>';
});
}
NzbDrone.addRegions({
mainRegion: '#main-region',
notificationRegion: '#notification-region',
modalRegion: '#modal-region'
});
});
window.NzbDrone.start();
});

View File

@ -2,6 +2,7 @@
<FileVersion>1</FileVersion>
<AutoEnableOnStartup>False</AutoEnableOnStartup>
<AllowParallelTestExecution>true</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>Disabled</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>Disabled</FrameworkUtilisationTypeForMSpec>

View File

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/JavaScriptNaming/UserRules/=JS_005FPARAMETER/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"&gt;&lt;ExtraRule Prefix="" Suffix="" Style="AaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/Environment/Editor/MatchingBraceHighlighting/Position/@EntryValue">BOTH_SIDES</s:String>
<s:String x:Key="/Default/Environment/Editor/MatchingBraceHighlighting/Style/@EntryValue">OUTLINE</s:String>
<s:Boolean x:Key="/Default/Environment/InjectedLayers/FileInjectedLayer/=5C7F3FB135E52A44B9447C48B2EEEE92/@KeyIndexDefined">True</s:Boolean>