diff --git a/Gruntfile.js b/Gruntfile.js
index bcfba4f64..b913688e4 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,8 +10,6 @@ module.exports = function (grunt) {
'UI/JsLibraries/backbone.modelbinder.js' : 'http://raw.github.com/theironcook/Backbone.ModelBinder/master/Backbone.ModelBinder.js',
'UI/JsLibraries/backbone.mutators.js' : 'http://raw.github.com/asciidisco/Backbone.Mutators/master/backbone.mutators.js',
'UI/JsLibraries/backbone.shortcuts.js' : 'http://raw.github.com/bry4n/backbone-shortcuts/master/backbone.shortcuts.js',
- 'UI/JsLibraries/backbone.relational.js' : 'http://raw.github.com/PaulUithol/Backbone-relational/0.8.5/backbone-relational.js',
- 'UI/JsLibraries/backbone.associations.js' : 'http://raw.github.com/dhruvaray/backbone-associations/master/backbone-associations.js',
'UI/JsLibraries/backbone.pageable.js' : 'http://raw.github.com/wyuenho/backbone-pageable/master/lib/backbone-pageable.js',
'UI/JsLibraries/backbone.backgrid.js' : 'http://raw.github.com/wyuenho/backgrid/master/lib/backgrid.js',
@@ -28,6 +26,7 @@ module.exports = function (grunt) {
'UI/JsLibraries/require.js' : 'http://raw.github.com/jrburke/requirejs/master/require.js',
'UI/JsLibraries/sugar.js' : 'http://raw.github.com/andrewplummer/Sugar/master/release/sugar-full.development.js',
'UI/JsLibraries/underscore.js' : 'http://underscorejs.org/underscore.js',
+ 'UI/JsLibraries/lodash.underscore.js' : 'http://raw.github.com/bestiejs/lodash/master/dist/lodash.underscore.js',
'UI/JsLibraries/lunr.js' : 'http://raw.github.com/olivernn/lunr.js/master/lunr.js',
'UI/JsLibraries/messenger.js' : 'http://raw.github.com/HubSpot/messenger/master/build/js/messenger.js',
@@ -36,6 +35,7 @@ module.exports = function (grunt) {
'UI/Content/bootstrap.toggle-switch.css' : 'http://raw.github.com/ghinda/css-toggle-switch/gh-pages/toggle-switch.css',
+ /*
'UI/Content/FontAwesome/fontawesome.otf' : 'http://github.com/FortAwesome/Font-Awesome/blob/master/build/assets/font-awesome/font/FontAwesome.otf?raw=true',
'UI/Content/FontAwesome/fontawesome-webfont.eot' : 'http://github.com/FortAwesome/Font-Awesome/blob/master/build/assets/font-awesome/font/fontawesome-webfont.eot?raw=true',
'UI/Content/FontAwesome/fontawesome-webfont.svg' : 'http://github.com/FortAwesome/Font-Awesome/blob/master/build/assets/font-awesome/font/fontawesome-webfont.svg?raw=true',
@@ -51,6 +51,7 @@ module.exports = function (grunt) {
'UI/Content/FontAwesome/mixins.less' : 'http://raw.github.com/FortAwesome/Font-Awesome/master/build/assets/font-awesome/less/mixins.less',
'UI/Content/FontAwesome/path.less' : 'http://raw.github.com/FortAwesome/Font-Awesome/master/build/assets/font-awesome/less/path.less',
'UI/Content/FontAwesome/variables.less' : 'http://raw.github.com/FortAwesome/Font-Awesome/master/build/assets/font-awesome/less/variables.less'
+ */
},
clean: {
@@ -125,6 +126,9 @@ module.exports = function (grunt) {
},
watch: {
+ options: {
+ nospawn: false,
+ },
bootstrap : {
files: ['UI/**/Bootstrap/**', 'UI/**/FontAwesome/**'],
tasks: ['less:bootstrap']
diff --git a/UI/.idea/NzbDrone.UI.iml b/UI/.idea/NzbDrone.UI.iml
index 7c7853f2f..9ffbb36a1 100644
--- a/UI/.idea/NzbDrone.UI.iml
+++ b/UI/.idea/NzbDrone.UI.iml
@@ -5,7 +5,6 @@
-
diff --git a/UI/.idea/codeStyleSettings.xml b/UI/.idea/codeStyleSettings.xml
index f16a0e64f..83bfe2c0c 100644
--- a/UI/.idea/codeStyleSettings.xml
+++ b/UI/.idea/codeStyleSettings.xml
@@ -35,10 +35,7 @@
-
-
-
-
+
diff --git a/UI/.idea/dictionaries/Keivan_Beigi.xml b/UI/.idea/dictionaries/Keivan_Beigi.xml
index 42d1a915f..981e29f30 100644
--- a/UI/.idea/dictionaries/Keivan_Beigi.xml
+++ b/UI/.idea/dictionaries/Keivan_Beigi.xml
@@ -4,6 +4,7 @@
backgrid
bnzbd
clickable
+ couldn
mouseenter
mouseleave
diff --git a/UI/.idea/jsLibraryMappings.xml b/UI/.idea/jsLibraryMappings.xml
index c932efdc1..723694460 100644
--- a/UI/.idea/jsLibraryMappings.xml
+++ b/UI/.idea/jsLibraryMappings.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/UI/.idea/jsLinters/jshint.xml b/UI/.idea/jsLinters/jshint.xml
index 77f11c0d4..2f9183e30 100644
--- a/UI/.idea/jsLinters/jshint.xml
+++ b/UI/.idea/jsLinters/jshint.xml
@@ -63,7 +63,7 @@
-
+
diff --git a/UI/.idea/libraries/libraries.xml b/UI/.idea/libraries/libraries.xml
deleted file mode 100644
index ddc15483e..000000000
--- a/UI/.idea/libraries/libraries.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/UI/AddSeries/AddSeriesView.js b/UI/AddSeries/AddSeriesView.js
index c199e9fb2..4372eadd1 100644
--- a/UI/AddSeries/AddSeriesView.js
+++ b/UI/AddSeries/AddSeriesView.js
@@ -1,13 +1,9 @@
-'use strict';
+'use strict';
define(
[
'marionette',
'AddSeries/Collection',
'AddSeries/SearchResultCollectionView',
- 'Shared/SpinnerView',
- 'app',
- 'AddSeries/RootFolders/Collection',
- 'AddSeries/SearchResultView',
'Shared/SpinnerView'
], function (Marionette, AddSeriesCollection, SearchResultCollectionView, SpinnerView) {
return Marionette.Layout.extend({
diff --git a/UI/AddSeries/Collection.js b/UI/AddSeries/Collection.js
index 404807184..36e71b397 100644
--- a/UI/AddSeries/Collection.js
+++ b/UI/AddSeries/Collection.js
@@ -1,12 +1,11 @@
-'use strict';
+'use strict';
define(
[
- 'app',
'backbone',
'Series/SeriesModel'
- ], function (App, Backbone, SeriesModel) {
+ ], function (Backbone, SeriesModel) {
return Backbone.Collection.extend({
- url : Constants.ApiRoot + '/series/lookup',
+ url : window.ApiRoot + '/series/lookup',
model: SeriesModel,
parse: function (response) {
diff --git a/UI/AddSeries/RootFolders/Collection.js b/UI/AddSeries/RootFolders/Collection.js
index f0a9f9e71..c03a30753 100644
--- a/UI/AddSeries/RootFolders/Collection.js
+++ b/UI/AddSeries/RootFolders/Collection.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict';
define(
[
'backbone',
@@ -6,12 +6,12 @@ define(
'mixins/backbone.signalr.mixin'
], function (Backbone, RootFolderModel) {
- var rootFolderCollection = Backbone.Collection.extend({
- url : NzbDrone.Constants.ApiRoot + '/rootfolder',
+ var RootFolderCollection = Backbone.Collection.extend({
+ url : window.ApiRoot + '/rootfolder',
model: RootFolderModel
});
- var collection = new rootFolderCollection().BindSignalR();
+ var collection = new RootFolderCollection().BindSignalR();
return collection;
});
diff --git a/UI/Calendar/CalendarLayout.js b/UI/Calendar/CalendarLayout.js
index 50894415e..4314df051 100644
--- a/UI/Calendar/CalendarLayout.js
+++ b/UI/Calendar/CalendarLayout.js
@@ -1,12 +1,12 @@
'use strict';
-define([
- 'app',
- 'Calendar/UpcomingCollectionView',
- 'Calendar/CalendarView',
- 'Shared/Toolbar/ToolbarLayout'
-],
- function () {
- NzbDrone.Calendar.CalendarLayout = Backbone.Marionette.Layout.extend({
+define(
+ [
+ 'marionette',
+ 'Calendar/UpcomingCollection',
+ 'Calendar/UpcomingCollectionView',
+ 'Calendar/CalendarView',
+ ], function (Marionette, UpcomingCollection, UpcomingCollectionView, CalendarView) {
+ return Marionette.Layout.extend({
template: 'Calendar/CalendarLayoutTemplate',
regions: {
@@ -15,7 +15,7 @@ define([
},
initialize: function () {
- this.upcomingCollection = new NzbDrone.Calendar.UpcomingCollection();
+ this.upcomingCollection = new UpcomingCollection();
this.upcomingCollection.fetch();
},
@@ -25,13 +25,13 @@ define([
},
_showUpcoming: function () {
- this.upcoming.show(new NzbDrone.Calendar.UpcomingCollectionView({
+ this.upcoming.show(new UpcomingCollectionView({
collection: this.upcomingCollection
}));
},
_showCalendar: function () {
- this.calendar.show(new NzbDrone.Calendar.CalendarView());
+ this.calendar.show(new CalendarView());
}
});
});
diff --git a/UI/Calendar/CalendarView.js b/UI/Calendar/CalendarView.js
index 03b517965..2575e94c3 100644
--- a/UI/Calendar/CalendarView.js
+++ b/UI/Calendar/CalendarView.js
@@ -1,81 +1,87 @@
-'use strict';
+'use strict';
-define(['app', 'Calendar/Collection','fullcalendar'], function () {
- NzbDrone.Calendar.CalendarView = Backbone.Marionette.ItemView.extend({
- initialize : function () {
- this.collection = new NzbDrone.Calendar.Collection();
- },
- render: function () {
- $(this.$el).empty().fullCalendar({
- defaultView : 'basicWeek',
- allDayDefault : false,
- ignoreTimezone: false,
- weekMode : 'variable',
- timeFormat : 'h(:mm)tt',
- header : {
- left : 'prev,next today',
- center: 'title',
- right : 'month,basicWeek'
- },
- buttonText : {
- prev: '',
- next: ''
- },
- events : this.getEvents,
- eventRender : function (event, element) {
- $(element).addClass(event.statusLevel);
- $(element).children('.fc-event-inner').addClass(event.statusLevel);
+define(
+ [
+ 'marionette',
+ 'Calendar/Collection',
+ 'fullcalendar'
+ ], function (Marionette, CalendarCollection) {
- element.popover({
- title : '{seriesTitle} - {season}x{episode} - {episodeTitle}'.assign({
- seriesTitle : event.title,
- season : event.seasonNumber,
- episode : event.episodeNumber.pad(2),
- episodeTitle: event.episodeTitle
- }),
- content : event.overview,
- placement: 'bottom',
- trigger : 'manual'
- });
- },
- eventMouseover: function () {
- $(this).popover('show');
- },
- eventMouseout : function () {
- $(this).popover('hide');
- }
- });
+ var _instance;
- NzbDrone.Calendar.CalendarView.Instance = this;
- },
+ return Marionette.ItemView.extend({
+ initialize: function () {
+ this.collection = new CalendarCollection();
+ },
+ render : function () {
+ $(this.$el).empty().fullCalendar({
+ defaultView : 'basicWeek',
+ allDayDefault : false,
+ ignoreTimezone: false,
+ weekMode : 'variable',
+ timeFormat : 'h(:mm)tt',
+ header : {
+ left : 'prev,next today',
+ center: 'title',
+ right : 'month,basicWeek'
+ },
+ buttonText : {
+ prev: '',
+ next: ''
+ },
+ events : this.getEvents,
+ eventRender : function (event, element) {
+ $(element).addClass(event.statusLevel);
+ $(element).children('.fc-event-inner').addClass(event.statusLevel);
- onShow: function () {
- this.$('.fc-button-today').click();
- },
+ element.popover({
+ title : '{seriesTitle} - {season}x{episode} - {episodeTitle}'.assign({
+ seriesTitle : event.title,
+ season : event.seasonNumber,
+ episode : event.episodeNumber.pad(2),
+ episodeTitle: event.episodeTitle
+ }),
+ content : event.overview,
+ placement: 'bottom',
+ trigger : 'manual'
+ });
+ },
+ eventMouseover: function () {
+ $(this).popover('show');
+ },
+ eventMouseout : function () {
+ $(this).popover('hide');
+ }
+ });
- getEvents: function (start, end, callback) {
- var bbView = NzbDrone.Calendar.CalendarView.Instance;
+ _instance = this;
+ },
- var startDate = Date.create(start).format(Date.ISO8601_DATETIME);
- var endDate = Date.create(end).format(Date.ISO8601_DATETIME);
+ onShow: function () {
+ this.$('.fc-button-today').click();
+ },
- bbView.collection.fetch({
- data : { start: startDate, end: endDate },
- success: function (calendarCollection) {
- _.each(calendarCollection.models, function (element) {
- var episodeTitle = element.get('title');
- var seriesTitle = element.get('series').get('title');
- var start = element.get('airDate');
+ getEvents: function (start, end, callback) {
+ var startDate = Date.create(start).format(Date.ISO8601_DATETIME);
+ var endDate = Date.create(end).format(Date.ISO8601_DATETIME);
- element.set('title', seriesTitle);
- element.set('episodeTitle', episodeTitle);
- element.set('start', start);
- element.set('allDay', false);
- });
+ _instance.collection.fetch({
+ data : { start: startDate, end: endDate },
+ success: function (calendarCollection) {
+ _.each(calendarCollection.models, function (element) {
+ var episodeTitle = element.get('title');
+ var seriesTitle = element.get('series').get('title');
+ var start = element.get('airDate');
- callback(calendarCollection.toJSON());
- }
- });
- }
+ element.set('title', seriesTitle);
+ element.set('episodeTitle', episodeTitle);
+ element.set('start', start);
+ element.set('allDay', false);
+ });
+
+ callback(calendarCollection.toJSON());
+ }
+ });
+ }
+ });
});
-});
diff --git a/UI/Calendar/Collection.js b/UI/Calendar/Collection.js
index 0752c3b57..64121cc54 100644
--- a/UI/Calendar/Collection.js
+++ b/UI/Calendar/Collection.js
@@ -1,13 +1,17 @@
-'use strict';
-define(['app', 'Series/EpisodeModel'], function () {
- NzbDrone.Calendar.Collection = Backbone.Collection.extend({
- url : NzbDrone.Constants.ApiRoot + '/calendar',
- model : NzbDrone.Series.EpisodeModel,
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Series/EpisodeModel'
+ ], function (Backbone, EpisodeModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/calendar',
+ model: EpisodeModel,
- comparator: function(model) {
- var date = new Date(model.get('airDate'));
- var time = date.getTime();
- return time;
- }
+ comparator: function (model) {
+ var date = new Date(model.get('airDate'));
+ var time = date.getTime();
+ return time;
+ }
+ });
});
-});
diff --git a/UI/Calendar/UpcomingCollection.js b/UI/Calendar/UpcomingCollection.js
index 83294c0c3..e78f7aaa7 100644
--- a/UI/Calendar/UpcomingCollection.js
+++ b/UI/Calendar/UpcomingCollection.js
@@ -1,13 +1,17 @@
-'use strict';
-define(['app', 'Series/EpisodeModel'], function () {
- NzbDrone.Calendar.UpcomingCollection = Backbone.Collection.extend({
- url : NzbDrone.Constants.ApiRoot + '/calendar',
- model : NzbDrone.Series.EpisodeModel,
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Series/EpisodeModel'
+ ], function (Backbone, EpisodeModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/calendar',
+ model: EpisodeModel,
- comparator: function(model) {
- var date = new Date(model.get('airDate'));
- var time = date.getTime();
- return time;
- }
+ comparator: function (model) {
+ var date = new Date(model.get('airDate'));
+ var time = date.getTime();
+ return time;
+ }
+ });
});
-});
diff --git a/UI/Calendar/UpcomingCollectionView.js b/UI/Calendar/UpcomingCollectionView.js
index 9cccbb165..2a9508bba 100644
--- a/UI/Calendar/UpcomingCollectionView.js
+++ b/UI/Calendar/UpcomingCollectionView.js
@@ -1,7 +1,11 @@
-'use strict';
+'use strict';
-define(['app', 'Calendar/UpcomingItemView'], function () {
- NzbDrone.Calendar.UpcomingCollectionView = Backbone.Marionette.CollectionView.extend({
- itemView: NzbDrone.Calendar.UpcomingItemView
+define(
+ [
+ 'marionette',
+ 'Calendar/UpcomingItemView'
+ ], function (Marionette, UpcomingItemView) {
+ return Marionette.CollectionView.extend({
+ itemView: UpcomingItemView
+ });
});
-});
diff --git a/UI/Calendar/UpcomingItemView.js b/UI/Calendar/UpcomingItemView.js
index 78995d063..eec39440e 100644
--- a/UI/Calendar/UpcomingItemView.js
+++ b/UI/Calendar/UpcomingItemView.js
@@ -1,12 +1,11 @@
'use strict';
-define([
- 'app',
- 'Calendar/UpcomingCollection'
-
-], function () {
- NzbDrone.Calendar.UpcomingItemView = Backbone.Marionette.ItemView.extend({
- template : 'Calendar/UpcomingItemTemplate',
- tagName : 'div'
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
+ return Marionette.ItemView.extend({
+ template: 'Calendar/UpcomingItemTemplate',
+ tagName : 'div'
+ });
});
-});
\ No newline at end of file
diff --git a/UI/Calendar/calendar.less b/UI/Calendar/calendar.less
index 0c4e1e7ae..7f6186f3a 100644
--- a/UI/Calendar/calendar.less
+++ b/UI/Calendar/calendar.less
@@ -1,121 +1,121 @@
.calendar {
th, td {
- border-color: #eeeeee;
+ border-color : #eeeeee;
}
.primary {
- border-color: #007ccd;
- background-color: #007ccd;
+ border-color : #007ccd;
+ background-color : #007ccd;
}
.fc-event-skin {
- background-color: #007ccd;
- border: 1px solid #007ccd;
- border-radius: 4px;
- text-align: center;
+ background-color : #007ccd;
+ border : 1px solid #007ccd;
+ border-radius : 4px;
+ text-align : center;
}
.info {
- border-color: #14b8d4;
- background-color: #14b8d4;
+ border-color : #14b8d4;
+ background-color : #14b8d4;
}
.inverse {
- border-color: #333333;
- background-color: #333333;
+ border-color : #333333;
+ background-color : #333333;
}
.warning {
- border-color: #ffa93c;
- background-color: #ffa93c;
+ border-color : #ffa93c;
+ background-color : #ffa93c;
}
.danger {
- border-color: #ea494a;
- background-color: #ea494a;
+ border-color : #ea494a;
+ background-color : #ea494a;
}
th {
- background-color: #eeeeee;
+ background-color : #eeeeee;
}
.purple {
- border-color: #7932ea;
- background-color: #7932ea;
+ border-color : #7932ea;
+ background-color : #7932ea;
}
.success {
- border-color: #4cb158;
- background-color: #4cb158;
+ border-color : #4cb158;
+ background-color : #4cb158;
}
h2 {
- font-size: 17.5px;
+ font-size : 17.5px;
}
}
.event {
- display: inline-block;
- width: 100%;
- margin-bottom: 10px;
- border-top: 1px solid #eeeeee;
- padding-top: 10px;
+ display : inline-block;
+ width : 100%;
+ margin-bottom : 10px;
+ border-top : 1px solid #eeeeee;
+ padding-top : 10px;
.primary {
- border-color: #007ccd;
+ border-color : #007ccd;
}
.info {
- border-color: #14b8d4;
+ border-color : #14b8d4;
}
h4 {
- text-transform: none !important;
- font-weight: 500;
- color: #008dcd;
- margin: 5px 0px;
+ text-transform : none !important;
+ font-weight : 500;
+ color : #008dcd;
+ margin : 5px 0px;
}
.inverse {
- border-color: #333333;
+ border-color : #333333;
}
.warning {
- border-color: #ffa93c;
+ border-color : #ffa93c;
}
p {
- color: #999999;
+ color : #999999;
}
.danger {
- border-color: #ea494a;
+ border-color : #ea494a;
}
.date {
- text-align: center;
- display: inline-block;
- border-left: 4px solid #eeeeee;
- padding-left: 16px;
- float: left;
- margin-right: 20px;
+ text-align : center;
+ display : inline-block;
+ border-left : 4px solid #eeeeee;
+ padding-left : 16px;
+ float : left;
+ margin-right : 20px;
h4 {
- line-height: 1em;
- color: #555555;
- font-weight: 300;
+ line-height : 1em;
+ color : #555555;
+ font-weight : 300;
}
h1 {
- font-weight: 500;
- line-height: 0.8em;
+ font-weight : 500;
+ line-height : 0.8em;
}
}
.purple {
- border-color: #7932ea;
+ border-color : #7932ea;
}
.success {
- border-color: #4cb158;
+ border-color : #4cb158;
}
-}
\ No newline at end of file
+}
diff --git a/UI/Cells/AirDateCell.js b/UI/Cells/AirDateCell.js
index 47a10b55b..9072fe22a 100644
--- a/UI/Cells/AirDateCell.js
+++ b/UI/Cells/AirDateCell.js
@@ -1,15 +1,19 @@
'use strict';
-define(['app', 'Shared/FormatHelpers', 'Cells/NzbDroneCell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
- className: 'air-date-cell',
+define(
+ [
+ 'backgrid',
+ 'Shared/FormatHelpers'
+ ], function (Backgrid, FormatHelpers) {
+ return Backgrid.Cell.extend({
+ className: 'air-date-cell',
- render: function () {
+ render: function () {
- this.$el.empty();
- var airDate = this.model.get(this.column.get('name'));
- this.$el.html(NzbDrone.Shared.FormatHelpers.DateHelper(airDate));
- return this;
+ this.$el.empty();
+ var airDate = this.model.get(this.column.get('name'));
+ this.$el.html(FormatHelpers.DateHelper(airDate));
+ return this;
- }
+ }
+ });
});
-});
diff --git a/UI/Cells/EpisodeNumberCell.js b/UI/Cells/EpisodeNumberCell.js
index 093d6ca15..6c982061b 100644
--- a/UI/Cells/EpisodeNumberCell.js
+++ b/UI/Cells/EpisodeNumberCell.js
@@ -1,49 +1,52 @@
'use strict';
-define(['app', 'Cells/NzbDroneCell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
+define(
+ [
+ 'Cells/NzbDroneCell'
+ ], function (NzbDroneCell) {
+ return NzbDroneCell.extend({
- className: 'episode-number-cell',
+ className: 'episode-number-cell',
- render: function () {
+ render: function () {
- this.$el.empty();
+ this.$el.empty();
- var airDateField = this.column.get('airDate') || 'airDate';
- var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
- var episodeField = this.column.get('episodes') || 'episodeNumber';
+ var airDateField = this.column.get('airDate') || 'airDate';
+ var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
+ var episodeField = this.column.get('episodes') || 'episodeNumber';
- if (this.cellValue) {
+ if (this.cellValue) {
- var airDate = this.cellValue.get(airDateField);
- var seasonNumber = this.cellValue.get(seasonField);
- var episodes = this.cellValue.get(episodeField);
+ var airDate = this.cellValue.get(airDateField);
+ var seasonNumber = this.cellValue.get(seasonField);
+ var episodes = this.cellValue.get(episodeField);
- var result = 'Unknown';
+ var result = 'Unknown';
- if (episodes) {
+ if (episodes) {
- var paddedEpisodes;
+ var paddedEpisodes;
- if (episodes.constructor === Array) {
- paddedEpisodes = _.map(episodes,function (episodeNumber) {
- return episodeNumber.pad(2);
- }).join();
+ if (episodes.constructor === Array) {
+ paddedEpisodes = _.map(episodes,function (episodeNumber) {
+ return episodeNumber.pad(2);
+ }).join();
+ }
+ else {
+ paddedEpisodes = episodes.pad(2);
+ }
+
+ result = 'S{0}-E{1}'.format(seasonNumber.pad(2), paddedEpisodes);
}
- else {
- paddedEpisodes = episodes.pad(2);
+ else if (airDate) {
+ result = new Date(airDate).toLocaleDateString();
}
- result = 'S{0}-E{1}'.format(seasonNumber.pad(2), paddedEpisodes);
+ this.$el.html(result);
}
- else if (airDate) {
- result = new Date(airDate).toLocaleDateString();
- }
-
- this.$el.html(result);
+ this.delegateEvents();
+ return this;
}
- this.delegateEvents();
- return this;
- }
+ });
});
-});
diff --git a/UI/Cells/EpisodeStatusCell.js b/UI/Cells/EpisodeStatusCell.js
index 4eee59c80..4c3e5ea62 100644
--- a/UI/Cells/EpisodeStatusCell.js
+++ b/UI/Cells/EpisodeStatusCell.js
@@ -1,34 +1,37 @@
'use strict';
-define(['app','cells/nzbdronecell' ], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
- className: 'episode-status-cell',
+ className: 'episode-status-cell',
- render: function () {
- this.$el.empty();
+ render: function () {
+ this.$el.empty();
- if (this.model) {
+ if (this.model) {
- var icon;
+ var icon;
- if (this.model.get('episodeFile')) {
- icon = 'icon-ok';
+ if (this.model.get('episodeFile')) {
+ icon = 'icon-ok';
- }
- else {
- if (this.model.get('hasAired')) {
- icon = 'icon-warning-sign';
}
else {
- icon = 'icon-time';
+ if (this.model.get('hasAired')) {
+ icon = 'icon-warning-sign';
+ }
+ else {
+ icon = 'icon-time';
+ }
}
+
+ this.$el.html(''.format(icon));
}
- this.$el.html(''.format(icon));
+ return this;
}
-
- return this;
- }
+ });
});
-});
diff --git a/UI/Cells/EpisodeTitleCell.js b/UI/Cells/EpisodeTitleCell.js
index 98681b0ac..7226e145f 100644
--- a/UI/Cells/EpisodeTitleCell.js
+++ b/UI/Cells/EpisodeTitleCell.js
@@ -1,22 +1,27 @@
'use strict';
-define(['app', 'Cells/NzbDroneCell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
+define(
+ [
+ 'app',
+ 'Cells/NzbDroneCell',
+ 'Episode/Layout'
+ ], function (App, NzbDroneCell, EpisodeLayout) {
+ return NzbDroneCell.extend({
- className: 'episode-title-cell',
+ className: 'episode-title-cell',
- events: {
- 'click': 'showDetails'
- },
+ events: {
+ 'click': 'showDetails'
+ },
- showDetails: function () {
- var view = new NzbDrone.Episode.Layout({ model: this.cellValue });
- NzbDrone.modalRegion.show(view);
- },
+ showDetails: function () {
+ var view = new EpisodeLayout({ model: this.cellValue });
+ App.modalRegion.show(view);
+ },
- render: function () {
- this.$el.html(this.cellValue.get('title'));
- return this;
- }
+ render: function () {
+ this.$el.html(this.cellValue.get('title'));
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Cells/FileSizeCell.js b/UI/Cells/FileSizeCell.js
index f3994bb2f..3606379b6 100644
--- a/UI/Cells/FileSizeCell.js
+++ b/UI/Cells/FileSizeCell.js
@@ -1,15 +1,19 @@
'use strict';
-define(['app', 'Shared/FormatHelpers','backgrid'], function () {
- NzbDrone.Cells.FileSizeCell = Backgrid.Cell.extend({
+define(
+ [
+ 'backgrid',
+ 'Shared/FormatHelpers'
+ ], function (Backgrid, FormatHelpers) {
+ return Backgrid.Cell.extend({
- className: 'file-size-cell',
+ className: 'file-size-cell',
- render: function () {
- var size = this.model.get(this.column.get('name'));
- this.$el.html(NzbDrone.Shared.FormatHelpers.FileSizeHelper(size));
- this.delegateEvents();
- return this;
- }
+ render: function () {
+ var size = this.model.get(this.column.get('name'));
+ this.$el.html(FormatHelpers.FileSizeHelper(size));
+ this.delegateEvents();
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Cells/IndexerCell.js b/UI/Cells/IndexerCell.js
index 62cce919c..82fc80f48 100644
--- a/UI/Cells/IndexerCell.js
+++ b/UI/Cells/IndexerCell.js
@@ -1,13 +1,16 @@
'use strict';
-define(['app','backgrid'], function () {
- NzbDrone.Cells.IndexerCell = Backgrid.Cell.extend({
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
- class : 'indexer-cell',
+ class : 'indexer-cell',
- render: function () {
- var indexer = this.model.get(this.column.get('name'));
- this.$el.html(indexer);
- return this;
- }
+ render: function () {
+ var indexer = this.model.get(this.column.get('name'));
+ this.$el.html(indexer);
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Cells/NzbDroneCell.js b/UI/Cells/NzbDroneCell.js
index 8c259085e..c43e6e71a 100644
--- a/UI/Cells/NzbDroneCell.js
+++ b/UI/Cells/NzbDroneCell.js
@@ -1,44 +1,47 @@
'use strict';
-define(['app','backgrid'], function () {
- NzbDrone.Cells.NzbDroneCell = Backgrid.Cell.extend({
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
- _originalInit: Backgrid.Cell.prototype.initialize,
+ _originalInit: Backgrid.Cell.prototype.initialize,
- initialize: function () {
- this._originalInit.apply(this, arguments);
- this.cellValue = this._getValue();
+ initialize: function () {
+ this._originalInit.apply(this, arguments);
+ this.cellValue = this._getValue();
- this.listenTo(this.model, 'change', this._refresh);
- },
+ this.listenTo(this.model, 'change', this._refresh);
+ },
- _refresh: function () {
- this.cellValue = this._getValue();
- this.render();
- },
+ _refresh: function () {
+ this.cellValue = this._getValue();
+ this.render();
+ },
- _getValue: function () {
+ _getValue: function () {
- var name = this.column.get('name');
+ var name = this.column.get('name');
- if (name === 'this') {
- return this.model;
+ if (name === 'this') {
+ return this.model;
+ }
+
+ var value = this.model.get(name);
+
+ if (!value) {
+ return undefined;
+ }
+
+ //if not a model
+ if (!value.get && typeof value === 'object') {
+ value = new Backbone.Model(value);
+ }
+
+ return value;
}
- var value = this.model.get(name);
-
- if (!value) {
- return undefined;
- }
-
- //if not a model
- if (!value.get && typeof value === 'object') {
- value = new Backbone.Model(value);
- }
-
- return value;
- }
-
+ });
});
-});
diff --git a/UI/Cells/QualityCell.js b/UI/Cells/QualityCell.js
index 452d8fceb..d46ac4531 100644
--- a/UI/Cells/QualityCell.js
+++ b/UI/Cells/QualityCell.js
@@ -1,9 +1,12 @@
'use strict';
-define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) {
- return TemplatedCell.extend({
+define(
+ [
+ 'Cells/TemplatedCell'
+ ], function (TemplatedCell) {
+ return TemplatedCell.extend({
- className: 'quality-cell',
- template : 'Cells/QualityTemplate'
+ className: 'quality-cell',
+ template : 'Cells/QualityTemplate'
+ });
});
-});
diff --git a/UI/Cells/RelativeDateCell.js b/UI/Cells/RelativeDateCell.js
index 826516d41..314aff53c 100644
--- a/UI/Cells/RelativeDateCell.js
+++ b/UI/Cells/RelativeDateCell.js
@@ -1,15 +1,18 @@
'use strict';
-define(['app','Cells/NzbDroneCell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
+define(
+ [
+ 'Cells/NzbDroneCell'
+ ], function (NzbDroneCell) {
+ return NzbDroneCell.extend({
- className : 'relative-date-cell',
+ className: 'relative-date-cell',
- render: function () {
+ render: function () {
- var date = this.model.get(this.column.get('name'));
- this.$el.html(Date.create(date).relative());
+ var date = this.model.get(this.column.get('name'));
+ this.$el.html(Date.create(date).relative());
- return this;
- }
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Cells/SeriesStatusCell.js b/UI/Cells/SeriesStatusCell.js
deleted file mode 100644
index 1bbd0a062..000000000
--- a/UI/Cells/SeriesStatusCell.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict';
-define(['app','cells/nzbdronecell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
- className: 'series-status-cell',
-
- render: function () {
- this.$el.empty();
- var monitored = this.model.get('monitored');
- var status = this.model.get('status');
-
- if (!monitored) {
- this.$el.html('');
- }
- else if (status === 'continuing') {
- this.$el.html('');
- }
-
- else {
- this.$el.html('');
- }
-
- return this;
- }
- });
-});
diff --git a/UI/Cells/SeriesTitleCell.js b/UI/Cells/SeriesTitleCell.js
index 7fae88d17..2421ab72a 100644
--- a/UI/Cells/SeriesTitleCell.js
+++ b/UI/Cells/SeriesTitleCell.js
@@ -1,9 +1,12 @@
'use strict';
-define(['app', 'Cells/TemplatedCell'], function (App, TemplatedCell) {
- return TemplatedCell.extend({
+define(
+ [
+ 'Cells/TemplatedCell'
+ ], function (TemplatedCell) {
+ return TemplatedCell.extend({
- className: 'series-title',
- template : 'Cells/SeriesTitleTemplate'
+ className: 'series-title',
+ template : 'Cells/SeriesTitleTemplate'
+ });
});
-});
diff --git a/UI/Cells/TemplatedCell.js b/UI/Cells/TemplatedCell.js
index fbf0f2528..1c82ef9d6 100644
--- a/UI/Cells/TemplatedCell.js
+++ b/UI/Cells/TemplatedCell.js
@@ -1,17 +1,23 @@
'use strict';
-define(['app','Cells/NzbDroneCell'], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
- render: function () {
+define(
+ [
+ 'marionette',
+ 'Cells/NzbDroneCell'
+ ], function (Marionette, NzbDroneCell) {
+ return NzbDroneCell.extend({
- var templateName = this.column.get('template') || this.template;
- this.templateFunction = Marionette.TemplateCache.get(templateName);
- var data = this.cellValue.toJSON();
- var html = this.templateFunction(data);
- this.$el.html(html);
+ render: function () {
- return this;
- }
+ var templateName = this.column.get('template') || this.template;
+
+ this.templateFunction = Marionette.TemplateCache.get(templateName);
+ var data = this.cellValue.toJSON();
+ var html = this.templateFunction(data);
+ this.$el.html(html);
+
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Cells/ToggleCell.js b/UI/Cells/ToggleCell.js
index 612955e84..ebe82af8e 100644
--- a/UI/Cells/ToggleCell.js
+++ b/UI/Cells/ToggleCell.js
@@ -1,39 +1,42 @@
'use strict';
-define(['app', 'Episode/Layout'], function () {
- return Backgrid.Cell.extend({
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
- className: 'toggle-cell clickable',
+ className: 'toggle-cell clickable',
- events: {
- 'click': '_onClick'
- },
+ events: {
+ 'click': '_onClick'
+ },
- _onClick: function () {
- var name = this.column.get('name');
- this.model.set(name, !this.model.get(name));
- this.render();
+ _onClick: function () {
+ var name = this.column.get('name');
+ this.model.set(name, !this.model.get(name));
+ this.render();
- this.model.save();
- },
+ this.model.save();
+ },
- render: function () {
- this.$el.empty();
+ render: function () {
+ this.$el.empty();
- this.$el.html('');
+ this.$el.html('');
- var name = this.column.get('name');
+ var name = this.column.get('name');
- if (this.model.get(name)) {
- this.$('i').addClass(this.column.get('trueClass'));
+ if (this.model.get(name)) {
+ this.$('i').addClass(this.column.get('trueClass'));
+ }
+ else {
+ this.$('i').addClass(this.column.get('falseClass'));
+ }
+ return this;
}
- else {
- this.$('i').addClass(this.column.get('falseClass'));
- }
- return this;
- }
+ });
});
-});
diff --git a/UI/Commands/CommandController.js b/UI/Commands/CommandController.js
index 2b7bc3e90..c10d66ae5 100644
--- a/UI/Commands/CommandController.js
+++ b/UI/Commands/CommandController.js
@@ -1,17 +1,16 @@
'use strict';
-define(['app'], function () {
+define({
+ Execute: function (name, properties) {
+ var data = { command: name };
- NzbDrone.Commands.Execute = function (name, properties) {
- var data = { command: name };
+ if (properties) {
+ $.extend(data, properties);
+ }
- if (properties) {
- $.extend(data, properties);
+ return $.ajax({
+ type: 'POST',
+ url : window.ApiRoot + '/command',
+ data: JSON.stringify(data)
+ });
}
-
- return $.ajax({
- type: 'POST',
- url : NzbDrone.Constants.ApiRoot + '/command',
- data: JSON.stringify(data)
- });
- };
-});
+ });
diff --git a/UI/Config.js b/UI/Config.js
index 6382c91b5..9d9708a60 100644
--- a/UI/Config.js
+++ b/UI/Config.js
@@ -2,41 +2,38 @@
define(
[
'app'
- ], function () {
-
- NzbDrone.Config = {
+ ], function (App) {
+ return {
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultQualityProfileId: 'DefaultQualityProfileId'
- }
- };
+ },
- NzbDrone.Config.GetValue = function (key, defaultValue) {
+ GetValue: function (key, defaultValue) {
- var storeValue = localStorage.getItem(key);
+ var storeValue = localStorage.getItem(key);
+
+ if (!storeValue) {
+ return defaultValue;
+ }
+
+ return storeValue.toString();
+ },
+
+ SetValue: function (key, value) {
+
+ console.log('Config: [{0}] => [{1}] '.format(key, value));
+
+ if (this.GetValue(key) === value.toString()) {
+ return;
+ }
+
+ localStorage.setItem(key, value);
+ App.vent.trigger(this.Events.ConfigUpdatedEvent, {key: key, value: value});
- if (!storeValue) {
- return defaultValue;
}
- return storeValue.toString();
};
-
- NzbDrone.Config.SetValue = function (key, value) {
-
- console.log('Config: [{0}] => [{1}] '.format(key, value));
-
- if (NzbDrone.Config.GetValue(key) === value.toString()) {
- return;
- }
-
- localStorage.setItem(key, value);
- NzbDrone.vent.trigger(NzbDrone.Config.Events.ConfigUpdatedEvent, {key: key, value: value});
-
- };
-
- return NzbDrone.Config;
-
});
diff --git a/UI/Content/Messenger/messenger.future.css b/UI/Content/Messenger/messenger.future.css
index 2c441d143..89aa3bd66 100644
--- a/UI/Content/Messenger/messenger.future.css
+++ b/UI/Content/Messenger/messenger.future.css
@@ -244,10 +244,6 @@ ul.messenger-theme-future {
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
- -moz-user-select: none;
- -webkit-user-select: none;
- -o-user-select: none;
- user-select: none;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #5c5b5b), color-stop(100%, #353535));
background-image: -webkit-linear-gradient(#5c5b5b, #353535);
background-image: -moz-linear-gradient(#5c5b5b, #353535);
diff --git a/UI/Content/form.less b/UI/Content/form.less
index e568abc91..e6569d70b 100644
--- a/UI/Content/form.less
+++ b/UI/Content/form.less
@@ -1,4 +1,4 @@
-.control-group {
+.control-group {
.controls {
i.danger {
color: #b94a48;
@@ -19,6 +19,14 @@
margin-bottom: 0px;
}
+
+
+
+
+
+
+
+
.help-inline-checkbox {
padding-left: 5px;
display: inline-block;
@@ -35,6 +43,8 @@
font-size: 12px;
}
+
+
textarea.nzb-restrictions {
width: 260px;
-}
\ No newline at end of file
+}
diff --git a/UI/Controller.js b/UI/Controller.js
index 9227a35c7..cdee651c1 100644
--- a/UI/Controller.js
+++ b/UI/Controller.js
@@ -1,40 +1,36 @@
-'use strict';
+'use strict';
define(
[
'app',
+ 'marionette',
+ 'History/HistoryLayout',
'Settings/SettingsLayout',
'AddSeries/AddSeriesLayout',
- 'Missing/MissingLayout',
- 'History/HistoryLayout',
- 'Form/FormBuilder',
'Series/Index/SeriesIndexLayout',
- 'Calendar/CalendarLayout',
- 'Shared/NotificationView',
- 'Shared/NotFoundView',
- 'MainMenuView',
'Series/Details/SeriesDetailsLayout',
- 'Series/EpisodeCollection',
+ 'Missing/MissingLayout',
+ 'Series/SeriesModel',
+ 'Calendar/CalendarLayout',
'Logs/Layout',
'Release/Layout',
- 'Shared/FormatHelpers',
- 'Shared/TemplateHelpers',
- 'Shared/Footer/View'
- ], function (App, SettingsLayout, AddSeriesLayout, MissingLayout, HistoryLayout) {
- var controller = Backbone.Marionette.Controller.extend({
+ 'Shared/NotFoundView'
+ ], function (App, Marionette, HistoryLayout, SettingsLayout, AddSeriesLayout, SeriesIndexLayout, SeriesDetailsLayout, MissingLayout, SeriesModel, CalendarLayout, NotFoundView,
+ LogsLayout, ReleaseLayout) {
+ return Marionette.Controller.extend({
series : function () {
this._setTitle('NzbDrone');
- App.mainRegion.show(new NzbDrone.Series.Index.SeriesIndexLayout());
+ App.mainRegion.show(new SeriesIndexLayout());
},
seriesDetails: function (query) {
var self = this;
this._setTitle('Loading Series');
- var series = new NzbDrone.Series.SeriesModel({ id: query });
+ var series = new SeriesModel({ id: query });
series.fetch({
success: function (seriesModel) {
self._setTitle(seriesModel.get('title'));
- App.mainRegion.show(new NzbDrone.Series.Details.SeriesDetailsLayout({ model: seriesModel }));
+ App.mainRegion.show(new SeriesDetailsLayout({ model: seriesModel }));
}
});
},
@@ -46,7 +42,7 @@ define(
calendar: function () {
this._setTitle('Calendar');
- App.mainRegion.show(new NzbDrone.Calendar.CalendarLayout());
+ App.mainRegion.show(new CalendarLayout());
},
@@ -69,17 +65,17 @@ define(
rss: function () {
this._setTitle('RSS');
- App.mainRegion.show(new NzbDrone.Release.Layout());
+ App.mainRegion.show(new ReleaseLayout());
},
logs: function () {
this._setTitle('logs');
- App.mainRegion.show(new NzbDrone.Logs.Layout());
+ App.mainRegion.show(new LogsLayout());
},
notFound: function () {
this._setTitle('Not Found');
- App.mainRegion.show(new NzbDrone.Shared.NotFoundView(this));
+ App.mainRegion.show(new NotFoundView(this));
},
@@ -112,8 +108,5 @@ define(
}
}
});
-
- return new controller();
-
});
diff --git a/UI/Episode/Layout.js b/UI/Episode/Layout.js
index 30a244f4e..1caee5abf 100644
--- a/UI/Episode/Layout.js
+++ b/UI/Episode/Layout.js
@@ -1,78 +1,85 @@
'use strict';
-define(['app', 'Shared/SpinnerView', 'Episode/Summary/View', 'Episode/Search/Layout', 'Release/Collection'], function () {
+define(
+ [
+ 'marionette',
+ 'Episode/Summary/View',
+ 'Episode/Search/Layout',
+ 'Release/Collection',
+ 'Shared/SpinnerView'
+ ], function (Marionette, SummaryView, SearchLayout, ReleaseCollection, SpinnerView) {
- NzbDrone.Episode.Layout = Backbone.Marionette.Layout.extend({
- template: 'Episode/LayoutTemplate',
+ return Marionette.Layout.extend({
+ template: 'Episode/LayoutTemplate',
- regions: {
- summary : '#episode-summary',
- activity: '#episode-activity',
- search : '#episode-search'
- },
+ regions: {
+ summary : '#episode-summary',
+ activity: '#episode-activity',
+ search : '#episode-search'
+ },
- ui: {
- summary : '.x-episode-summary',
- activity: '.x-episode-activity',
- search : '.x-episode-search'
- },
+ ui: {
+ summary : '.x-episode-summary',
+ activity: '.x-episode-activity',
+ search : '.x-episode-search'
+ },
- events: {
+ events: {
- 'click .x-episode-summary' : 'showSummary',
- 'click .x-episode-activity': 'showActivity',
- 'click .x-episode-search' : 'showSearch'
- },
+ 'click .x-episode-summary' : 'showSummary',
+ 'click .x-episode-activity': 'showActivity',
+ 'click .x-episode-search' : 'showSearch'
+ },
- onShow: function () {
- this.showSummary();
- this._releaseSearchActivated = false;
- },
+ onShow: function () {
+ this.showSummary();
+ this._releaseSearchActivated = false;
+ },
- showSummary: function (e) {
- if (e) {
- e.preventDefault();
- }
-
- this.ui.summary.tab('show');
- this.summary.show(new NzbDrone.Episode.Summary.View({model: this.model}));
-
- },
-
- showActivity: function (e) {
- if (e) {
- e.preventDefault();
- }
-
- this.ui.activity.tab('show');
- },
-
- showSearch: function (e) {
- if (e) {
- e.preventDefault();
- }
-
- if (this._releaseSearchActivated) {
- return;
- }
-
- var self = this;
-
- this.ui.search.tab('show');
- this.search.show(new NzbDrone.Shared.SpinnerView());
-
- var releases = new NzbDrone.Release.Collection();
- var promise = releases.fetchEpisodeReleases(this.model.id);
-
- promise.done(function () {
- if (!self.isClosed) {
- self.search.show(new NzbDrone.Episode.Search.Layout({collection: releases}));
+ showSummary: function (e) {
+ if (e) {
+ e.preventDefault();
}
- });
- }
+
+ this.ui.summary.tab('show');
+ this.summary.show(new SummaryView({model: this.model}));
+
+ },
+
+ showActivity: function (e) {
+ if (e) {
+ e.preventDefault();
+ }
+
+ this.ui.activity.tab('show');
+ },
+
+ showSearch: function (e) {
+ if (e) {
+ e.preventDefault();
+ }
+
+ if (this._releaseSearchActivated) {
+ return;
+ }
+
+ var self = this;
+
+ this.ui.search.tab('show');
+ this.search.show(new SpinnerView());
+
+ var releases = new ReleaseCollection();
+ var promise = releases.fetchEpisodeReleases(this.model.id);
+
+ promise.done(function () {
+ if (!self.isClosed) {
+ self.search.show(new SearchLayout({collection: releases}));
+ }
+ });
+ }
+
+ });
});
-
-});
diff --git a/UI/Episode/Search/Layout.js b/UI/Episode/Search/Layout.js
index 3c38dd007..e4e5d68e2 100644
--- a/UI/Episode/Search/Layout.js
+++ b/UI/Episode/Search/Layout.js
@@ -1,68 +1,70 @@
'use strict';
-define([
- 'app',
- 'Cells/FileSizeCell',
- 'Cells/QualityCell',
- 'Release/ApprovalStatusCell',
- 'Release/DownloadReportCell'
-], function () {
+define(
+ [
+ 'marionette',
+ 'backgrid',
+ 'Cells/FileSizeCell',
+ 'Cells/QualityCell',
+ 'Release/ApprovalStatusCell',
+ 'Release/DownloadReportCell'
+ ], function (Marionette, Backgrid, FileSizeCell, QualityCell, ApprovalStatusCell, DownloadReportCell) {
- NzbDrone.Episode.Search.Layout = Backbone.Marionette.Layout.extend({
- template: 'Episode/Search/LayoutTemplate',
+ return Marionette.Layout.extend({
+ template: 'Episode/Search/LayoutTemplate',
- regions: {
- grid: '#episode-release-grid'
- },
-
- columns: [
- {
- name : 'age',
- label : 'Age',
- sortable: true,
- cell : Backgrid.IntegerCell
- },
- {
- name : 'title',
- label : 'Title',
- sortable: true,
- cell : Backgrid.StringCell
- },
- {
- name : 'size',
- label : 'Size',
- sortable: true,
- cell : NzbDrone.Cells.FileSizeCell
- },
- {
- name : 'quality',
- label : 'Quality',
- sortable: true,
- cell : NzbDrone.Cells.QualityCell
+ regions: {
+ grid: '#episode-release-grid'
},
- {
- name : 'rejections',
- label: 'decision',
- cell : NzbDrone.Release.ApprovalStatusCell
- },
- {
- name : 'download',
- label: '',
- cell : NzbDrone.Release.DownloadReportCell
- }
- ],
-
- onShow: function () {
- if (!this.isClosed) {
- this.grid.show(new Backgrid.Grid(
+ columns:
+ [
{
+ name : 'age',
+ label : 'Age',
+ sortable: true,
+ cell : Backgrid.IntegerCell
+ },
+ {
+ name : 'title',
+ label : 'Title',
+ sortable: true,
+ cell : Backgrid.StringCell
+ },
+ {
+ name : 'size',
+ label : 'Size',
+ sortable: true,
+ cell : FileSizeCell
+ },
+ {
+ name : 'quality',
+ label : 'Quality',
+ sortable: true,
+ cell : QualityCell
+ },
+
+ {
+ name : 'rejections',
+ label: 'decision',
+ cell : ApprovalStatusCell
+ },
+ {
+ name : 'download',
+ label: '',
+ cell : DownloadReportCell
+ }
+ ],
+
+ onShow: function () {
+ if (!this.isClosed) {
+ this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
columns : this.columns,
collection: this.collection,
className : 'table table-hover'
}));
+ }
}
- }
- });
+ });
-});
+ });
diff --git a/UI/Episode/Summary/View.js b/UI/Episode/Summary/View.js
index a1ea1fb18..193e9bd7c 100644
--- a/UI/Episode/Summary/View.js
+++ b/UI/Episode/Summary/View.js
@@ -1,8 +1,11 @@
'use strict';
-define(['app'], function () {
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
+
+ return Marionette.ItemView.extend({
+ template: 'Episode/Summary/ViewTemplate'
+ });
- NzbDrone.Episode.Summary.View = Backbone.Marionette.ItemView.extend({
- template: 'Episode/Summary/ViewTemplate'
});
-
-});
diff --git a/UI/Form/FormBuilder.js b/UI/Form/FormBuilder.js
index 1db81c9f6..4bc3a12f4 100644
--- a/UI/Form/FormBuilder.js
+++ b/UI/Form/FormBuilder.js
@@ -1,31 +1,50 @@
'use strict';
-define(['app', 'handlebars'], function (App,Handlebars) {
- Handlebars.registerHelper('formBuilder', function () {
- var ret = '';
- _.each(this.fields, function (field) {
- ret += NzbDrone.Form.FieldBuilder(field);
+define(
+ [
+ 'handlebars'
+ ], function (Handlebars) {
+
+ var formBuilder = function (field) {
+ if (!field.type) {
+ return Handlebars.helpers.partial.apply(field,
+ [
+ 'Form/TextboxTemplate'
+ ]);
+ }
+
+ if (field.type === 'password') {
+ return Handlebars.helpers.partial.apply(field,
+ [
+ 'Form/PasswordTemplate'
+ ]);
+ }
+
+ if (field.type === 'checkbox') {
+ return Handlebars.helpers.partial.apply(field,
+ [
+ 'Form/CheckboxTemplate'
+ ]);
+ }
+
+ if (field.type === 'select') {
+ return Handlebars.helpers.partial.apply(field,
+ [
+ 'Form/SelectTemplate'
+ ]);
+ }
+
+ return Handlebars.helpers.partial.apply(field,
+ [
+ 'Form/TextboxTemplate'
+ ]);
+ };
+
+ Handlebars.registerHelper('formBuilder', function () {
+ var ret = '';
+ _.each(this.fields, function (field) {
+ ret += this.FieldBuilder(field);
+ });
+
+ return new Handlebars.SafeString(ret);
});
-
- return new Handlebars.SafeString(ret);
});
-
- NzbDrone.Form.FieldBuilder = function (field) {
- if (!field.type) {
- return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
- }
-
- if (field.type === 'password') {
- return Handlebars.helpers.partial.apply(field, ['Form/PasswordTemplate']);
- }
-
- if (field.type === 'checkbox') {
- return Handlebars.helpers.partial.apply(field, ['Form/CheckboxTemplate']);
- }
-
- if (field.type === 'select') {
- return Handlebars.helpers.partial.apply(field, ['Form/SelectTemplate']);
- }
-
- return Handlebars.helpers.partial.apply(field, ['Form/TextboxTemplate']);
- };
-});
diff --git a/UI/Handlebars/backbone.marionette.templates.js b/UI/Handlebars/backbone.marionette.templates.js
index 061575c18..73a72794a 100644
--- a/UI/Handlebars/backbone.marionette.templates.js
+++ b/UI/Handlebars/backbone.marionette.templates.js
@@ -1,30 +1,33 @@
-'use strict';
+'use strict';
-define(['templates'], function (Templates) {
- return function () {
- this.get = function (templateId) {
+define(
+ [
+ 'templates'
+ ], function (Templates) {
+ return function () {
+ this.get = function (templateId) {
- var templateKey = templateId.toLowerCase();
+ var templateKey = templateId.toLowerCase();
- var templateFunction = Templates[templateKey];
+ var templateFunction = Templates[templateKey];
- if (!templateFunction) {
- throw 'couldn\'t find pre-compiled template ' + templateKey;
- }
-
- return function (data) {
-
- try {
- return templateFunction(data);
- }
- catch (error) {
- console.error('template render failed for ' + templateKey + ' ' + error);
- console.error(data);
- throw error;
+ if (!templateFunction) {
+ throw 'couldn\'t find pre-compiled template ' + templateKey;
}
+
+ return function (data) {
+
+ try {
+ return templateFunction(data);
+ }
+ catch (error) {
+ console.error('template render failed for ' + templateKey + ' ' + error);
+ console.error(data);
+ throw error;
+ }
+ };
};
};
- };
-});
+ });
diff --git a/UI/History/Collection.js b/UI/History/Collection.js
index edbd0ec33..644e9ac3a 100644
--- a/UI/History/Collection.js
+++ b/UI/History/Collection.js
@@ -1,37 +1,41 @@
-'use strict';
-define(['app', 'History/Model', 'backbone.pageable'], function (App, HistoryModel, PageableCollection) {
- return PageableCollection.extend({
- url : NzbDrone.Constants.ApiRoot + '/history',
- model : NzbDrone.History.Model,
+'use strict';
+define(
+ [
+ 'History/Model',
+ 'backbone.pageable'
+ ], function ( HistoryModel, PageableCollection) {
+ return PageableCollection.extend({
+ url : window.ApiRoot + '/history',
+ model: HistoryModel,
- state: {
- pageSize: 15,
- sortKey: 'date',
- order: 1
- },
+ state: {
+ pageSize: 15,
+ sortKey : 'date',
+ order : 1
+ },
- queryParams: {
- totalPages: null,
- totalRecords: null,
- pageSize: 'pageSize',
- sortKey: 'sortKey',
- order: 'sortDir',
- directions: {
- '-1': 'asc',
- '1': 'desc'
+ queryParams: {
+ totalPages : null,
+ totalRecords: null,
+ pageSize : 'pageSize',
+ sortKey : 'sortKey',
+ order : 'sortDir',
+ directions : {
+ '-1': 'asc',
+ '1' : 'desc'
+ }
+ },
+
+ parseState: function (resp) {
+ return {totalRecords: resp.totalRecords};
+ },
+
+ parseRecords: function (resp) {
+ if (resp) {
+ return resp.records;
+ }
+
+ return resp;
}
- },
-
- parseState: function (resp, queryParams, state) {
- return {totalRecords: resp.totalRecords};
- },
-
- parseRecords: function (resp) {
- if (resp) {
- return resp.records;
- }
-
- return resp;
- }
+ });
});
-});
diff --git a/UI/History/EventTypeCell.js b/UI/History/EventTypeCell.js
index e5acc4112..c91af5db1 100644
--- a/UI/History/EventTypeCell.js
+++ b/UI/History/EventTypeCell.js
@@ -1,41 +1,44 @@
'use strict';
-define(['app', 'Cells/NzbDroneCell' ], function () {
- return NzbDrone.Cells.NzbDroneCell.extend({
+define(
+ [
+ 'Cells/NzbDroneCell'
+ ], function (NzbDroneCell) {
+ return NzbDroneCell.extend({
- className: 'history-event-type-cell',
+ className: 'history-event-type-cell',
- render: function () {
- this.$el.empty();
+ render: function () {
+ this.$el.empty();
- if (this.cellValue) {
+ if (this.cellValue) {
- var icon;
- var toolTip;
+ var icon;
+ var toolTip;
- switch (this.cellValue) {
- case 'grabbed':
- icon = 'icon-cloud-download';
- toolTip = 'Episode grabbed from indexer and sent to download client';
- break;
- case 'seriesFolderImported':
- icon = 'icon-hdd';
- toolTip = 'Existing episode file added to library';
- break;
- case 'downloadFolderImported':
- icon = 'icon-download-alt';
- toolTip = 'Episode downloaded successfully and picked up from download client';
- break;
- default :
- icon = 'icon-question';
- toolTip = 'unknown event';
+ switch (this.cellValue) {
+ case 'grabbed':
+ icon = 'icon-cloud-download';
+ toolTip = 'Episode grabbed from indexer and sent to download client';
+ break;
+ case 'seriesFolderImported':
+ icon = 'icon-hdd';
+ toolTip = 'Existing episode file added to library';
+ break;
+ case 'downloadFolderImported':
+ icon = 'icon-download-alt';
+ toolTip = 'Episode downloaded successfully and picked up from download client';
+ break;
+ default :
+ icon = 'icon-question';
+ toolTip = 'unknown event';
+ }
+
+ this.$el.html(''.format(icon, toolTip));
}
- this.$el.html(''.format(icon, toolTip));
+ return this;
}
-
- return this;
- }
+ });
});
-});
diff --git a/UI/History/HistoryLayout.js b/UI/History/HistoryLayout.js
index c7b05fe0e..137ac8b52 100644
--- a/UI/History/HistoryLayout.js
+++ b/UI/History/HistoryLayout.js
@@ -1,33 +1,19 @@
'use strict';
-define([
- 'app',
- 'History/Collection',
- 'History/EventTypeCell',
- 'Cells/RelativeDateCell',
- 'Cells/TemplatedCell',
- 'Cells/SeriesTitleCell',
- 'Cells/EpisodeNumberCell',
- 'Cells/EpisodeTitleCell',
- 'Cells/QualityCell',
- 'Shared/Toolbar/ToolbarLayout',
- 'Shared/Grid/Pager',
- 'Shared/Grid/HeaderCell',
- 'Shared/LoadingView'
-],
- function (App,
- HistoryCollection,
- EventTypeCell,
- RelativeDateCell,
- TemplatedCell,
- SeriesTitleCell,
- EpisodeNumberCell,
- EpisodeTitleCell,
- QualityCell,
- ToolbarLayout,
- Pager,
- HeaderCell,
- LoadingView) {
- return Backbone.Marionette.Layout.extend({
+define(
+ [
+ 'marionette',
+ 'backgrid',
+ 'History/Collection',
+ 'History/EventTypeCell',
+ 'Cells/SeriesTitleCell',
+ 'Cells/EpisodeNumberCell',
+ 'Cells/EpisodeTitleCell',
+ 'Cells/QualityCell',
+ 'Cells/RelativeDateCell',
+ 'Shared/Grid/Pager',
+ 'Shared/LoadingView'
+ ], function (Marionette, Backgrid, HistoryCollection, EventTypeCell, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, QualityCell, RelativeDateCell, GridPager, LoadingView) {
+ return Marionette.Layout.extend({
template: 'History/HistoryLayoutTemplate',
regions: {
@@ -36,54 +22,53 @@ define([
pager : '#x-pager'
},
- columns: [
- {
- name: 'eventType',
- label:'',
- cell : EventTypeCell
- },
- {
- name : 'series',
- label : 'Series',
- cell : SeriesTitleCell
- },
- {
- name : 'episode',
- label : 'Episode',
- sortable: false,
- cell : EpisodeNumberCell
- },
- {
- name : 'episode',
- label : 'Episode Title',
- sortable: false,
- cell : EpisodeTitleCell
- },
- {
- name : 'quality',
- label : 'Quality',
- cell : QualityCell
- },
- {
- name : 'date',
- label: 'Date',
- cell : RelativeDateCell
- }
- ],
-
- _showTable: function () {
-
- this.history.show(new Backgrid.Grid(
+ columns:
+ [
{
- row : NzbDrone.History.Row,
- columns : this.columns,
- collection: this.historyCollection,
- className : 'table table-hover'
- }));
+ name : 'eventType',
+ label: '',
+ cell : EventTypeCell
+ },
+ {
+ name : 'series',
+ label: 'Series',
+ cell : SeriesTitleCell
+ },
+ {
+ name : 'episode',
+ label : 'Episode',
+ sortable: false,
+ cell : EpisodeNumberCell
+ },
+ {
+ name : 'episode',
+ label : 'Episode Title',
+ sortable: false,
+ cell : EpisodeTitleCell
+ },
+ {
+ name : 'quality',
+ label: 'Quality',
+ cell : QualityCell
+ },
+ {
+ name : 'date',
+ label: 'Date',
+ cell : RelativeDateCell
+ }
+ ],
- this.pager.show(new Pager({
+ _showTable: function (collection) {
+
+ this.history.show(new Backgrid.Grid({
columns : this.columns,
- collection: this.historyCollection
+ collection: collection,
+ className : 'table table-hover'
+ }));
+
+ this.pager.show(new GridPager({
+ columns : this.columns,
+ collection: collection
}));
},
@@ -92,16 +77,11 @@ define([
this.history.show(new LoadingView());
- this.historyCollection = new HistoryCollection();
- this.historyCollection.fetch()
- .done(function () {
- self._showTable();
- });
-
- //this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
+ var collection = new HistoryCollection();
+ collection.fetch().done(function () {
+ self._showTable(collection);
+ });
}
- })
- ;
- })
-;
+ });
+ });
diff --git a/UI/History/Model.js b/UI/History/Model.js
index 8ca6098df..40496f8c8 100644
--- a/UI/History/Model.js
+++ b/UI/History/Model.js
@@ -1,22 +1,25 @@
-'use strict';
-define(['app','Series/SeriesModel', 'Series/EpisodeModel'], function () {
- NzbDrone.History.Model = Backbone.Model.extend({
- mutators: {
- seasonNumber: function () {
- return this.get('episode').seasonNumber;
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Series/SeriesModel',
+ 'Series/EpisodeModel'
+ ], function (Backbone, SeriesModel, EpisodeModel) {
+ return Backbone.Model.extend({
+ mutators: {
+ seasonNumber: function () {
+ return this.get('episode').seasonNumber;
+ },
+
+ paddedEpisodeNumber: function () {
+ return this.get('episode').episodeNumber.pad(2);
+ }
},
- paddedEpisodeNumber: function () {
- return this.get('episode').episodeNumber.pad(2);
+ parse: function (model) {
+ model.series = new SeriesModel(model.series);
+ model.episode = new EpisodeModel(model.episode);
+ return model;
}
- },
-
- parse: function (model) {
- model.series = new NzbDrone.Series.SeriesModel(model.series);
- model.episode = new NzbDrone.Series.EpisodeModel(model.episode);
- return model;
- }
-
-
+ });
});
-});
diff --git a/UI/Index.html b/UI/Index.html
index 44694d987..45305217a 100644
--- a/UI/Index.html
+++ b/UI/Index.html
@@ -1,28 +1,28 @@
-
+
diff --git a/UI/Instrumentation/ErrorHandler.js b/UI/Instrumentation/ErrorHandler.js
index ec6a18f79..d805c6613 100644
--- a/UI/Instrumentation/ErrorHandler.js
+++ b/UI/Instrumentation/ErrorHandler.js
@@ -1,14 +1,6 @@
-'use strict';
+'use strict';
(function () {
- /* var model = new NzbDrone.Shared.NotificationModel();
- model.set('title','test notification');
- model.set('message','test message');
- model.set('level', 'error');
- this.push(model);
- */
-
-
if (!window.console) {
window.console = {};
}
diff --git a/UI/Logs/Collection.js b/UI/Logs/Collection.js
index 2f0b0f330..3b6070b59 100644
--- a/UI/Logs/Collection.js
+++ b/UI/Logs/Collection.js
@@ -1,8 +1,8 @@
-'use strict';
-define(['app', 'Logs/Model', 'backbone.pageable'], function (app, SeriesModel, PagableCollection) {
- NzbDrone.Logs.Collection = PagableCollection.extend({
- url : NzbDrone.Constants.ApiRoot + '/log',
- model: NzbDrone.Logs.Model,
+'use strict';
+define(['backbone.pageable', 'Logs/Model', ], function (PagableCollection, LogsModel) {
+ return PagableCollection.extend({
+ url : window.ApiRoot + '/log',
+ model: LogsModel,
state: {
pageSize: 50,
diff --git a/UI/Logs/Layout.js b/UI/Logs/Layout.js
index 7f5aabbe1..28126d8b4 100644
--- a/UI/Logs/Layout.js
+++ b/UI/Logs/Layout.js
@@ -1,12 +1,12 @@
'use strict';
define([
- 'app',
- 'Logs/Collection',
- 'Shared/Toolbar/ToolbarLayout',
- 'Shared/Grid/Pager'
+ 'marionette',
+ 'backgrid',
+ 'Shared/Grid/Pager',
+ 'Logs/Collection'
],
- function () {
- NzbDrone.Logs.Layout = Backbone.Marionette.Layout.extend({
+ function (Marionette,Backgrid, GridPager, LogCollection) {
+ return Marionette.Layout.extend({
template: 'Logs/LayoutTemplate',
regions: {
@@ -51,20 +51,19 @@ define([
className : 'table table-hover'
}));
- this.pager.show(new NzbDrone.Shared.Grid.Pager({
+ this.pager.show(new GridPager({
columns : this.columns,
collection: this.collection
}));
},
initialize: function () {
- this.collection = new NzbDrone.Logs.Collection();
+ this.collection = new LogCollection();
this.collection.fetch();
},
onShow: function () {
this.showTable();
- //this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
}
})
diff --git a/UI/Logs/Model.js b/UI/Logs/Model.js
index ce490c009..17c0fd6da 100644
--- a/UI/Logs/Model.js
+++ b/UI/Logs/Model.js
@@ -1,14 +1,8 @@
-'use strict';
-define(['app'], function (app) {
- NzbDrone.Logs.Model = Backbone.Model.extend({
- /* mutators: {
- seasonNumber: function () {
- return this.get('episode').seasonNumber;
- },
-
- paddedEpisodeNumber: function () {
- return this.get('episode').episodeNumber.pad(2);
- }
- }*/
+'use strict';
+define(
+ [
+ 'backbone'
+ ], function (Backbone) {
+ return Backbone.Model.extend({
+ });
});
-});
diff --git a/UI/MainMenuView.js b/UI/MainMenuView.js
index 972d9b45c..2c689af37 100644
--- a/UI/MainMenuView.js
+++ b/UI/MainMenuView.js
@@ -1,6 +1,6 @@
-'use strict';
-define(['app'], function () {
- var MainMenuView = Backbone.Marionette.ItemView.extend({
+'use strict';
+define(['marionette'], function (Marionette) {
+ var MainMenuView = Marionette.ItemView.extend({
events: {
'click a': 'onClick'
},
diff --git a/UI/Missing/Collection.js b/UI/Missing/Collection.js
index 8d6c7297c..3ffdcdcdd 100644
--- a/UI/Missing/Collection.js
+++ b/UI/Missing/Collection.js
@@ -1,37 +1,41 @@
-'use strict';
-define(['app', 'Series/EpisodeModel', 'backbone.pageable'], function (app, EpisodeModel, PagableCollection) {
- return PagableCollection.extend({
- url : NzbDrone.Constants.ApiRoot + '/missing',
- model: NzbDrone.Series.EpisodeModel,
+'use strict';
+define(
+ [
+ 'Series/EpisodeModel',
+ 'backbone.pageable'
+ ], function (EpisodeModel, PagableCollection) {
+ return PagableCollection.extend({
+ url : window.ApiRoot + '/missing',
+ model: EpisodeModel,
- state: {
- pageSize: 15,
- sortKey : 'airDate',
- order : 1
- },
+ state: {
+ pageSize: 15,
+ sortKey : 'airDate',
+ order : 1
+ },
- queryParams: {
- totalPages : null,
- totalRecords: null,
- pageSize : 'pageSize',
- sortKey : 'sortKey',
- order : 'sortDir',
- directions : {
- '-1': 'asc',
- '1' : 'desc'
+ queryParams: {
+ totalPages : null,
+ totalRecords: null,
+ pageSize : 'pageSize',
+ sortKey : 'sortKey',
+ order : 'sortDir',
+ directions : {
+ '-1': 'asc',
+ '1' : 'desc'
+ }
+ },
+
+ parseState: function (resp) {
+ return {totalRecords: resp.totalRecords};
+ },
+
+ parseRecords: function (resp) {
+ if (resp) {
+ return resp.records;
+ }
+
+ return resp;
}
- },
-
- parseState: function (resp, queryParams, state) {
- return {totalRecords: resp.totalRecords};
- },
-
- parseRecords: function (resp) {
- if (resp) {
- return resp.records;
- }
-
- return resp;
- }
+ });
});
-});
diff --git a/UI/Missing/MissingLayout.js b/UI/Missing/MissingLayout.js
index 8dda7ee45..aa31d0e36 100644
--- a/UI/Missing/MissingLayout.js
+++ b/UI/Missing/MissingLayout.js
@@ -1,29 +1,17 @@
'use strict';
define(
[
- 'app',
- 'Missing/Row',
+ 'marionette',
+ 'backgrid',
'Missing/Collection',
- 'Cells/AirDateCell',
- 'Series/Index/Table/SeriesStatusCell',
- 'Shared/Toolbar/ToolbarLayout',
'Cells/SeriesTitleCell',
'Cells/EpisodeNumberCell',
'Cells/EpisodeTitleCell',
+ 'Cells/AirDateCell',
'Shared/Grid/Pager',
'Shared/LoadingView'
- ], function (App,
- MissingRow,
- MissingCollection,
- AirDateCell,
- SeriesStatusCell,
- ToolbarLayout,
- SeriesTitleCell,
- EpisodeNumberCell,
- EpisodeTitleCell,
- Pager,
- LoadingView) {
- return Backbone.Marionette.Layout.extend({
+ ], function (Marionette, Backgrid, MissingCollection, SeriesTitleCell, EpisodeNumberCell, EpisodeTitleCell, AirDateCell, GridPager, LoadingView) {
+ return Marionette.Layout.extend({
template: 'Missing/MissingLayoutTemplate',
regions: {
@@ -53,21 +41,20 @@ define(
cell : EpisodeTitleCell
},
{
- name : 'airDate',
- label : 'Air Date',
- cell : AirDateCell
+ name : 'airDate',
+ label: 'Air Date',
+ cell : AirDateCell
}
],
_showTable: function () {
this.missing.show(new Backgrid.Grid({
- row : MissingRow,
- columns : this.columns,
- collection: this.missingCollection,
- className : 'table table-hover'
- }));
+ columns : this.columns,
+ collection: this.missingCollection,
+ className : 'table table-hover'
+ }));
- this.pager.show(new NzbDrone.Shared.Grid.Pager({
+ this.pager.show(new GridPager({
columns : this.columns,
collection: this.missingCollection
}));
@@ -80,8 +67,8 @@ define(
this.missingCollection = new MissingCollection();
this.missingCollection.fetch().done(function () {
- self._showTable();
- });
+ self._showTable();
+ });
}
});
});
diff --git a/UI/Mixins/AutoComplete.js b/UI/Mixins/AutoComplete.js
index 5660274e9..6da4c82b1 100644
--- a/UI/Mixins/AutoComplete.js
+++ b/UI/Mixins/AutoComplete.js
@@ -1,12 +1,12 @@
-'use strict';
+'use strict';
-define(['app'], function () {
+define(function () {
$.fn.autoComplete = function (resource) {
$(this).typeahead({
source : function (filter, callback) {
$.ajax({
- url : NzbDrone.Constants.ApiRoot + resource,
+ url : window.ApiRoot + resource,
dataType: 'json',
type : 'GET',
data : { query: filter },
@@ -16,7 +16,7 @@ define(['app'], function () {
});
},
minLength: 3,
- items :20
+ items : 20
});
};
diff --git a/UI/Mixins/backbone.signalr.mixin.js b/UI/Mixins/backbone.signalr.mixin.js
index 50f397856..781669313 100644
--- a/UI/Mixins/backbone.signalr.mixin.js
+++ b/UI/Mixins/backbone.signalr.mixin.js
@@ -1,49 +1,55 @@
'use strict';
-define(['app', 'signalR'], function () {
+define(
+ [
+ 'signalR'
+ ], function () {
- _.extend(Backbone.Collection.prototype, {BindSignalR: function (options) {
+ _.extend(Backbone.Collection.prototype, {BindSignalR: function (options) {
- if (!options || !options.url) {
- console.assert(this.url, 'url must be provided or collection must have url');
- options = {
- url: this.url.replace('api', 'signalr')
- };
- }
-
- var self = this;
-
- var _getStatus = function (status) {
- switch (status) {
- case 0:
- return 'connecting';
- case 1:
- return 'connected';
- case 2:
- return 'reconnecting';
- case 4:
- return 'disconnected';
- default:
- throw 'invalid status ' + status;
+ if (!options || !options.url) {
+ console.assert(this.url, 'url must be provided or collection must have url');
+ options = {
+ url: this.url.replace('api', 'signalr')
+ };
}
- };
+ var self = this;
+
+ var _getStatus = function (status) {
+ switch (status) {
+ case 0:
+ return 'connecting';
+ case 1:
+ return 'connected';
+ case 2:
+ return 'reconnecting';
+ case 4:
+ return 'disconnected';
+ default:
+ throw 'invalid status ' + status;
+ }
+
+ };
- var connection = $.connection(options.url);
+ var connection = $.connection(options.url);
- connection.stateChanged(function (change) {
- console.debug('{0} [{1}]'.format(options.url, _getStatus(change.newState)));
- });
+ connection.stateChanged(function (change) {
+ console.debug('{0} [{1}]'.format(options.url, _getStatus(change.newState)));
+ });
- connection.received(function (model) {
- console.debug(model);
- self.fetch();
- });
+ connection.received(function (model) {
+ console.debug(model);
+ self.fetch();
+ });
- connection.start({ transport: ['longPolling'] });
+ connection.start({ transport:
+ [
+ 'longPolling'
+ ] });
- return this;
- }});
-});
+ return this;
+ }});
+ });
diff --git a/UI/Quality/QualitySizeCollection.js b/UI/Quality/QualitySizeCollection.js
index 1687bfcd4..4919f5ac7 100644
--- a/UI/Quality/QualitySizeCollection.js
+++ b/UI/Quality/QualitySizeCollection.js
@@ -1,9 +1,10 @@
-'use strict';
-define(['app', 'Quality/QualitySizeModel'], function () {
- NzbDrone.Quality.QualitySizeCollection = Backbone.Collection.extend({
- model: NzbDrone.Quality.QualitySizeModel,
- url : NzbDrone.Constants.ApiRoot + '/qualitysize'
+'use strict';
+define(
+ [
+ 'Quality/QualitySizeModel'
+ ], function (QualitySizeModel) {
+ return Backbone.Collection.extend({
+ model: QualitySizeModel,
+ url : window.ApiRoot + '/qualitysize'
+ });
});
-
- return NzbDrone.Quality.QualitySizeCollection;
-});
diff --git a/UI/Quality/QualitySizeModel.js b/UI/Quality/QualitySizeModel.js
index 403946eef..f3fa4f10a 100644
--- a/UI/Quality/QualitySizeModel.js
+++ b/UI/Quality/QualitySizeModel.js
@@ -1,18 +1,17 @@
-'use strict';
-define(['app'], function () {
- NzbDrone.Quality.QualitySizeModel = Backbone.Model.extend({
+'use strict';
+define(
+ [
+ 'backbone'
+ ], function (Backbone) {
+ return Backbone.Model.extend({
- initialize: function () {
- this.validators = {};
- },
-
- mutators: {
- thirtyMinuteSize: function () {
- return this.get('maxSize') * 30;
- },
- sixtyMinuteSize : function () {
- return this.get('maxSize') * 60;
+ mutators: {
+ thirtyMinuteSize: function () {
+ return this.get('maxSize') * 30;
+ },
+ sixtyMinuteSize : function () {
+ return this.get('maxSize') * 60;
+ }
}
- }
+ });
});
-});
diff --git a/UI/Quality/qualityProfileCollection.js b/UI/Quality/qualityProfileCollection.js
index 55b93ccf4..db24cd24b 100644
--- a/UI/Quality/qualityProfileCollection.js
+++ b/UI/Quality/qualityProfileCollection.js
@@ -1,14 +1,18 @@
-'use strict';
-define(['app', 'Quality/QualityProfileModel'], function () {
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Quality/QualityProfileModel'
+ ], function (Backbone, QualityProfileModel) {
- var qualityProfileCollection = Backbone.Collection.extend({
- model: NzbDrone.Quality.QualityProfileModel,
- url : NzbDrone.Constants.ApiRoot + '/qualityprofiles'
+ var QualityProfileCollection = Backbone.Collection.extend({
+ model: QualityProfileModel,
+ url : window.ApiRoot + '/qualityprofiles'
+ });
+
+ var profiles = new QualityProfileCollection();
+
+ profiles.fetch();
+
+ return profiles;
});
-
- var profiles = new qualityProfileCollection();
-
- profiles.fetch();
-
- return profiles;
-});
diff --git a/UI/Quality/qualityProfileModel.js b/UI/Quality/qualityProfileModel.js
index 39cae21e0..629512d52 100644
--- a/UI/Quality/qualityProfileModel.js
+++ b/UI/Quality/qualityProfileModel.js
@@ -1,12 +1,14 @@
-'use strict';
-define(['app', 'backbone.deepmodel'], function (App, DeepModel) {
- NzbDrone.Quality.QualityProfileModel = DeepModel.DeepModel.extend({
-
- defaults: {
- id : null,
- name : '',
- cutoff: null
- }
+'use strict';
+define(
+ [
+ 'backbone.deepmodel'
+ ], function (DeepModel) {
+ return DeepModel.DeepModel.extend({
+ defaults: {
+ id : null,
+ name : '',
+ cutoff: null
+ }
+ });
});
-});
diff --git a/UI/Release/ApprovalStatusCell.js b/UI/Release/ApprovalStatusCell.js
index b7f77595a..cdaa82350 100644
--- a/UI/Release/ApprovalStatusCell.js
+++ b/UI/Release/ApprovalStatusCell.js
@@ -1,22 +1,26 @@
'use strict';
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
-require(['app', 'backgrid'], function () {
- NzbDrone.Release.ApprovalStatusCell = Backgrid.Cell.extend({
- className: 'approval-status-cell',
+ return Backgrid.Cell.extend({
- render: function () {
- var rejections = this.model.get(this.column.get('name'));
+ className: 'approval-status-cell',
- var result = '';
+ render: function () {
+ var rejections = this.model.get(this.column.get('name'));
- _.each(rejections, function (reason) {
- result += reason + ' ';
- });
+ var result = '';
- this.$el.html(result);
- this.delegateEvents();
- return this;
- }
+ _.each(rejections, function (reason) {
+ result += reason + ' ';
+ });
+
+ this.$el.html(result);
+ this.delegateEvents();
+ return this;
+ }
+ });
});
-});
diff --git a/UI/Release/Collection.js b/UI/Release/Collection.js
index 601a02c50..e584f35d0 100644
--- a/UI/Release/Collection.js
+++ b/UI/Release/Collection.js
@@ -1,17 +1,21 @@
-'use strict';
-define(['app', 'Release/Model', 'backbone.pageable'], function (app, SeriesModel, PagableCollection) {
- NzbDrone.Release.Collection = PagableCollection.extend({
- url : NzbDrone.Constants.ApiRoot + '/release',
- model: NzbDrone.Release.Model,
+'use strict';
+define(
+ [
+ 'Release/Model',
+ 'backbone.pageable'
+ ], function (ReleaseModel, PagableCollection) {
+ return PagableCollection.extend({
+ url : window.ApiRoot + '/release',
+ model: ReleaseModel,
- mode: 'client',
+ mode: 'client',
- state: {
- pageSize: 2000
- },
+ state: {
+ pageSize: 2000
+ },
- fetchEpisodeReleases: function (episodeId) {
- return this.fetch({ data: { episodeId: episodeId }});
- }
+ fetchEpisodeReleases: function (episodeId) {
+ return this.fetch({ data: { episodeId: episodeId }});
+ }
+ });
});
-});
diff --git a/UI/Release/DownloadReportCell.js b/UI/Release/DownloadReportCell.js
index 34579a49d..63f70343d 100644
--- a/UI/Release/DownloadReportCell.js
+++ b/UI/Release/DownloadReportCell.js
@@ -1,33 +1,32 @@
'use strict';
-define(['app','backgrid'], function () {
- NzbDrone.Release.DownloadReportCell = Backgrid.Cell.extend({
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
- className: 'download-report-cell',
+ className: 'download-report-cell',
- events: {
- 'click': '_onClick'
- },
+ events: {
+ 'click': '_onClick'
+ },
- _onClick: function () {
+ _onClick: function () {
- var self = this;
+ var self = this;
- this.$el.html('
');
- this.model.save()
- .always(function () {
- self.$el.html('
');
- });
- },
+ this.$el.html('
');
+ this.model.save().always(function () {
+ self.$el.html('
');
+ });
+ },
- render: function () {
+ render: function () {
- this.$el.html('
');
- return this;
+ this.$el.html('
');
+ return this;
- }
+ }
+ });
});
-
-
- return NzbDrone.Release.DownloadReportCell;
-});
diff --git a/UI/Release/Layout.js b/UI/Release/Layout.js
index 38c22247c..0f0a61ef0 100644
--- a/UI/Release/Layout.js
+++ b/UI/Release/Layout.js
@@ -1,17 +1,17 @@
'use strict';
-define([
- 'app',
- 'Release/Collection',
- 'Release/ApprovalStatusCell',
- 'Shared/SpinnerView',
- 'Shared/Toolbar/ToolbarLayout',
- 'Cells/EpisodeNumberCell',
- 'Cells/FileSizeCell',
- 'Cells/IndexerCell',
- 'Cells/QualityCell'
-],
- function () {
- NzbDrone.Release.Layout = Backbone.Marionette.Layout.extend({
+define(
+ [
+ 'marionette',
+ 'backgrid',
+ 'Release/Collection',
+ 'Cells/IndexerCell',
+ 'Cells/EpisodeNumberCell',
+ 'Cells/FileSizeCell',
+ 'Cells/QualityCell',
+ 'Release/ApprovalStatusCell',
+ 'Shared/SpinnerView'
+ ], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, SpinnerView) {
+ return Marionette.Layout.extend({
template: 'Release/LayoutTemplate',
regions: {
@@ -19,60 +19,60 @@ define([
toolbar: '#x-toolbar'
},
- columns: [
- {
- name : 'indexer',
- label : 'Indexer',
- sortable: true,
- cell : NzbDrone.Cells.IndexerCell
- },
+ columns:
+ [
+ {
+ name : 'indexer',
+ label : 'Indexer',
+ sortable: true,
+ cell : IndexerCell
+ },
- {
- name : 'title',
- label : 'Title',
- sortable: true,
- cell : Backgrid.StringCell
- },
- {
- name : 'episodeNumbers',
- episodes: 'episodeNumbers',
- label : 'season',
- cell : NzbDrone.Cells.EpisodeNumberCell
- },
- {
- name : 'size',
- label : 'Size',
- sortable: true,
- cell : NzbDrone.Cells.FileSizeCell
- },
- {
- name : 'quality',
- label : 'Quality',
- sortable: true,
- cell : NzbDrone.Cells.QualityCell
- },
+ {
+ name : 'title',
+ label : 'Title',
+ sortable: true,
+ cell : Backgrid.StringCell
+ },
+ {
+ name : 'episodeNumbers',
+ episodes: 'episodeNumbers',
+ label : 'season',
+ cell : EpisodeNumberCell
+ },
+ {
+ name : 'size',
+ label : 'Size',
+ sortable: true,
+ cell : FileSizeCell
+ },
+ {
+ name : 'quality',
+ label : 'Quality',
+ sortable: true,
+ cell : QualityCell
+ },
- {
- name : 'rejections',
- label: 'decision',
- cell : NzbDrone.Release.ApprovalStatusCell
- }
- ],
+ {
+ name : 'rejections',
+ label: 'decision',
+ cell : ApprovalStatusCell
+ }
+ ],
showTable: function () {
if (!this.isClosed) {
- this.grid.show(new Backgrid.Grid(
- {
- row : Backgrid.Row,
- columns : this.columns,
- collection: this.collection,
- className : 'table table-hover'
- }));
+ this.grid.show(new Backgrid.Grid({
+ row : Backgrid.Row,
+ columns : this.columns,
+ collection: this.collection,
+ className : 'table table-hover'
+ }));
}
},
initialize: function () {
- this.collection = new NzbDrone.Release.Collection();
+ this.collection = new ReleaseCollection();
this.fetchPromise = this.collection.fetch();
},
@@ -80,12 +80,11 @@ define([
var self = this;
- this.grid.show(new NzbDrone.Shared.SpinnerView());
+ this.grid.show(new SpinnerView());
this.fetchPromise.done(function () {
self.showTable();
});
- //this.toolbar.show(new NzbDrone.Shared.Toolbar.ToolbarLayout({right: [ viewButtons], context: this}));
}
});
diff --git a/UI/Release/Model.js b/UI/Release/Model.js
index 3229b4dfc..64a2505ac 100644
--- a/UI/Release/Model.js
+++ b/UI/Release/Model.js
@@ -1,6 +1,6 @@
-'use strict';
-define(['app'], function () {
- NzbDrone.Release.Model = Backbone.Model.extend({
+'use strict';
+define(['backbone'], function (Backbone) {
+ return Backbone.Model.extend({
/* mutators: {
seasonNumber: function () {
return this.get('episode').seasonNumber;
diff --git a/UI/Router.js b/UI/Router.js
index bcc400314..ac4b01d21 100644
--- a/UI/Router.js
+++ b/UI/Router.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict';
require(
[
'app',
@@ -7,9 +7,9 @@ require(
'jQuery/RouteBinder'
], function (App, Marionette, Controller, RouterBinder) {
- NzbDrone.Router = Marionette.AppRouter.extend({
+ var Router = Marionette.AppRouter.extend({
- controller: Controller,
+ controller: new Controller(),
appRoutes : {
'' : 'series',
'series' : 'series',
@@ -28,17 +28,16 @@ require(
}
});
- NzbDrone.addInitializer(function () {
+ App.addInitializer(function () {
- NzbDrone.Router = new NzbDrone.Router();
+ App.Router = new Router();
Backbone.history.start({ pushState: true });
- RouterBinder.bind(NzbDrone.Router);
- // NzbDrone.footerRegion.show(new FooterView());
+ RouterBinder.bind(App.Router);
});
- return NzbDrone.Router;
+ return App.Router;
});
diff --git a/UI/Series/Delete/DeleteSeriesView.js b/UI/Series/Delete/DeleteSeriesView.js
index 2def43b38..4a7c4e532 100644
--- a/UI/Series/Delete/DeleteSeriesView.js
+++ b/UI/Series/Delete/DeleteSeriesView.js
@@ -2,10 +2,10 @@
define(
[
'app',
- 'Series/SeriesModel'
- ], function () {
+ 'marionette'
+ ], function (App, Marionette) {
- NzbDrone.Series.Delete.DeleteSeriesView = Backbone.Marionette.ItemView.extend({
+ return Marionette.ItemView.extend({
template: 'Series/Delete/DeleteSeriesTemplate',
events: {
@@ -24,11 +24,8 @@ define(
data: { 'deleteFiles': deleteFiles },
wait: true
}).done(function () {
- NzbDrone.modalRegion.close();
+ App.modalRegion.close();
});
}
});
-
- return NzbDrone.Series.Delete.DeleteSeriesView;
-
});
diff --git a/UI/Series/Details/SeasonCollectionView.js b/UI/Series/Details/SeasonCollectionView.js
index 3684684e4..c99df15d7 100644
--- a/UI/Series/Details/SeasonCollectionView.js
+++ b/UI/Series/Details/SeasonCollectionView.js
@@ -1,28 +1,28 @@
'use strict';
-define(['app',
- 'Series/Details/SeasonLayout',
- 'Series/SeasonCollection',
- 'Series/EpisodeCollection'],
- function (App, SeasonLayout, SeasonCollection, EpisodeCollection) {
- NzbDrone.Series.Details.SeasonCollectionView = Backbone.Marionette.CollectionView.extend({
+define(
+ [
+ 'marionette',
+ 'Series/Details/SeasonLayout'
+ ], function (Marionette, SeasonLayout) {
+ return Marionette.CollectionView.extend({
- itemView : SeasonLayout,
+ itemView: SeasonLayout,
- initialize: function (options) {
+ initialize: function (options) {
- if (!options.episodeCollection) {
- throw 'episodeCollection is needed';
+ if (!options.episodeCollection) {
+ throw 'episodeCollection is needed';
+ }
+
+ this.episodeCollection = options.episodeCollection;
+
+ },
+
+ itemViewOptions: function () {
+ return {
+ episodeCollection: this.episodeCollection
+ };
}
- this.episodeCollection = options.episodeCollection;
-
- },
-
- itemViewOptions: function () {
- return {
- episodeCollection: this.episodeCollection
- };
- }
-
+ });
});
-});
diff --git a/UI/Series/Details/SeasonLayout.js b/UI/Series/Details/SeasonLayout.js
index 1b4fcfe64..6f3f3722d 100644
--- a/UI/Series/Details/SeasonLayout.js
+++ b/UI/Series/Details/SeasonLayout.js
@@ -1,13 +1,17 @@
-'use strict';
-define([
- 'app',
- 'Cells/EpisodeStatusCell',
- 'Cells/EpisodeTitleCell',
- 'Cells/AirDateCell',
- 'Cells/ToggleCell',
- 'Shared/Messenger'],
- function (App, EpisodeStatusCell, EpisodeTitleCell, AirDateCell, ToggleCell, Messenger) {
- return Backbone.Marionette.Layout.extend({
+
+'use strict';
+define(
+ [
+ 'marionette',
+ 'backgrid',
+ 'Cells/ToggleCell',
+ 'Cells/EpisodeTitleCell',
+ 'Cells/AirDateCell',
+ 'Cells/EpisodeStatusCell',
+ 'Commands/CommandController',
+ 'Shared/Messenger'
+ ], function ( Marionette, Backgrid, ToggleCell, EpisodeTitleCell, AirDateCell, EpisodeStatusCell, CommandController, Messenger) {
+ return Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate',
ui: {
@@ -22,39 +26,38 @@ define([
episodeGrid: '#x-episode-grid'
},
- columns: [
-
- {
- name : 'ignored',
- label : '',
- cell : ToggleCell,
- trueClass : 'icon-bookmark-empty',
- falseClass: 'icon-bookmark'
- },
- {
- name : 'episodeNumber',
- label: '#',
- cell : Backgrid.IntegerCell.extend({
- className: 'episode-number-cell'
- })
- },
-
- {
- name : 'this',
- label: 'Title',
- cell : EpisodeTitleCell
- },
- {
- name : 'airDate',
- label: 'Air Date',
- cell : AirDateCell
- } ,
- {
- name : 'status',
- label: 'Status',
- cell : EpisodeStatusCell
- }
- ],
+ columns:
+ [
+ {
+ name : 'ignored',
+ label : '',
+ cell : ToggleCell,
+ trueClass : 'icon-bookmark-empty',
+ falseClass: 'icon-bookmark'
+ },
+ {
+ name : 'episodeNumber',
+ label: '#',
+ cell : Backgrid.IntegerCell.extend({
+ className: 'episode-number-cell'
+ })
+ },
+ {
+ name : 'this',
+ label: 'Title',
+ cell : EpisodeTitleCell
+ },
+ {
+ name : 'airDate',
+ label: 'Air Date',
+ cell : AirDateCell
+ } ,
+ {
+ name : 'status',
+ label: 'Status',
+ cell : EpisodeStatusCell
+ }
+ ],
initialize: function (options) {
@@ -66,12 +69,11 @@ define([
},
onShow: function () {
- this.episodeGrid.show(new Backgrid.Grid(
- {
- columns : this.columns,
- collection: this.episodeCollection,
- className : 'table table-hover season-grid'
- }));
+ this.episodeGrid.show(new Backgrid.Grid({
+ columns : this.columns,
+ collection: this.episodeCollection,
+ className : 'table table-hover season-grid'
+ }));
},
_seasonSearch: function () {
@@ -82,12 +84,12 @@ define([
this.ui.seasonSearch.addClass('icon-spinner icon-spin');
var properties = {
- seriesId: this.model.get('seriesId'),
+ seriesId : this.model.get('seriesId'),
seasonNumber: this.model.get('seasonNumber')
};
var self = this;
- var commandPromise = App.Commands.Execute(command, properties);
+ var commandPromise = CommandController.Execute(command, properties);
commandPromise.fail(function (options) {
if (options.readyState === 0 || options.status === 0) {
diff --git a/UI/Series/Details/SeriesDetailsLayout.js b/UI/Series/Details/SeriesDetailsLayout.js
index c16188b86..b54d79525 100644
--- a/UI/Series/Details/SeriesDetailsLayout.js
+++ b/UI/Series/Details/SeriesDetailsLayout.js
@@ -1,6 +1,14 @@
'use strict';
-define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','backstrech'], function () {
- NzbDrone.Series.Details.SeriesDetailsLayout = Backbone.Marionette.Layout.extend({
+define(
+ [
+ 'marionette',
+ 'Series/EpisodeCollection',
+ 'Series/SeasonCollection',
+ 'Series/Details/SeasonCollectionView',
+ 'Shared/LoadingView',
+ 'backstrech'
+ ], function (Marionette, EpisodeCollection, SeasonCollection, SeasonCollectionView, LoadingView) {
+ return Marionette.Layout.extend({
itemViewContainer: '.x-series-seasons',
template : 'Series/Details/SeriesDetailsTemplate',
@@ -27,19 +35,17 @@ define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','back
$('body').removeClass('backdrop');
}
- this.seasons.show(new NzbDrone.Shared.LoadingView());
+ this.seasons.show(new LoadingView());
- this.seasonCollection = new NzbDrone.Series.SeasonCollection();
- this.episodeCollection = new NzbDrone.Series.EpisodeCollection();
+ this.seasonCollection = new SeasonCollection();
+ this.episodeCollection = new EpisodeCollection();
- $.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }}))
- .done(function () {
- self.seasons.show(new NzbDrone.Series.Details.SeasonCollectionView({
- collection : self.seasonCollection,
- episodeCollection: self.episodeCollection
- }));
- }
- );
+ $.when(this.episodeCollection.fetch({data: { seriesId: this.model.id }}), this.seasonCollection.fetch({data: { seriesId: this.model.id }})).done(function () {
+ self.seasons.show(new SeasonCollectionView({
+ collection : self.seasonCollection,
+ episodeCollection: self.episodeCollection
+ }));
+ });
},
onClose: function () {
@@ -47,5 +53,4 @@ define(['app', 'Series/Details/SeasonCollectionView', 'Shared/LoadingView','back
$('body').removeClass('backdrop');
}
});
- }
-);
+ });
diff --git a/UI/Series/Edit/EditSeriesView.js b/UI/Series/Edit/EditSeriesView.js
index 1d2600c7d..960b0222b 100644
--- a/UI/Series/Edit/EditSeriesView.js
+++ b/UI/Series/Edit/EditSeriesView.js
@@ -1,45 +1,50 @@
-'use strict';
-define(['app', 'Series/SeriesModel', 'Series/Delete/DeleteSeriesView', 'Quality/QualityProfileCollection'], function (app, seriesModel, deleteSeriesView, qualityProfiles) {
+'use strict';
+define(
+ [
+ 'App',
+ 'marionette',
+ 'Series/Delete/DeleteSeriesView',
+ 'Quality/QualityProfileCollection',
+ 'Mixins/AsModelBoundView'
+ ], function (App, Marionette, DeleteSeriesView, QualityProfiles, AsModelBoundView) {
- NzbDrone.Series.Edit.EditSeriesView = Backbone.Marionette.ItemView.extend({
- template : 'Series/Edit/EditSeriesTemplate',
+ var view = Marionette.ItemView.extend({
+ template: 'Series/Edit/EditSeriesTemplate',
- ui: {
- progressbar : '.progress .bar',
- qualityProfile : '.x-quality-profile',
- backlogSettings: '.x-backlog-setting'
- },
+ ui: {
+ progressbar : '.progress .bar',
+ qualityProfile : '.x-quality-profile',
+ backlogSettings: '.x-backlog-setting'
+ },
- events: {
- 'click .x-save' : 'saveSeries',
- 'click .x-remove': 'removeSeries'
- },
+ events: {
+ 'click .x-save' : 'saveSeries',
+ 'click .x-remove': 'removeSeries'
+ },
- initialize : function(){
-
- this.model.set('qualityProfiles',qualityProfiles);
-
- },
+ initialize: function () {
+ this.model.set('qualityProfiles', QualityProfiles);
+ },
- saveSeries: function () {
- //Todo: Get qualityProfile + backlog setting from UI
- var qualityProfile = this.ui.qualityProfile.val();
- var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
- var backlogSetting = this.ui.backlogSettings.val();
+ saveSeries: function () {
+ //Todo: Get qualityProfile + backlog setting from UI
+ var qualityProfile = this.ui.qualityProfile.val();
+ var qualityProfileText = this.ui.qualityProfile.children('option:selected').text();
+ var backlogSetting = this.ui.backlogSettings.val();
- this.model.set({ qualityProfileId: qualityProfile, backlogSetting: backlogSetting, qualityProfileName: qualityProfileText });
+ this.model.set({ qualityProfileId: qualityProfile, backlogSetting: backlogSetting, qualityProfileName: qualityProfileText });
- this.model.save();
- this.trigger('saved');
- NzbDrone.modalRegion.closeModal();
- },
+ this.model.save();
+ this.trigger('saved');
+ App.modalRegion.closeModal();
+ },
- removeSeries: function () {
- var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
- NzbDrone.modalRegion.show(view);
- }
+ removeSeries: function () {
+ var view = new DeleteSeriesView({ model: this.model });
+ App.modalRegion.show(view);
+ }
+ });
+ return AsModelBoundView.apply(view);
});
-
-});
diff --git a/UI/Series/EpisodeCollection.js b/UI/Series/EpisodeCollection.js
index c53e6a88c..123eccf47 100644
--- a/UI/Series/EpisodeCollection.js
+++ b/UI/Series/EpisodeCollection.js
@@ -1,18 +1,21 @@
-'use strict';
-define(['app', 'Series/EpisodeModel'], function () {
- NzbDrone.Series.EpisodeCollection = Backbone.Collection.extend({
- url : NzbDrone.Constants.ApiRoot + '/episodes',
- model: NzbDrone.Series.EpisodeModel,
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Series/EpisodeModel'
+ ], function (Backbone, EpisodeModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/episodes',
+ model: EpisodeModel,
- bySeason: function (season) {
- var filtered = this.filter(function (episode) {
- return episode.get('seasonNumber') === season;
- });
+ bySeason: function (season) {
+ var filtered = this.filter(function (episode) {
+ return episode.get('seasonNumber') === season;
+ });
- return new NzbDrone.Series.EpisodeCollection(filtered);
- }
+ var EpisodeCollection = require('Series/EpisodeCollection');
+
+ return new EpisodeCollection(filtered);
+ }
+ });
});
-
-
- return NzbDrone.Series.EpisodeCollection;
-});
diff --git a/UI/Series/EpisodeModel.js b/UI/Series/EpisodeModel.js
index 1ee16462a..0321c1e77 100644
--- a/UI/Series/EpisodeModel.js
+++ b/UI/Series/EpisodeModel.js
@@ -1,92 +1,95 @@
'use strict';
-define(['app', 'Series/SeriesModel'], function () {
- NzbDrone.Series.EpisodeModel = Backbone.Model.extend({
+define(
+ [
+ 'backbone',
+ 'Series/SeriesModel'
+ ], function (Backbone, SeriesModel) {
+ return Backbone.Model.extend({
- mutators: {
- paddedEpisodeNumber: function () {
- var test = this.get('episodeNumber');
- return this.get('episodeNumber').pad(2);
- },
- day : function () {
- return Date.create(this.get('airDate')).format('{dd}');
- },
- month : function () {
- return Date.create(this.get('airDate')).format('{MON}');
- },
- startTime : function () {
- var start = Date.create(this.get('airDate'));
+ mutators: {
+ paddedEpisodeNumber: function () {
+ return this.get('episodeNumber').pad(2);
+ },
+ day : function () {
+ return Date.create(this.get('airDate')).format('{dd}');
+ },
+ month : function () {
+ return Date.create(this.get('airDate')).format('{MON}');
+ },
+ startTime : function () {
+ var start = Date.create(this.get('airDate'));
- if (start.format('{mm}') === '00') {
- return start.format('{h}{tt}');
+ if (start.format('{mm}') === '00') {
+ return start.format('{h}{tt}');
+ }
+
+ return start.format('{h}.{mm}{tt}');
+ },
+ end : function () {
+
+ if (this.has('series')) {
+ var start = Date.create(this.get('airDate'));
+ var runtime = this.get('series').runtime;
+
+ return start.addMinutes(runtime);
+ }
+
+ return undefined;
+ },
+ statusLevel : function () {
+ var episodeFileId = this.get('episodeFileId');
+ var currentTime = Date.create();
+ var start = Date.create(this.get('airDate'));
+ var end = Date.create(this.get('end'));
+
+ if (currentTime.isBetween(start, end)) {
+ return 'warning';
+ }
+
+ if (start.isBefore(currentTime) && episodeFileId === 0) {
+ return 'danger';
+ }
+
+ if (status === 'Ready') {
+ return 'success';
+ }
+
+ return 'primary';
+ },
+ hasAired : function () {
+ return Date.create(this.get('airDate')).isBefore(Date.create());
}
-
- return start.format('{h}.{mm}{tt}');
},
- end : function () {
+
+
+ parse: function (model) {
+ model.series = new SeriesModel(model.series);
+
+ return model;
+ },
+
+ toJSON: function () {
+ var json = _.clone(this.attributes);
+
+ _.each(this.mutators, _.bind(function (mutator, name) {
+ // check if we have some getter mutations
+ if (_.isObject(this.mutators[name]) === true && _.isFunction(this.mutators[name].get)) {
+ json[name] = _.bind(this.mutators[name].get, this)();
+ }
+ else {
+ json[name] = _.bind(this.mutators[name], this)();
+ }
+ }, this));
if (this.has('series')) {
- var start = Date.create(this.get('airDate'));
- var runtime = this.get('series').runtime;
-
- return start.addMinutes(runtime);
+ json.series = this.get('series').toJSON();
}
+ return json;
},
- statusLevel : function () {
- var episodeFileId = this.get('episodeFileId');
- var currentTime = Date.create();
- var start = Date.create(this.get('airDate'));
- var end = Date.create(this.get('end'));
- if (currentTime.isBetween(start, end)) {
- return 'warning';
- }
-
- if (start.isBefore(currentTime) && episodeFileId === 0) {
- return 'danger';
- }
-
- if (status === 'Ready') {
- return 'success';
- }
-
- return 'primary';
- },
- hasAired : function () {
- return Date.create(this.get('airDate')).isBefore(Date.create());
+ defaults: {
+ seasonNumber: 0,
+ status : 0
}
- },
-
-
- parse: function (model) {
- model.series = new NzbDrone.Series.SeriesModel(model.series);
-
- return model;
- },
-
- toJSON: function () {
- var json = _.clone(this.attributes);
-
- _.each(this.mutators, _.bind(function (mutator, name) {
- // check if we have some getter mutations
- if (_.isObject(this.mutators[name]) === true && _.isFunction(this.mutators[name].get)) {
- json[name] = _.bind(this.mutators[name].get, this)();
- } else {
- json[name] = _.bind(this.mutators[name], this)();
- }
- }, this));
-
- if (this.has('series'))
- {
- json.series = this.get('series').toJSON();
- }
- return json;
- },
-
- defaults: {
- seasonNumber: 0,
- status : 0
- }
+ });
});
-
- return NzbDrone.Series.EpisodeModel;
-});
diff --git a/UI/Series/Index/EmptySeriesIndexView.js b/UI/Series/Index/EmptySeriesIndexView.js
index 4a8ef4af8..b222390ab 100644
--- a/UI/Series/Index/EmptySeriesIndexView.js
+++ b/UI/Series/Index/EmptySeriesIndexView.js
@@ -1,8 +1,9 @@
-'use strict';
-define(['app'], function () {
- NzbDrone.Series.Index.EmptySeriesCollectionView = Backbone.Marionette.CompositeView.extend({
- template: 'Series/Index/EmptySeriesIndexTemplate'
+'use strict';
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
+ return Marionette.CompositeView.extend({
+ template: 'Series/Index/EmptySeriesIndexTemplate'
+ });
});
-
- return NzbDrone.Series.Index.EmptySeriesCollectionView;
-});
diff --git a/UI/Series/Index/EmptyView.js b/UI/Series/Index/EmptyView.js
index 53e89166a..ea23a1fbe 100644
--- a/UI/Series/Index/EmptyView.js
+++ b/UI/Series/Index/EmptyView.js
@@ -1,10 +1,11 @@
-'use strict';
+'use strict';
-define(['app'], function () {
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
- NzbDrone.Series.Index.EmptyView = Backbone.Marionette.CompositeView.extend({
- template: 'Series/Index/EmptyTemplate'
+ return Marionette.CompositeView.extend({
+ template: 'Series/Index/EmptyTemplate'
+ });
});
-
- return NzbDrone.Series.Index.EmptyView;
-});
diff --git a/UI/Series/Index/List/CollectionView.js b/UI/Series/Index/List/CollectionView.js
index 2b81ddcf6..33ea36307 100644
--- a/UI/Series/Index/List/CollectionView.js
+++ b/UI/Series/Index/List/CollectionView.js
@@ -1,12 +1,14 @@
-'use strict';
+'use strict';
-define(['app', 'Series/Index/List/ItemView', 'Config'], function () {
+define(
+ [
+ 'marionette',
+ 'Series/Index/List/ItemView'
+ ], function (Marionette, ListItemView) {
- NzbDrone.Series.Index.List.CollectionView = Backbone.Marionette.CompositeView.extend({
- itemView : NzbDrone.Series.Index.List.ItemView,
- itemViewContainer : '#x-series-list',
- template : 'Series/Index/List/CollectionTemplate'
+ return Marionette.CompositeView.extend({
+ itemView : ListItemView,
+ itemViewContainer: '#x-series-list',
+ template : 'Series/Index/List/CollectionTemplate'
+ });
});
-
- return NzbDrone.Series.Index.List.CollectionView;
-});
diff --git a/UI/Series/Index/List/ItemView.js b/UI/Series/Index/List/ItemView.js
index 355e249a5..edad5993d 100644
--- a/UI/Series/Index/List/ItemView.js
+++ b/UI/Series/Index/List/ItemView.js
@@ -1,36 +1,33 @@
-'use strict';
+'use strict';
-define([
- 'app',
- 'Quality/QualityProfileCollection',
- 'Series/SeriesCollection',
- 'Series/Edit/EditSeriesView',
- 'Series/Delete/DeleteSeriesView',
- 'Shared/FormatHelpers'
+define(
+ [
+ 'app',
+ 'marionette',
+ 'Series/Edit/EditSeriesView',
+ 'Series/Delete/DeleteSeriesView'
-], function () {
- NzbDrone.Series.Index.List.ItemView = Backbone.Marionette.ItemView.extend({
- template: 'Series/Index/List/ItemTemplate',
+ ], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
+ return Marionette.ItemView.extend({
+ template: 'Series/Index/List/ItemTemplate',
- ui: {
- 'progressbar': '.progress .bar'
- },
+ ui: {
+ 'progressbar': '.progress .bar'
+ },
- events: {
- 'click .x-edit' : 'editSeries',
- 'click .x-remove': 'removeSeries'
- },
+ events: {
+ 'click .x-edit' : 'editSeries',
+ 'click .x-remove': 'removeSeries'
+ },
- editSeries: function () {
- var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
- NzbDrone.modalRegion.show(view);
- },
+ editSeries: function () {
+ var view = new EditSeriesView({ model: this.model});
+ App.modalRegion.show(view);
+ },
- removeSeries: function () {
- var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
- NzbDrone.modalRegion.show(view);
- }
+ removeSeries: function () {
+ var view = new DeleteSeriesView({ model: this.model });
+ App.modalRegion.show(view);
+ }
+ });
});
-
- return NzbDrone.Series.Index.List.ItemView;
-});
diff --git a/UI/Series/Index/Posters/CollectionView.js b/UI/Series/Index/Posters/CollectionView.js
index b6d188ae4..6ac6e7569 100644
--- a/UI/Series/Index/Posters/CollectionView.js
+++ b/UI/Series/Index/Posters/CollectionView.js
@@ -1,12 +1,14 @@
-'use strict';
+'use strict';
-define(['app', 'Series/Index/Posters/ItemView', 'Config'], function () {
+define(
+ [
+ 'marionette',
+ 'Series/Index/Posters/ItemView'
+ ], function (Marionette, PosterItemView) {
- NzbDrone.Series.Index.Posters.CollectionView = Backbone.Marionette.CompositeView.extend({
- itemView : NzbDrone.Series.Index.Posters.ItemView,
- itemViewContainer : '#x-series-posters',
- template : 'Series/Index/Posters/CollectionTemplate'
+ return Marionette.CompositeView.extend({
+ itemView : PosterItemView,
+ itemViewContainer: '#x-series-posters',
+ template : 'Series/Index/Posters/CollectionTemplate'
+ });
});
-
- return NzbDrone.Series.Index.Posters.CollectionView;
-});
diff --git a/UI/Series/Index/Posters/ItemView.js b/UI/Series/Index/Posters/ItemView.js
index 5369afbf2..153069633 100644
--- a/UI/Series/Index/Posters/ItemView.js
+++ b/UI/Series/Index/Posters/ItemView.js
@@ -1,45 +1,44 @@
-'use strict';
+'use strict';
-define([
- 'app',
- 'Series/SeriesCollection',
- 'Series/Edit/EditSeriesView',
- 'Series/Delete/DeleteSeriesView'
+define(
+ [
+ 'app',
+ 'marionette',
+ 'Series/Edit/EditSeriesView',
+ 'Series/Delete/DeleteSeriesView'
-], function () {
+ ], function (App, Marionette, EditSeriesView, DeleteSeriesView) {
- NzbDrone.Series.Index.Posters.ItemView = Backbone.Marionette.ItemView.extend({
- tagName : 'li',
- template: 'Series/Index/Posters/ItemTemplate',
+ return Marionette.ItemView.extend({
+ tagName : 'li',
+ template: 'Series/Index/Posters/ItemTemplate',
- ui: {
- 'progressbar': '.progress .bar',
- 'controls': '.series-controls'
- },
+ ui: {
+ 'progressbar': '.progress .bar',
+ 'controls' : '.series-controls'
+ },
- events: {
- 'click .x-edit' : 'editSeries',
- 'click .x-remove': 'removeSeries',
- 'mouseenter .x-series-poster': 'posterHoverAction',
- 'mouseleave .x-series-poster': 'posterHoverAction'
- },
+ events: {
+ 'click .x-edit' : 'editSeries',
+ 'click .x-remove' : 'removeSeries',
+ 'mouseenter .x-series-poster': 'posterHoverAction',
+ 'mouseleave .x-series-poster': 'posterHoverAction'
+ },
- editSeries: function () {
- var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
- NzbDrone.modalRegion.show(view);
- },
+ editSeries: function () {
+ var view = new EditSeriesView({ model: this.model});
+ App.modalRegion.show(view);
+ },
- removeSeries: function () {
- var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
- NzbDrone.modalRegion.show(view);
- },
+ removeSeries: function () {
+ var view = new DeleteSeriesView({ model: this.model });
+ App.modalRegion.show(view);
+ },
- posterHoverAction: function () {
- this.ui.controls.slideToggle();
- }
+ posterHoverAction: function () {
+ this.ui.controls.slideToggle();
+ }
+ });
});
-
- return NzbDrone.Series.Index.Posters.ItemView;
-});
diff --git a/UI/Series/Index/SeriesIndexLayout.js b/UI/Series/Index/SeriesIndexLayout.js
index b5e66f04a..9ea6dc157 100644
--- a/UI/Series/Index/SeriesIndexLayout.js
+++ b/UI/Series/Index/SeriesIndexLayout.js
@@ -1,33 +1,22 @@
'use strict';
-define([
- 'app',
- 'Series/Index/List/CollectionView',
- 'Series/Index/Posters/CollectionView',
- 'Series/Index/EmptyView',
- 'Series/SeriesCollection',
- 'Cells/AirDateCell',
- 'Cells/SeriesTitleCell',
- 'Cells/SeriesStatusCell',
- 'Cells/TemplatedCell',
- 'Shared/Toolbar/ToolbarLayout',
- 'Config',
- 'Shared/LoadingView'
-],
- function (
- App,
- ListCollectionView,
- PosterCollectionView,
- EmptyView,
- SeriesCollection,
- AirDateCell,
- SeriesTitleCell,
- SeriesStatusCell,
- TemplatedCell,
- ToolbarLayout,
- Config,
- LoadingView)
- {
- NzbDrone.Series.Index.SeriesIndexLayout = Backbone.Marionette.Layout.extend({
+define(
+ [
+ 'marionette',
+ 'Series/Index/Posters/CollectionView',
+ 'Series/Index/List/CollectionView',
+ 'Series/Index/EmptyView',
+ 'Series/SeriesCollection',
+ 'Cells/AirDateCell',
+ 'Cells/SeriesTitleCell',
+ 'Cells/TemplatedCell',
+ 'Series/Index/Table/SeriesStatusCell',
+ 'Series/Index/Table/Row',
+ 'Shared/Toolbar/ToolbarLayout',
+ 'Config',
+ 'Shared/LoadingView'
+ ], function (Marionette, PosterCollectionView, ListCollectionView, EmptyView, SeriesCollection, AirDateCell, SeriesTitleCell, TemplatedCell, SeriesStatusCell, SeriesIndexRow,
+ ToolbarLayout, Config, LoadingView) {
+ return Marionette.Layout.extend({
template: 'Series/Index/SeriesIndexLayoutTemplate',
regions: {
@@ -35,87 +24,88 @@ define([
toolbar: '#x-toolbar'
},
- columns: [
- {
- name : 'status',
- label: '',
- cell : SeriesStatusCell
- },
- {
- name : 'this',
- label: 'Title',
- cell : SeriesTitleCell
- },
- {
- name : 'seasonCount',
- label: 'Seasons',
- cell : 'integer'
- },
- {
- name : 'quality',
- label: 'Quality',
- cell : 'integer'
- },
- {
- name : 'network',
- label: 'Network',
- cell : 'string'
- },
- {
- name : 'nextAiring',
- label: 'Next Airing',
- cell : AirDateCell
- },
- {
- name : 'this',
- label : 'Episodes',
- sortable: false,
- template: 'Series/EpisodeProgressTemplate',
- cell : TemplatedCell
- },
- {
- name : 'this',
- label : '',
- sortable: false,
- template: 'Series/Index/Table/ControlsColumnTemplate',
- cell : TemplatedCell
- }
- ],
+ columns:
+ [
+ {
+ name : 'status',
+ label: '',
+ cell : SeriesStatusCell
+ },
+ {
+ name : 'this',
+ label: 'Title',
+ cell : SeriesTitleCell
+ },
+ {
+ name : 'seasonCount',
+ label: 'Seasons',
+ cell : 'integer'
+ },
+ {
+ name : 'quality',
+ label: 'Quality',
+ cell : 'integer'
+ },
+ {
+ name : 'network',
+ label: 'Network',
+ cell : 'string'
+ },
+ {
+ name : 'nextAiring',
+ label: 'Next Airing',
+ cell : AirDateCell
+ },
+ {
+ name : 'this',
+ label : 'Episodes',
+ sortable: false,
+ template: 'Series/EpisodeProgressTemplate',
+ cell : TemplatedCell
+ },
+ {
+ name : 'this',
+ label : '',
+ sortable: false,
+ template: 'Series/Index/Table/ControlsColumnTemplate',
+ cell : TemplatedCell
+ }
+ ],
leftSideButtons: {
type : 'default',
storeState: false,
- items : [
- {
- title: 'Add Series',
- icon : 'icon-plus',
- route: 'series/add'
- },
- {
- title : 'RSS Sync',
- icon : 'icon-rss',
- command : 'rsssync',
- successMessage: 'RSS Sync Completed',
- errorMessage : 'RSS Sync Failed!'
- },
- {
- title : 'Update Library',
- icon : 'icon-refresh',
- command : 'refreshseries',
- successMessage: 'Library was updated!',
- errorMessage : 'Library update failed!'
- }
- ]
+ items :
+ [
+ {
+ title: 'Add Series',
+ icon : 'icon-plus',
+ route: 'series/add'
+ },
+ {
+ title : 'RSS Sync',
+ icon : 'icon-rss',
+ command : 'rsssync',
+ successMessage: 'RSS Sync Completed',
+ errorMessage : 'RSS Sync Failed!'
+ },
+ {
+ title : 'Update Library',
+ icon : 'icon-refresh',
+ command : 'refreshseries',
+ successMessage: 'Library was updated!',
+ errorMessage : 'Library update failed!'
+ }
+ ]
},
_showTable: function () {
- var view = new Backgrid.Grid(
- {
- row : NzbDrone.Series.Index.Table.Row,
- columns : this.columns,
- collection: this.seriesCollection,
- className : 'table table-hover'
- });
+ var view = new Backgrid.Grid({
+ row : SeriesIndexRow,
+ columns : this.columns,
+ collection: this.seriesCollection,
+ className : 'table table-hover'
+ });
this._fetchCollection(view);
},
@@ -140,16 +130,15 @@ define([
if (this.seriesCollection.models.length === 0) {
this.series.show(new LoadingView());
- this.seriesCollection.fetch()
- .done(function () {
- if (self.seriesCollection.models.length === 0) {
- self._showEmpty();
- }
- else {
- view.collection = self.seriesCollection;
- self.series.show(view);
- }
- });
+ this.seriesCollection.fetch().done(function () {
+ if (self.seriesCollection.models.length === 0) {
+ self._showEmpty();
+ }
+ else {
+ view.collection = self.seriesCollection;
+ self.series.show(view);
+ }
+ });
}
else {
@@ -170,35 +159,40 @@ define([
storeState : true,
menuKey : 'seriesViewMode',
defaultAction: 'listView',
- items : [
- {
- key : 'tableView',
- title : '',
- icon : 'icon-table',
- callback: this._showTable
- },
- {
- key : 'listView',
- title : '',
- icon : 'icon-list',
- callback: this._showList
- },
- {
- key : 'posterView',
- title : '',
- icon : 'icon-picture',
- callback: this._showPosters
- }
- ]
+ items :
+ [
+ {
+ key : 'tableView',
+ title : '',
+ icon : 'icon-table',
+ callback: this._showTable
+ },
+ {
+ key : 'listView',
+ title : '',
+ icon : 'icon-list',
+ callback: this._showList
+ },
+ {
+ key : 'posterView',
+ title : '',
+ icon : 'icon-picture',
+ callback: this._showPosters
+ }
+ ]
};
this.toolbar.show(new ToolbarLayout({
- right : [ viewButtons],
- left : [ this.leftSideButtons],
+ right :
+ [
+ viewButtons
+ ],
+ left :
+ [
+ this.leftSideButtons
+ ],
context: this
}));
}
});
-
- return NzbDrone.Series.Index.SeriesIndexLayou;
});
diff --git a/UI/Series/Index/Table/Row.js b/UI/Series/Index/Table/Row.js
index d13497549..3ab05e994 100644
--- a/UI/Series/Index/Table/Row.js
+++ b/UI/Series/Index/Table/Row.js
@@ -1,22 +1,26 @@
'use strict';
-define(['app','backgrid'], function () {
- NzbDrone.Series.Index.Table.Row = Backgrid.Row.extend({
- events: {
- 'click .x-edit' : 'editSeries',
- 'click .x-remove': 'removeSeries'
- },
+define(
+ [
+ 'app',
+ 'backgrid',
+ 'Series/Edit/EditSeriesView',
+ 'Series/Delete/DeleteSeriesView'
+ ], function (App, Backgrid, EditSeriesView, DeleteSeriesView) {
+ return Backgrid.Row.extend({
+ events: {
+ 'click .x-edit' : 'editSeries',
+ 'click .x-remove': 'removeSeries'
+ },
- editSeries: function () {
- var view = new NzbDrone.Series.Edit.EditSeriesView({ model: this.model});
- NzbDrone.modalRegion.show(view);
- },
+ editSeries: function () {
+ var view = new EditSeriesView({ model: this.model});
+ App.modalRegion.show(view);
+ },
- removeSeries: function () {
- var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
- NzbDrone.modalRegion.show(view);
- }
+ removeSeries: function () {
+ var view = new DeleteSeriesView({ model: this.model });
+ App.modalRegion.show(view);
+ }
+ });
});
- return NzbDrone.Series.Table.Row;
-});
-
diff --git a/UI/Series/Index/Table/SeriesStatusCell.js b/UI/Series/Index/Table/SeriesStatusCell.js
new file mode 100644
index 000000000..f20ec2dc3
--- /dev/null
+++ b/UI/Series/Index/Table/SeriesStatusCell.js
@@ -0,0 +1,28 @@
+'use strict';
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ return Backgrid.Cell.extend({
+ className: 'series-status-cell',
+
+ render: function () {
+ this.$el.empty();
+ var monitored = this.model.get('monitored');
+ var status = this.model.get('status');
+
+ if (!monitored) {
+ this.$el.html('
');
+ }
+ else if (status === 'continuing') {
+ this.$el.html('
');
+ }
+
+ else {
+ this.$el.html('
');
+ }
+
+ return this;
+ }
+ });
+ });
diff --git a/UI/Series/SeasonCollection.js b/UI/Series/SeasonCollection.js
index 8b2db0450..a1abbc898 100644
--- a/UI/Series/SeasonCollection.js
+++ b/UI/Series/SeasonCollection.js
@@ -1,23 +1,24 @@
-'use strict';
-define(['app', 'Series/SeasonModel', 'backbone.pageable'], function (App, SeasonModel, PageAbleCollection) {
- NzbDrone.Series.SeasonCollection = PageAbleCollection.extend({
- url : NzbDrone.Constants.ApiRoot + '/season',
- model: NzbDrone.Series.SeasonModel,
+'use strict';
+define(
+ [
+ 'Series/SeasonModel',
+ 'backbone.pageable'
+ ], function (SeasonModel, PageAbleCollection) {
+ return PageAbleCollection.extend({
+ url : window.ApiRoot + '/season',
+ model: SeasonModel,
- mode: 'client',
+ mode: 'client',
- state: {
- sortKey : 'seasonNumber',
- order : 1,
- pageSize: 1000000
- },
+ state: {
+ sortKey : 'seasonNumber',
+ order : 1,
+ pageSize: 1000000
+ },
- queryParams: {
- sortKey: null,
- order : null
- }
+ queryParams: {
+ sortKey: null,
+ order : null
+ }
+ });
});
-
-
- return NzbDrone.Series.SeasonCollection;
-});
diff --git a/UI/Series/SeasonModel.js b/UI/Series/SeasonModel.js
index c52da83f9..d47d268bb 100644
--- a/UI/Series/SeasonModel.js
+++ b/UI/Series/SeasonModel.js
@@ -1,24 +1,25 @@
-'use strict';
-define(['app'], function () {
- NzbDrone.Series.SeasonModel = Backbone.Model.extend({
+'use strict';
+define(
+ [
+ 'backbone'
+ ], function (Backbone) {
+ return Backbone.Model.extend({
- mutators: {
- seasonTitle: function () {
- var seasonNumber = this.get('seasonNumber');
+ mutators: {
+ seasonTitle: function () {
+ var seasonNumber = this.get('seasonNumber');
- if (seasonNumber === 0) {
- return 'Specials';
+ if (seasonNumber === 0) {
+ return 'Specials';
+ }
+
+ return 'Season ' + seasonNumber;
}
+ },
- return 'Season ' + seasonNumber;
+ defaults: {
+ seasonNumber: 0
}
- },
-
- defaults: {
- seasonNumber: 0
- }
+ });
});
- return NzbDrone.Series.SeasonModel;
-});
-
diff --git a/UI/Series/SeriesCollection.js b/UI/Series/SeriesCollection.js
index de8d15014..1b91a429f 100644
--- a/UI/Series/SeriesCollection.js
+++ b/UI/Series/SeriesCollection.js
@@ -1,18 +1,20 @@
-'use strict';
-define(['app', 'Series/SeriesModel'], function () {
- NzbDrone.Series.SeriesCollection = Backbone.Collection.extend({
- url : NzbDrone.Constants.ApiRoot + '/series',
- model: NzbDrone.Series.SeriesModel,
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Series/SeriesModel'
+ ], function (Backbone, SeriesModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/series',
+ model: SeriesModel,
- comparator: function(model) {
- return model.get('title');
- },
+ comparator: function (model) {
+ return model.get('title');
+ },
- state: {
- sortKey: 'title',
- order: -1
- }
+ state: {
+ sortKey: 'title',
+ order : -1
+ }
+ });
});
-
- return NzbDrone.Series.SeriesCollection;
-});
diff --git a/UI/Series/SeriesModel.js b/UI/Series/SeriesModel.js
index 5830f966b..bca7a296a 100644
--- a/UI/Series/SeriesModel.js
+++ b/UI/Series/SeriesModel.js
@@ -1,87 +1,88 @@
-'use strict';
-define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfiles) {
- NzbDrone.Series.SeriesModel = Backbone.Model.extend({
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Quality/QualityProfileCollection',
+ ], function (Backbone, QualityProfileCollection) {
+ return Backbone.Model.extend({
- urlRoot: NzbDrone.Constants.ApiRoot + '/series',
+ urlRoot: Constants.ApiRoot + '/series',
- mutators: {
- percentOfEpisodes: function () {
- var episodeCount = this.get('episodeCount');
- var episodeFileCount = this.get('episodeFileCount');
+ mutators: {
+ percentOfEpisodes: function () {
+ var episodeCount = this.get('episodeCount');
+ var episodeFileCount = this.get('episodeFileCount');
- var percent = 100;
+ var percent = 100;
- if (episodeCount > 0) {
- percent = episodeFileCount / episodeCount * 100;
+ if (episodeCount > 0) {
+ percent = episodeFileCount / episodeCount * 100;
+ }
+
+ return percent;
+ },
+ poster : function () {
+ var poster = _.find(this.get('images'), function (image) {
+ return image.coverType === 'poster';
+ });
+
+ if (poster) {
+ return poster.url;
+ }
+
+ return undefined;
+ },
+ fanArt : function () {
+ var poster = _.find(this.get('images'), function (image) {
+ return image.coverType === 'fanart';
+ });
+
+ if (poster) {
+ return poster.url;
+ }
+
+ return undefined;
+ },
+ traktUrl : function () {
+ return 'http://trakt.tv/show/' + this.get('titleSlug');
+ },
+ imdbUrl : function () {
+ return 'http://imdb.com/title/' + this.get('imdbId');
+ },
+ isContinuing : function () {
+ return this.get('status') === 'continuing';
+ },
+ shortDate : function () {
+ var date = this.get('nextAiring');
+
+ if (!date) {
+ return '';
+ }
+
+ return Date.create(date).short();
+ },
+ route : function () {
+ return '/series/details/' + this.get('titleSlug');
+ //return '/series/details/' + this.get('id');
+ },
+
+ qualityProfile: function () {
+
+ var profile = QualityProfileCollection.get(this.get('qualityProfileId'));
+
+ if (profile) {
+ return profile.toJSON();
+ }
+
+ return undefined;
}
-
- return percent;
- },
- poster : function () {
- var poster = _.find(this.get('images'), function (image) {
- return image.coverType === 'poster';
- });
-
- if (poster) {
- return poster.url;
- }
-
- return undefined;
- },
- fanArt : function () {
- var poster = _.find(this.get('images'), function (image) {
- return image.coverType === 'fanart';
- });
-
- if (poster) {
- return poster.url;
- }
-
- return undefined;
- },
- traktUrl : function () {
- return 'http://trakt.tv/show/' + this.get('titleSlug');
- },
- imdbUrl : function () {
- return 'http://imdb.com/title/' + this.get('imdbId');
- },
- isContinuing : function () {
- return this.get('status') === 'continuing';
- },
- shortDate : function () {
- var date = this.get('nextAiring');
-
- if (!date) {
- return '';
- }
-
- return Date.create(date).short();
- },
- route : function () {
- return '/series/details/' + this.get('titleSlug');
- //return '/series/details/' + this.get('id');
},
- qualityProfile: function () {
-
- var profile = qualityProfiles.get(this.get('qualityProfileId'));
-
- if (profile) {
- return profile.toJSON();
- }
-
- return undefined;
+ defaults: {
+ episodeFileCount: 0,
+ episodeCount : 0,
+ isExisting : false,
+ status : 0
}
- },
-
- defaults: {
- episodeFileCount: 0,
- episodeCount : 0,
- isExisting : false,
- status : 0
- }
+ });
});
-
- return NzbDrone.Series.SeriesModel;
-
-});
diff --git a/UI/ServerStatus.js b/UI/ServerStatus.js
index 2504dcd04..a2605648d 100644
--- a/UI/ServerStatus.js
+++ b/UI/ServerStatus.js
@@ -1,6 +1,8 @@
+window.ApiRoot = '/api';
+
var statusText = $.ajax({
type : 'GET',
- url : '/api/system/status',
+ url : window.ApiRoot + '/system/status',
async: false
}).responseText;
diff --git a/UI/Settings/DownloadClient/DownloadClientView.js b/UI/Settings/DownloadClient/DownloadClientView.js
index 358d4b97d..fa2f4ef31 100644
--- a/UI/Settings/DownloadClient/DownloadClientView.js
+++ b/UI/Settings/DownloadClient/DownloadClientView.js
@@ -1,79 +1,81 @@
-'use strict';
+'use strict';
-define([
- 'app', 'marionette', 'Mixins/AsModelBoundView', 'bootstrap'
+define(
+ [
+ 'marionette',
+ 'Mixins/AsModelBoundView',
+ 'bootstrap'
+ ], function (Marionette, AsModelBoundView) {
-], function (App, Marionette, AsModelBoundView) {
+ var view = Marionette.ItemView.extend({
+ template : 'Settings/DownloadClient/DownloadClientTemplate',
+ className: 'form-horizontal',
- var view = Marionette.ItemView.extend({
- template : 'Settings/DownloadClient/DownloadClientTemplate',
- className: 'form-horizontal',
+ ui: {
+ bsSwitch : '.switch',
+ tooltip : '.help-inline i',
+ pathInput : '.x-path',
+ sabConfig : '.x-sab-config',
+ blackholeConfig : '.x-blackhole-config',
+ pneumaticConfig : '.x-pneumatic-config',
+ nzbGetConfig : '.x-nzbget-config',
+ downloadClientSelect: '.x-download-client'
+ },
- ui: {
- bsSwitch : '.switch',
- tooltip : '.help-inline i',
- pathInput : '.x-path',
- sabConfig : '.x-sab-config',
- blackholeConfig : '.x-blackhole-config',
- pneumaticConfig : '.x-pneumatic-config',
- nzbGetConfig : '.x-nzbget-config',
- downloadClientSelect: '.x-download-client'
- },
+ events: {
+ 'change .x-download-client': 'downloadClientChanged'
+ },
- events: {
- 'change .x-download-client': 'downloadClientChanged'
- },
+ onRender: function () {
+ this.ui.pathInput.autoComplete('/directories');
+ this.refreshUIVisibility(this.model.get('downloadClient'));
+ },
- onRender: function () {
- this.ui.pathInput.autoComplete('/directories');
- this.refreshUIVisibility(this.model.get('downloadClient'));
- },
+ downloadClientChanged: function () {
+ var clientId = this.ui.downloadClientSelect.val();
+ this.refreshUIVisibility(clientId);
+ },
- downloadClientChanged: function () {
- var clientId = this.ui.downloadClientSelect.val();
- this.refreshUIVisibility(clientId);
- },
+ refreshUIVisibility: function (clientId) {
- refreshUIVisibility: function (clientId) {
+ if (!clientId) {
+ clientId = 'sabnzbd';
+ }
- if (!clientId) {
- clientId = 'sabnzbd';
+ switch (clientId.toString()) {
+ case 'sabnzbd':
+ this.ui.sabConfig.show();
+ this.ui.blackholeConfig.hide();
+ this.ui.pneumaticConfig.hide();
+ this.ui.nzbGetConfig.hide();
+ break;
+
+ case 'blackhole':
+ this.ui.sabConfig.hide();
+ this.ui.blackholeConfig.show();
+ this.ui.pneumaticConfig.hide();
+ this.ui.nzbGetConfig.hide();
+ break;
+
+ case 'pneumatic':
+ this.ui.sabConfig.hide();
+ this.ui.blackholeConfig.hide();
+ this.ui.pneumaticConfig.show();
+ this.ui.nzbGetConfig.hide();
+ break;
+
+ case 'nzbget':
+ this.ui.sabConfig.hide();
+ this.ui.blackholeConfig.hide();
+ this.ui.pneumaticConfig.hide();
+ this.ui.nzbGetConfig.show();
+ break;
+
+ default :
+ throw 'unknown download client id' + clientId;
+ }
}
+ });
- switch (clientId.toString()) {
- case 'sabnzbd':
- this.ui.sabConfig.show();
- this.ui.blackholeConfig.hide();
- this.ui.pneumaticConfig.hide();
- this.ui.nzbGetConfig.hide();
- break;
-
- case 'blackhole':
- this.ui.sabConfig.hide();
- this.ui.blackholeConfig.show();
- this.ui.pneumaticConfig.hide();
- this.ui.nzbGetConfig.hide();
- break;
-
- case 'pneumatic':
- this.ui.sabConfig.hide();
- this.ui.blackholeConfig.hide();
- this.ui.pneumaticConfig.show();
- this.ui.nzbGetConfig.hide();
- break;
-
- case 'nzbget':
- this.ui.sabConfig.hide();
- this.ui.blackholeConfig.hide();
- this.ui.pneumaticConfig.hide();
- this.ui.nzbGetConfig.show();
- break;
-
- default :
- throw 'unknown download client id' + clientId;
- }
- }
+ return AsModelBoundView.call(view);
});
-
- return AsModelBoundView.call(view);
-});
diff --git a/UI/Settings/General/GeneralSettingsModel.js b/UI/Settings/General/GeneralSettingsModel.js
index e748f5d5a..00b03f68b 100644
--- a/UI/Settings/General/GeneralSettingsModel.js
+++ b/UI/Settings/General/GeneralSettingsModel.js
@@ -1,19 +1,23 @@
-'use strict';
-define(['app', 'backbone', 'Mixins/AsChangeTrackingModel'], function (App, Backbone, AsChangeTrackingModel) {
- var model = Backbone.Model.extend({
+'use strict';
+define(
+ [
+ 'backbone',
+ 'Mixins/AsChangeTrackingModel'
+ ], function (Backbone, AsChangeTrackingModel) {
+ var model = Backbone.Model.extend({
- url: App.Constants.ApiRoot + '/settings/host',
+ url: window.ApiRoot + '/settings/host',
- initialize: function () {
- this.on('change', function () {
- this.isSaved = false;
- }, this);
+ initialize: function () {
+ this.on('change', function () {
+ this.isSaved = false;
+ }, this);
- this.on('sync', function () {
- this.isSaved = true;
- }, this);
- }
+ this.on('sync', function () {
+ this.isSaved = true;
+ }, this);
+ }
+ });
+
+ return AsChangeTrackingModel.call(model);
});
-
- return AsChangeTrackingModel.call(model);
-});
diff --git a/UI/Settings/Indexers/Collection.js b/UI/Settings/Indexers/Collection.js
index f2da2c061..21f459785 100644
--- a/UI/Settings/Indexers/Collection.js
+++ b/UI/Settings/Indexers/Collection.js
@@ -1,7 +1,10 @@
-'use strict';
-define(['app', 'Settings/Indexers/Model'], function (App, IndexerModel) {
- return Backbone.Collection.extend({
- url : App.Constants.ApiRoot + '/indexer',
- model: IndexerModel
+'use strict';
+define(
+ [
+ 'Settings/Indexers/Model'
+ ], function (IndexerModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/indexer',
+ model: IndexerModel
+ });
});
-});
diff --git a/UI/Settings/Indexers/EditView.js b/UI/Settings/Indexers/EditView.js
index 9332c3e19..d7b87a78d 100644
--- a/UI/Settings/Indexers/EditView.js
+++ b/UI/Settings/Indexers/EditView.js
@@ -1,26 +1,26 @@
-'use strict';
+'use strict';
-define([
- 'app',
- 'marionette',
- 'Mixins/AsModelBoundView'
-], function (App, Marionette, AsModelBoundView) {
+define(
+ [
+ 'marionette',
+ 'Mixins/AsModelBoundView'
+ ], function (Marionette, AsModelBoundView) {
- var view = Marionette.ItemView.extend({
- template: 'Settings/Indexers/EditTemplate',
+ var view = Marionette.ItemView.extend({
+ template: 'Settings/Indexers/EditTemplate',
- events: {
- 'click .x-save': 'save'
- },
+ events: {
+ 'click .x-save': 'save'
+ },
- initialize: function (options) {
- this.indexerCollection = options.indexerCollection;
- },
+ initialize: function (options) {
+ this.indexerCollection = options.indexerCollection;
+ },
- save: function () {
- this.model.saveSettings();
- }
+ save: function () {
+ this.model.saveSettings();
+ }
+ });
+
+ return AsModelBoundView.call(view);
});
-
- return AsModelBoundView.call(view);
-});
diff --git a/UI/Settings/Naming/NamingModel.js b/UI/Settings/Naming/NamingModel.js
index a892f0522..23c77e24b 100644
--- a/UI/Settings/Naming/NamingModel.js
+++ b/UI/Settings/Naming/NamingModel.js
@@ -1,10 +1,12 @@
-'use strict';
-define(['app',
- 'Settings/SettingsModelBase'], function (App, ModelBase) {
- return ModelBase.extend({
- url : App.Constants.ApiRoot + '/config/naming',
- successMessage: 'Naming settings saved',
- errorMessage : 'Couldn\'t save naming settings'
- });
+'use strict';
+define(
+ [
+ 'Settings/SettingsModelBase'
+ ], function (ModelBase) {
+ return ModelBase.extend({
+ url : window.ApiRoot + '/config/naming',
+ successMessage: 'Naming settings saved',
+ errorMessage : 'Couldn\'t save naming settings'
+ });
-});
+ });
diff --git a/UI/Settings/Naming/NamingView.js b/UI/Settings/Naming/NamingView.js
index a360f5869..cf3f4acff 100644
--- a/UI/Settings/Naming/NamingView.js
+++ b/UI/Settings/Naming/NamingView.js
@@ -1,18 +1,20 @@
-'use strict';
-define(['app',
- 'marionette',
- 'Settings/Naming/NamingModel',
- 'Mixins/AsModelBoundView'], function (App, Marionette, NamingModel, AsModelBoundView) {
+'use strict';
+define(
+ [
+ 'marionette',
+ 'Settings/Naming/NamingModel',
+ 'Mixins/AsModelBoundView'
+ ], function (Marionette, NamingModel, AsModelBoundView) {
- var view = Marionette.ItemView.extend({
- template: 'Settings/Naming/NamingTemplate',
+ var view = Marionette.ItemView.extend({
+ template: 'Settings/Naming/NamingTemplate',
- initialize: function () {
- this.model = new NamingModel();
- this.model.fetch();
- }
+ initialize: function () {
+ this.model = new NamingModel();
+ this.model.fetch();
+ }
+ });
+
+ return AsModelBoundView.call(view);
});
-
- return AsModelBoundView.call(view);
-});
diff --git a/UI/Settings/Notifications/Collection.js b/UI/Settings/Notifications/Collection.js
index daf20a9a7..a8dd48449 100644
--- a/UI/Settings/Notifications/Collection.js
+++ b/UI/Settings/Notifications/Collection.js
@@ -1,7 +1,10 @@
-'use strict';
-define(['app', 'Settings/Notifications/Model'], function (App, NotificationModel) {
- return Backbone.Collection.extend({
- url : App.Constants.ApiRoot + '/notification',
- model: NotificationModel
+'use strict';
+define(
+ [
+ 'Settings/Notifications/Model'
+ ], function (NotificationModel) {
+ return Backbone.Collection.extend({
+ url : window.ApiRoot + '/notification',
+ model: NotificationModel
+ });
});
-});
diff --git a/UI/Settings/Notifications/Model.js b/UI/Settings/Notifications/Model.js
index 77f791ee0..be52ad81c 100644
--- a/UI/Settings/Notifications/Model.js
+++ b/UI/Settings/Notifications/Model.js
@@ -1,5 +1,8 @@
-'use strict';
-define(['app', 'backbone.deepmodel'], function (App, DeepModel) {
- return DeepModel.DeepModel.extend({
+'use strict';
+define(
+ [
+ 'backbone.deepmodel'
+ ], function (DeepModel) {
+ return DeepModel.DeepModel.extend({
+ });
});
-});
diff --git a/UI/Settings/Quality/Profile/DeleteTemplate.html b/UI/Settings/Quality/Profile/DeleteTemplate.html
new file mode 100644
index 000000000..d6e0f61e2
--- /dev/null
+++ b/UI/Settings/Quality/Profile/DeleteTemplate.html
@@ -0,0 +1,11 @@
+
+
+
Are you sure you want to delete '{{name}}'?
+
+
diff --git a/UI/Settings/Quality/Profile/DeleteView.js b/UI/Settings/Quality/Profile/DeleteView.js
new file mode 100644
index 000000000..dd9671d13
--- /dev/null
+++ b/UI/Settings/Quality/Profile/DeleteView.js
@@ -0,0 +1,24 @@
+'use strict';
+define(
+ [
+ 'app',
+ 'marionette'
+ ], function (App, Marionette) {
+
+ return Marionette.ItemView.extend({
+ template: 'Quality/Profile/DeleteTemplate',
+
+ events: {
+ 'click .x-confirm-delete': '_removeProfile'
+ },
+
+ _removeProfile: function () {
+
+ this.model.destroy({
+ wait: true
+ }).done(function () {
+ App.modalRegion.close();
+ });
+ }
+ });
+ });
diff --git a/UI/Settings/Quality/Profile/QualityProfileView.js b/UI/Settings/Quality/Profile/QualityProfileView.js
index 74a795f33..bd4d79db6 100644
--- a/UI/Settings/Quality/Profile/QualityProfileView.js
+++ b/UI/Settings/Quality/Profile/QualityProfileView.js
@@ -1,35 +1,40 @@
-'use strict';
+
+'use strict';
-define([
- 'app',
- 'marionette',
- 'Settings/Quality/Profile/EditQualityProfileView',
- 'Mixins/AsModelBoundView'
-], function (App, Marionette, EditProfileView, AsModelBoundView) {
+define(
+ [
+ 'app',
+ 'marionette',
+ 'Settings/Quality/Profile/EditQualityProfileView',
+ 'Settings/Quality/Profile/DeleteView',
+ 'Mixins/AsModelBoundView'
- var view = Marionette.ItemView.extend({
- template: 'Settings/Quality/Profile/QualityProfileTemplate',
- tagName : 'tr',
+ ], function (App, Marionette, EditProfileView, DeleteProfileView, AsModelBoundView) {
- ui: {
- 'progressbar': '.progress .bar'
- },
+ var view = Marionette.ItemView.extend({
+ template: 'Settings/Quality/Profile/QualityProfileTemplate',
+ tagName : 'tr',
- events: {
- 'click .x-edit' : 'edit',
- 'click .x-remove': 'removeQuality'
- },
+ ui: {
+ 'progressbar': '.progress .bar'
+ },
- edit: function () {
- var view = new EditProfileView({ model: this.model});
- App.modalRegion.show(view);
- },
+ events: {
+ 'click .x-edit' : 'edit',
+ 'click .x-remove': 'removeQuality'
+ },
- removeQuality: function () {
- var view = new NzbDrone.Series.Delete.DeleteSeriesView({ model: this.model });
- NzbDrone.modalRegion.show(view);
- }
+ edit: function () {
+ var view = new EditProfileView({ model: this.model});
+ App.modalRegion.show(view);
+ },
+
+ removeQuality: function () {
+ var view = new DeleteProfileView({ model: this.model });
+ App.modalRegion.show(view);
+ }
+ });
+
+
+ return AsModelBoundView.call(view);
});
-
- return AsModelBoundView.call(view);
-});
diff --git a/UI/Settings/Quality/QualityLayout.js b/UI/Settings/Quality/QualityLayout.js
index 03942df51..f58f9d7ba 100644
--- a/UI/Settings/Quality/QualityLayout.js
+++ b/UI/Settings/Quality/QualityLayout.js
@@ -1,13 +1,12 @@
-'use strict';
-define([
- 'app',
- 'marionette',
- 'Quality/QualityProfileCollection',
- 'Settings/Quality/Profile/QualityProfileCollectionView',
- 'Quality/QualitySizeCollection',
- 'Settings/Quality/Size/QualitySizeCollectionView'
-],
- function (App, Marionette, QualityProfileCollection, QualityProfileCollectionView, QualitySizeCollection, QualitySizeCollectionView) {
+'use strict';
+define(
+ [
+ 'marionette',
+ 'Quality/QualityProfileCollection',
+ 'Settings/Quality/Profile/QualityProfileCollectionView',
+ 'Quality/QualitySizeCollection',
+ 'Settings/Quality/Size/QualitySizeCollectionView'
+ ], function (Marionette, QualityProfileCollection, QualityProfileCollectionView, QualitySizeCollection, QualitySizeCollectionView) {
return Marionette.Layout.extend({
template: 'Settings/Quality/QualityLayoutTemplate',
diff --git a/UI/Settings/SettingsLayout.js b/UI/Settings/SettingsLayout.js
index 994670199..ca4e544df 100644
--- a/UI/Settings/SettingsLayout.js
+++ b/UI/Settings/SettingsLayout.js
@@ -1,21 +1,22 @@
-'use strict';
-define([
- 'app',
- 'marionette',
- 'Settings/SettingsModel',
- 'Settings/General/GeneralSettingsModel',
- 'Settings/Naming/NamingView',
- 'Settings/Naming/NamingModel',
- 'Settings/Quality/QualityLayout',
- 'Settings/Indexers/CollectionView',
- 'Settings/Indexers/Collection',
- 'Settings/DownloadClient/DownloadClientView',
- 'Settings/Notifications/CollectionView',
- 'Settings/Notifications/Collection',
- 'Settings/General/GeneralView',
- 'Settings/Misc/MiscView'
-],
- function (App, Marionette, SettingsModel, GeneralSettingsModel, NamingView, NamingModel, QualityLayout, IndexerCollectionView, IndexerCollection, DownloadClientView, NotificationCollectionView, NotificationCollection, GeneralView, MiscView) {
+'use strict';
+define(
+ [
+ 'app',
+ 'marionette',
+ 'Settings/SettingsModel',
+ 'Settings/General/GeneralSettingsModel',
+ 'Settings/Naming/NamingModel',
+ 'Settings/Naming/NamingView',
+ 'Settings/Quality/QualityLayout',
+ 'Settings/Indexers/CollectionView',
+ 'Settings/Indexers/Collection',
+ 'Settings/DownloadClient/DownloadClientView',
+ 'Settings/Notifications/CollectionView',
+ 'Settings/Notifications/Collection',
+ 'Settings/General/GeneralView',
+ 'Settings/Misc/MiscView'
+ ], function (App, Marionette, SettingsModel, GeneralSettingsModel,NamingModel, NamingView, QualityLayout, IndexerCollectionView, IndexerCollection, DownloadClientView,
+ NotificationCollectionView, NotificationCollection, GeneralView, MiscView) {
return Marionette.Layout.extend({
template: 'Settings/SettingsLayoutTemplate',
@@ -56,7 +57,7 @@ define([
}
this.ui.namingTab.tab('show');
- App.Router.navigate('settings/naming');
+ this._navigate('settings/naming');
},
showQuality: function (e) {
@@ -65,7 +66,7 @@ define([
}
this.ui.qualityTab.tab('show');
- App.Router.navigate('settings/quality');
+ this._navigate('settings/quality');
},
showIndexers: function (e) {
@@ -74,7 +75,7 @@ define([
}
this.ui.indexersTab.tab('show');
- App.Router.navigate('settings/indexers');
+ this._navigate('settings/indexers');
},
showDownloadClient: function (e) {
@@ -83,7 +84,7 @@ define([
}
this.ui.downloadClientTab.tab('show');
- App.Router.navigate('settings/downloadclient');
+ this._navigate('settings/downloadclient');
},
showNotifications: function (e) {
@@ -92,7 +93,7 @@ define([
}
this.ui.notificationsTab.tab('show');
- App.Router.navigate('settings/notifications');
+ this._navigate('settings/notifications');
},
showGeneral: function (e) {
@@ -101,7 +102,7 @@ define([
}
this.ui.generalTab.tab('show');
- App.Router.navigate('settings/general');
+ this._navigate('settings/general');
},
showMisc: function (e) {
@@ -110,7 +111,13 @@ define([
}
this.ui.miscTab.tab('show');
- App.Router.navigate('settings/misc');
+ this._navigate('settings/misc');
+ },
+
+ _navigate:function(route){
+ require(['Router'], function(){
+ App.Router.navigate(route);
+ });
},
initialize: function (options) {
diff --git a/UI/Settings/SettingsModel.js b/UI/Settings/SettingsModel.js
index e93127d20..4e0c142ec 100644
--- a/UI/Settings/SettingsModel.js
+++ b/UI/Settings/SettingsModel.js
@@ -1,8 +1,8 @@
-'use strict';
+'use strict';
define(['app',
'Settings/SettingsModelBase'], function (App, SettingsModelBase) {
return SettingsModelBase.extend({
- url : App.Constants.ApiRoot + '/settings',
+ url : window.ApiRoot + '/settings',
successMessage: 'Settings saved',
errorMessage : 'Failed to save settings'
});
diff --git a/UI/Shared/FormatHelpers.js b/UI/Shared/FormatHelpers.js
index a6d910bbf..1c14f8e87 100644
--- a/UI/Shared/FormatHelpers.js
+++ b/UI/Shared/FormatHelpers.js
@@ -1,37 +1,38 @@
'use strict';
-define(['app'], function () {
- NzbDrone.Shared.FormatHelpers.FileSizeHelper = function (sourceSize) {
- var size = Number(sourceSize);
- return size.bytes(1);
- };
+define(
+ [
+ 'sugar'
+ ], {
+ FileSizeHelper: function (sourceSize) {
+ var size = Number(sourceSize);
+ return size.bytes(1);
+ },
- NzbDrone.Shared.FormatHelpers.DateHelper = function (sourceDate) {
- if (!sourceDate) {
- return '';
- }
+ DateHelper: function (sourceDate) {
+ if (!sourceDate) {
+ return '';
+ }
- var date = Date.create(sourceDate);
+ var date = Date.create(sourceDate);
- if (date.isYesterday()) {
- return 'Yesterday';
- }
- if (date.isToday()) {
- return 'Today';
- }
- if (date.isTomorrow()) {
- return 'Tomorrow';
- }
- if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
- return date.format('{Weekday}');
- }
+ if (date.isYesterday()) {
+ return 'Yesterday';
+ }
+ if (date.isToday()) {
+ return 'Today';
+ }
+ if (date.isTomorrow()) {
+ return 'Tomorrow';
+ }
+ if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) {
+ return date.format('{Weekday}');
+ }
- if (date.isAfter(Date.create().addDays(6))) {
- return date.relative().replace(' from now', '');
+ if (date.isAfter(Date.create().addDays(6))) {
+ return date.relative().replace(' from now', '');
+ }
+
+ return date.format('{MM}/{dd}/{yyyy}');
}
-
- return date.format('{MM}/{dd}/{yyyy}');
- };
-
- return NzbDrone.Shared.FormatHelpers;
-});
+ });
diff --git a/UI/Shared/Grid/HeaderCell.js b/UI/Shared/Grid/HeaderCell.js
index 7c4c3d923..33dcbf857 100644
--- a/UI/Shared/Grid/HeaderCell.js
+++ b/UI/Shared/Grid/HeaderCell.js
@@ -1,100 +1,102 @@
'use strict';
-define(['app','backgrid'], function () {
+define(
+ [
+ 'backgrid'
+ ], function (Backgrid) {
+ Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({
+ events: {
+ 'click': 'onClick'
+ },
- Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({
- events: {
- 'click': 'onClick'
- },
+ render: function () {
+ this.$el.empty();
+ this.$el.append(this.column.get('label'));
- render: function () {
- this.$el.empty();
- this.$el.append(this.column.get('label'));
+ if (this.column.get('sortable')) {
+ this.$el.addClass('clickable');
+ this.$el.append('
');
- if (this.column.get('sortable')) {
- this.$el.addClass('clickable');
- this.$el.append('
');
+ if (this.collection.state) {
+ var sortKey = this.collection.state.sortKey;
+ var sortDir = this._convertIntToDirection(this.collection.state.order);
- if (this.collection.state) {
- var sortKey = this.collection.state.sortKey;
- var sortDir = this._convertIntToDirection(this.collection.state.order);
-
- if (sortKey === this.column.get('name')) {
- this.$el.children('i').addClass(this._convertDirectionToIcon(sortDir));
- this._direction = sortDir;
+ if (sortKey === this.column.get('name')) {
+ this.$el.children('i').addClass(this._convertDirectionToIcon(sortDir));
+ this._direction = sortDir;
+ }
}
}
- }
- this.delegateEvents();
- return this;
- },
+ this.delegateEvents();
+ return this;
+ },
- direction: function (dir) {
- if (arguments.length) {
- if (this._direction) {
- this.$el.children('i').removeClass(this._convertDirectionToIcon(this._direction));
+ direction: function (dir) {
+ if (arguments.length) {
+ if (this._direction) {
+ this.$el.children('i').removeClass(this._convertDirectionToIcon(this._direction));
+ }
+ if (dir) {
+ this.$el.children('i').addClass(this._convertDirectionToIcon(dir));
+ }
+ this._direction = dir;
}
- if (dir) {
- this.$el.children('i').addClass(this._convertDirectionToIcon(dir));
+
+ return this._direction;
+ },
+
+ onClick: function (e) {
+ e.preventDefault();
+
+ var columnName = this.column.get('name');
+
+ if (this.column.get('sortable')) {
+ if (this.direction() === 'ascending') {
+ this.sort(columnName, 'descending', function (left, right) {
+ var leftVal = left.get(columnName);
+ var rightVal = right.get(columnName);
+ if (leftVal === rightVal) {
+ return 0;
+ }
+ else if (leftVal > rightVal) {
+ return -1;
+ }
+ return 1;
+ });
+ }
+ else {
+ this.sort(columnName, 'ascending', function (left, right) {
+ var leftVal = left.get(columnName);
+ var rightVal = right.get(columnName);
+ if (leftVal === rightVal) {
+ return 0;
+ }
+ else if (leftVal < rightVal) {
+ return -1;
+ }
+ return 1;
+ });
+ }
}
- this._direction = dir;
- }
+ },
- return this._direction;
- },
-
- onClick: function (e) {
- e.preventDefault();
-
- var columnName = this.column.get('name');
-
- if (this.column.get('sortable')) {
- if (this.direction() === 'ascending') {
- this.sort(columnName, 'descending', function (left, right) {
- var leftVal = left.get(columnName);
- var rightVal = right.get(columnName);
- if (leftVal === rightVal) {
- return 0;
- }
- else if (leftVal > rightVal) {
- return -1;
- }
- return 1;
- });
+ _convertDirectionToIcon: function (dir) {
+ if (dir === 'ascending') {
+ return 'icon-sort-up';
}
- else {
- this.sort(columnName, 'ascending', function (left, right) {
- var leftVal = left.get(columnName);
- var rightVal = right.get(columnName);
- if (leftVal === rightVal) {
- return 0;
- }
- else if (leftVal < rightVal) {
- return -1;
- }
- return 1;
- });
+
+ return 'icon-sort-down';
+ },
+
+ _convertIntToDirection: function (dir) {
+ if (dir === '-1') {
+ return 'ascending';
}
+
+ return 'descending';
}
- },
+ });
- _convertDirectionToIcon: function (dir) {
- if (dir === 'ascending') {
- return 'icon-sort-up';
- }
-
- return 'icon-sort-down';
- },
-
- _convertIntToDirection: function (dir) {
- if (dir === '-1') {
- return 'ascending';
- }
-
- return 'descending';
- }
+ return Backgrid.NzbDroneHeaderCell;
});
-
- return Backgrid.NzbDroneHeaderCell;
-});
diff --git a/UI/Shared/Grid/Pager.js b/UI/Shared/Grid/Pager.js
index b3240dff6..ade0a525a 100644
--- a/UI/Shared/Grid/Pager.js
+++ b/UI/Shared/Grid/Pager.js
@@ -1,146 +1,145 @@
'use strict';
-define([
- 'app',
- 'backgrid',
- 'backgrid.paginator'
-], function () {
+define(
+ [
+ 'backgrid.paginator'
+ ], function (Paginator) {
- NzbDrone.Shared.Grid.Pager = Backgrid.Extension.Paginator.extend({
+ return Paginator.extend({
- template: 'Shared/Grid/PagerTemplate',
+ template: 'Shared/Grid/PagerTemplate',
- events: {
- 'click .pager-btn': 'changePage'
- },
+ events: {
+ 'click .pager-btn': 'changePage'
+ },
- windowSize: 1,
+ windowSize: 1,
- fastForwardHandleLabels: {
- first: 'icon-fast-backward',
- prev : 'icon-backward',
- next : 'icon-forward',
- last : 'icon-fast-forward'
- },
+ fastForwardHandleLabels: {
+ first: 'icon-fast-backward',
+ prev : 'icon-backward',
+ next : 'icon-forward',
+ last : 'icon-fast-forward'
+ },
- changePage: function (e) {
- e.preventDefault();
+ changePage: function (e) {
+ e.preventDefault();
- var target = $(e.target);
+ var target = $(e.target);
- if (target.closest('li').hasClass('disabled')) {
- return;
+ if (target.closest('li').hasClass('disabled')) {
+ return;
+ }
+
+ var label = target.attr('data-action');
+ var ffLabels = this.fastForwardHandleLabels;
+
+ var collection = this.collection;
+
+ if (ffLabels) {
+ switch (label) {
+ case 'first':
+ collection.getFirstPage();
+ return;
+ case 'prev':
+ if (collection.hasPrevious()) {
+ collection.getPreviousPage();
+ }
+ return;
+ case 'next':
+ if (collection.hasNext()) {
+ collection.getNextPage();
+ }
+ return;
+ case 'last':
+ collection.getLastPage();
+ return;
+ }
+ }
+
+ var state = collection.state;
+ var pageIndex = $(e.target).text() * 1;
+ collection.getPage(state.firstPage === 0 ? pageIndex - 1 :pageIndex);
+ },
+
+ makeHandles: function () {
+
+ var handles =
+ [
+ ];
+ var collection = this.collection;
+ var state = collection.state;
+
+ // convert all indices to 0-based here
+ var firstPage = state.firstPage;
+ var lastPage = +state.lastPage;
+ lastPage = Math.max(0, firstPage ? lastPage - 1 :lastPage);
+ var currentPage = Math.max(state.currentPage, state.firstPage);
+ currentPage = firstPage ? currentPage - 1 :currentPage;
+ var windowStart = Math.floor(currentPage / this.windowSize) * this.windowSize;
+ var windowEnd = Math.min(lastPage + 1, windowStart + this.windowSize);
+
+ if (collection.mode !== 'infinite') {
+ for (var i = windowStart; i < windowEnd; i++) {
+ handles.push({
+ label : i + 1,
+ title : 'No. ' + (i + 1),
+ className : currentPage === i ? 'active' :undefined,
+ pageNumber: i + 1
+ });
+ }
+ }
+
+ var ffLabels = this.fastForwardHandleLabels;
+ if (ffLabels) {
+
+ if (ffLabels.prev) {
+ handles.unshift({
+ label : ffLabels.prev,
+ className: collection.hasPrevious() ? void 0 :'disabled',
+ action : 'prev'
+ });
+ }
+
+ if (ffLabels.first) {
+ handles.unshift({
+ label : ffLabels.first,
+ className: collection.hasPrevious() ? void 0 :'disabled',
+ action : 'first'
+ });
+ }
+
+ if (ffLabels.next) {
+ handles.push({
+ label : ffLabels.next,
+ className: collection.hasNext() ? void 0 :'disabled',
+ action : 'next'
+ });
+ }
+
+ if (ffLabels.last) {
+ handles.push({
+ label : ffLabels.last,
+ className: collection.hasNext() ? void 0 :'disabled',
+ action : 'last'
+ });
+ }
+ }
+
+ return handles;
+ },
+
+ render: function () {
+ this.$el.empty();
+
+ var templateFunction = Marionette.TemplateCache.get(this.template);
+
+ this.$el.html(templateFunction({
+ handles: this.makeHandles()
+ }));
+
+ this.delegateEvents();
+
+ return this;
}
-
- var label = target.attr('data-action');
- var ffLabels = this.fastForwardHandleLabels;
-
- var collection = this.collection;
-
- if (ffLabels) {
- switch (label) {
- case 'first':
- collection.getFirstPage();
- return;
- case 'prev':
- if (collection.hasPrevious()) {
- collection.getPreviousPage();
- }
- return;
- case 'next':
- if (collection.hasNext()) {
- collection.getNextPage();
- }
- return;
- case 'last':
- collection.getLastPage();
- return;
- }
- }
-
- var state = collection.state;
- var pageIndex = $(e.target).text() * 1;
- collection.getPage(state.firstPage === 0 ? pageIndex - 1 :pageIndex);
- },
-
- makeHandles: function () {
-
- var handles = [];
- var collection = this.collection;
- var state = collection.state;
-
- // convert all indices to 0-based here
- var firstPage = state.firstPage;
- var lastPage = +state.lastPage;
- lastPage = Math.max(0, firstPage ? lastPage - 1 :lastPage);
- var currentPage = Math.max(state.currentPage, state.firstPage);
- currentPage = firstPage ? currentPage - 1 :currentPage;
- var windowStart = Math.floor(currentPage / this.windowSize) * this.windowSize;
- var windowEnd = Math.min(lastPage + 1, windowStart + this.windowSize);
-
- if (collection.mode !== 'infinite') {
- for (var i = windowStart; i < windowEnd; i++) {
- handles.push({
- label : i + 1,
- title : 'No. ' + (i + 1),
- className : currentPage === i ? 'active' :undefined,
- pageNumber: i + 1
- });
- }
- }
-
- var ffLabels = this.fastForwardHandleLabels;
- if (ffLabels) {
-
- if (ffLabels.prev) {
- handles.unshift({
- label : ffLabels.prev,
- className: collection.hasPrevious() ? void 0 :'disabled',
- action : 'prev'
- });
- }
-
- if (ffLabels.first) {
- handles.unshift({
- label : ffLabels.first,
- className: collection.hasPrevious() ? void 0 :'disabled',
- action : 'first'
- });
- }
-
- if (ffLabels.next) {
- handles.push({
- label : ffLabels.next,
- className: collection.hasNext() ? void 0 :'disabled',
- action : 'next'
- });
- }
-
- if (ffLabels.last) {
- handles.push({
- label : ffLabels.last,
- className: collection.hasNext() ? void 0 :'disabled',
- action : 'last'
- });
- }
- }
-
- return handles;
- },
-
- render: function () {
- this.$el.empty();
-
- var templateFunction = Marionette.TemplateCache.get(this.template);
-
- this.$el.html(templateFunction({
- handles: this.makeHandles()
- }));
-
- this.delegateEvents();
-
- return this;
- }
+ });
});
-
- return NzbDrone.Shared.Grid.Pager;
-});
diff --git a/UI/Shared/LoadingView.js b/UI/Shared/LoadingView.js
index abb66d1c4..a10261a42 100644
--- a/UI/Shared/LoadingView.js
+++ b/UI/Shared/LoadingView.js
@@ -1,10 +1,10 @@
-'use strict';
-
-define(['app'], function () {
- NzbDrone.Shared.LoadingView = Backbone.Marionette.ItemView.extend({
- template : 'Shared/LoadingTemplate',
- className: 'nz-loading row'
+'use strict';
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
+ return Marionette.ItemView.extend({
+ template : 'Shared/LoadingTemplate',
+ className: 'nz-loading row'
+ });
});
-
- return NzbDrone.Shared.LoadingView;
-});
diff --git a/UI/Shared/NotFoundView.js b/UI/Shared/NotFoundView.js
index 05115205b..211f21151 100644
--- a/UI/Shared/NotFoundView.js
+++ b/UI/Shared/NotFoundView.js
@@ -1,8 +1,11 @@
-'use strict';
-define(['app'], function () {
- NzbDrone.Shared.NotFoundView = Backbone.Marionette.ItemView.extend({
- template: 'Shared/notfoundtemplate'
+'use strict';
+define(
+ [
+ 'marionette'
+ ], function (Marionette) {
+ return Marionette.ItemView.extend({
+ template: 'Shared/notfoundtemplate'
+ });
});
-});
diff --git a/UI/Shared/NotificationCollection.js b/UI/Shared/NotificationCollection.js
deleted file mode 100644
index 744c07dae..000000000
--- a/UI/Shared/NotificationCollection.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict';
-define(['app', 'Shared/NotificationModel'], function () {
-
- var notificationCollection = Backbone.Collection.extend({
- model: NzbDrone.Shared.NotificationModel
- });
-
- return new notificationCollection();
-});
-
-
diff --git a/UI/Shared/NotificationModel.js b/UI/Shared/NotificationModel.js
deleted file mode 100644
index 5a83fa793..000000000
--- a/UI/Shared/NotificationModel.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict';
-define(['app'], function () {
-
- NzbDrone.Shared.NotificationModel = Backbone.Model.extend({
- mutators: {
-
- preFormattedMessage: function () {
- return this.get('message').replace(/\\r\\n/g, '
');
- },
-
- isPreFormatted: function () {
- return this.get('message').indexOf('\\r\\n') !== -1;
- },
-
- iconClass: function () {
-
- if (this.has('icon')) {
- return 'icon';
- }
-
- if (this.get('level') === 'info') {
- return 'icon-info-sign';
- } else if (this.get('level') === 'success') {
- return 'icon-ok-sign';
- } else if (this.get('level') === 'error') {
- return 'icon-warning-sign';
- }
-
- return '';
- }
- },
-
- defaults: {
- 'level' : 'info',
- 'title' : '',
- 'message': ''
- }
- });
-});
diff --git a/UI/Shared/NotificationTemplate.html b/UI/Shared/NotificationTemplate.html
deleted file mode 100644
index 73a61014d..000000000
--- a/UI/Shared/NotificationTemplate.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
{{title}}
- {{#if isPreFormatted}}
-
{{{preFormattedMessage}}}
- {{else}}
- {{message}}
- {{/if}}
-
-
\ No newline at end of file
diff --git a/UI/Shared/NotificationView.js b/UI/Shared/NotificationView.js
deleted file mode 100644
index e21b4f8e5..000000000
--- a/UI/Shared/NotificationView.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-
-define(['app', 'Shared/NotificationCollection'], function (app, notificationCollection) {
-
- var notificationItemView = Backbone.Marionette.ItemView.extend({
- template: 'Shared/NotificationTemplate',
-
- events: {
- 'click .x-close': 'kill'
- },
-
- kill: function () {
-
- var self = this;
-
- $.Deferred(function () {
- self.$el.slideUp('slow');
- }).done(function () {
- self.model.destroy();
- });
- }
- });
-
- var collectionView = Backbone.Marionette.CollectionView.extend({
-
- itemView: notificationItemView,
-
- initialize: function () {
- this.collection = notificationCollection;
- }
- });
-
- NzbDrone.addInitializer(function () {
- console.log('initializing notification view');
- NzbDrone.notificationRegion.show(new collectionView());
- });
-
-});
-
-
-
-
diff --git a/UI/Shared/SpinnerView.js b/UI/Shared/SpinnerView.js
index 1807b321d..80269ff6f 100644
--- a/UI/Shared/SpinnerView.js
+++ b/UI/Shared/SpinnerView.js
@@ -1,15 +1,13 @@
-'use strict';
+'use strict';
define(
[
- 'app'
- ], function () {
- NzbDrone.Shared.SpinnerView = Backbone.Marionette.ItemView.extend({
+ 'marionette'
+ ], function (Marionette) {
+ return Marionette.ItemView.extend({
template : 'Shared/SpinnerTemplate',
className: 'nz-spinner row'
});
-
- return NzbDrone.Shared.SpinnerView;
});
diff --git a/UI/Shared/Styles/card.less b/UI/Shared/Styles/card.less
index 59191ae6a..94883fe73 100644
--- a/UI/Shared/Styles/card.less
+++ b/UI/Shared/Styles/card.less
@@ -1,4 +1,4 @@
-.card {
+.card() {
margin :10px;
background-color: #ffffff;
padding: 10px;
diff --git a/UI/Shared/Styles/clickable.less b/UI/Shared/Styles/clickable.less
index 9cc2ce23e..9f76fcaec 100644
--- a/UI/Shared/Styles/clickable.less
+++ b/UI/Shared/Styles/clickable.less
@@ -1,3 +1,4 @@
-.clickable {
+.clickable() {
cursor: pointer;
-}
\ No newline at end of file
+}
+
diff --git a/UI/Shared/TemplateHelpers.js b/UI/Shared/TemplateHelpers.js
index d1adfa748..c32297e2f 100644
--- a/UI/Shared/TemplateHelpers.js
+++ b/UI/Shared/TemplateHelpers.js
@@ -2,10 +2,9 @@
define(
[
- 'app',
'handlebars',
'Shared/FormatHelpers'
- ], function (App, Handlebars) {
+ ], function (Handlebars, FormatHelpers) {
Handlebars.registerHelper('partial', function (templateName) {
//TODO: We should be able to pass in the context, either an object or a property
@@ -26,7 +25,7 @@ define(
});
Handlebars.registerHelper('fileSize', function (size) {
- return new Handlebars.SafeString(NzbDrone.Shared.FormatHelpers.FileSizeHelper(size));
+ return new Handlebars.SafeString(FormatHelpers.FileSizeHelper(size));
});
Handlebars.registerHelper('date', function (date) {
@@ -36,7 +35,7 @@ define(
}
var shortDate = Date.create(date).short();
- var formattedDate = NzbDrone.Shared.FormatHelpers.DateHelper(date);
+ var formattedDate = FormatHelpers.DateHelper(date);
var result = '
' + formattedDate + '';
return new Handlebars.SafeString(result);
diff --git a/UI/Shared/Toolbar/Button/ButtonCollectionView.js b/UI/Shared/Toolbar/Button/ButtonCollectionView.js
index 14acd1629..b5d5d19d4 100644
--- a/UI/Shared/Toolbar/Button/ButtonCollectionView.js
+++ b/UI/Shared/Toolbar/Button/ButtonCollectionView.js
@@ -1,9 +1,13 @@
'use strict';
-define(['app', 'Shared/Toolbar/Button/ButtonView', 'Config'], function (App, ButtonView, Config) {
- return Backbone.Marionette.CollectionView.extend({
- className: 'btn-group',
- itemView : ButtonView
+define(
+ [
+ 'marionette',
+ 'Shared/Toolbar/Button/ButtonView'
+ ], function (Marionette, ButtonView) {
+ return Marionette.CollectionView.extend({
+ className: 'btn-group',
+ itemView : ButtonView
+ });
});
-});
diff --git a/UI/Shared/Toolbar/Button/ButtonView.js b/UI/Shared/Toolbar/Button/ButtonView.js
index 373822b15..4f86e034d 100644
--- a/UI/Shared/Toolbar/Button/ButtonView.js
+++ b/UI/Shared/Toolbar/Button/ButtonView.js
@@ -1,102 +1,113 @@
'use strict';
-define(['app', 'Config', 'Commands/CommandController', 'Shared/Messenger'],
- function (App,
- Config,
- CommandController,
- Messenger) {
+define(
+ [
+ 'app',
+ 'marionette',
+ 'Commands/CommandController',
+ 'Shared/Messenger'
+ ], function (App, Marionette, CommandController, Messenger) {
- return Backbone.Marionette.ItemView.extend({
- template : 'Shared/Toolbar/ButtonTemplate',
- className: 'btn',
+ return Marionette.ItemView.extend({
+ template : 'Shared/Toolbar/ButtonTemplate',
+ className: 'btn',
- events: {
- 'click': 'onClick'
- },
+ events: {
+ 'click': 'onClick'
+ },
- ui: {
- icon: '.x-icon'
- },
+ ui: {
+ icon: '.x-icon'
+ },
- initialize: function () {
- this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
- this.idle = true;
- },
- onRender: function () {
- if (this.model.get('active')) {
- this.$el.addClass('active');
- this.invokeCallback();
- }
- },
+ initialize: function () {
+ this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
+ this.idle = true;
+ },
- onClick: function () {
- if (this.idle) {
- this.invokeCallback();
- this.invokeRoute();
- this.invokeCommand();
- }
- },
+ onRender: function () {
+ if (this.model.get('active')) {
+ this.$el.addClass('active');
+ this.invokeCallback();
+ }
+ },
- invokeCommand: function () {
- var command = this.model.get('command');
- if (command) {
- this.idle = false;
- this.$el.addClass('disabled');
- this.ui.icon.addClass('icon-spinner icon-spin');
+ onClick: function () {
+ if (this.idle) {
+ this.invokeCallback();
+ this.invokeRoute();
+ this.invokeCommand();
+ }
+ },
- var self = this;
- var commandPromise = CommandController.Execute(command);
- commandPromise.done(function () {
- if (self.model.get('successMessage')) {
- Messenger.show({
- message: self.model.get('successMessage')
+
+ invokeCommand: function () {
+ var command = this.model.get('command');
+ if (command) {
+ this.idle = false;
+ this.$el.addClass('disabled');
+ this.ui.icon.addClass('icon-spinner icon-spin');
+
+ var self = this;
+ var commandPromise = CommandController.Execute(command);
+ commandPromise.done(function () {
+ if (self.model.get('successMessage')) {
+ Messenger.show({
+ message: self.model.get('successMessage')
+ });
+ }
+ });
+
+ commandPromise.fail(function (options) {
+ if (options.readyState === 0 || options.status === 0) {
+ return;
+ }
+ if (self.model.get('errorMessage')) {
+ Messenger.show({
+ message: self.model.get('errorMessage'),
+ type : 'error'
+ });
+ }
+ });
+
+ commandPromise.always(function () {
+ if (!self.isClosed) {
+ self.$el.removeClass('disabled');
+ self.ui.icon.removeClass('icon-spinner icon-spin');
+ self.idle = true;
+ }
+ });
+ }
+ },
+
+ invokeRoute: function () {
+ var route = this.model.get('route');
+ if (route) {
+
+ require(
+ [
+ 'Router'
+ ], function () {
+ App.Router.navigate(route, {trigger: true});
});
- }
- });
+ }
+ },
- commandPromise.fail(function (options) {
- if (options.readyState === 0 || options.status === 0) {
- return;
- }
- if (self.model.get('errorMessage')) {
- Messenger.show({
- message: self.model.get('errorMessage'),
- type : 'error'
- });
- }
- });
+ invokeCallback: function () {
- commandPromise.always(function () {
- if (!self.isClosed) {
- self.$el.removeClass('disabled');
- self.ui.icon.removeClass('icon-spinner icon-spin');
- self.idle = true;
- }
- });
- }
- },
+ if (!this.model.ownerContext) {
+ throw 'ownerContext must be set.';
+ }
- invokeRoute: function () {
- var route = this.model.get('route');
- if (route) {
- NzbDrone.Router.navigate(route, {trigger: true});
- }
- },
- invokeCallback: function () {
-
- if (!this.model.ownerContext) {
- throw 'ownerContext must be set.';
+ var callback = this.model.get('callback');
+ if (callback) {
+ callback.call(this.model.ownerContext);
+ }
}
-
- var callback = this.model.get('callback');
- if (callback) {
- callback.call(this.model.ownerContext);
- }
- }
+ });
});
-});
diff --git a/UI/Shared/Toolbar/ButtonCollection.js b/UI/Shared/Toolbar/ButtonCollection.js
index 8a9c4c86c..f01090110 100644
--- a/UI/Shared/Toolbar/ButtonCollection.js
+++ b/UI/Shared/Toolbar/ButtonCollection.js
@@ -1,7 +1,11 @@
'use strict';
-define(['app', 'Shared/Toolbar/ButtonModel'], function () {
- return Backbone.Collection.extend({
- model: NzbDrone.Shared.Toolbar.ButtonModel
+define(
+ [
+ 'backbone',
+ 'Shared/Toolbar/ButtonModel'
+ ], function (Backbone, ButtonModel) {
+ return Backbone.Collection.extend({
+ model: ButtonModel
+ });
});
-});
diff --git a/UI/Shared/Toolbar/ButtonModel.js b/UI/Shared/Toolbar/ButtonModel.js
index 2995dabeb..f6c7c8a64 100644
--- a/UI/Shared/Toolbar/ButtonModel.js
+++ b/UI/Shared/Toolbar/ButtonModel.js
@@ -1,17 +1,13 @@
'use strict';
-define(['app'], function () {
-
- NzbDrone.Shared.Toolbar.ActionTypes =
- {
- RouteTrigger: 'RouteTrigger',
- CallBack : 'CallBack'
- };
-
- return Backbone.Model.extend({
- defaults: {
- 'target' : '/nzbdrone/route',
- 'title' : '',
- 'active' : false,
- 'tooltip': undefined }
+define(
+ [
+ 'backbone'
+ ], function (Backbone) {
+ return Backbone.Model.extend({
+ defaults: {
+ 'target' : '/nzbdrone/route',
+ 'title' : '',
+ 'active' : false,
+ 'tooltip': undefined }
+ });
});
-});
diff --git a/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js b/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
index f7a64a1fc..cded0aba1 100644
--- a/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
+++ b/UI/Shared/Toolbar/Radio/RadioButtonCollectionView.js
@@ -1,13 +1,13 @@
'use strict';
define(
[
- 'app',
+ 'marionette',
'Shared/Toolbar/Radio/RadioButtonView',
'Config'
- ], function (App, RadioButtonView, Config) {
- return Backbone.Marionette.CollectionView.extend({
+ ], function (Marionette, RadioButtonView, Config) {
+ return Marionette.CollectionView.extend({
className: 'btn-group',
- itemView : NzbDrone.Shared.Toolbar.RadioButtonView,
+ itemView : RadioButtonView,
attributes: {
'data-toggle': 'buttons-radio'
diff --git a/UI/Shared/Toolbar/Radio/RadioButtonView.js b/UI/Shared/Toolbar/Radio/RadioButtonView.js
index 67d367916..f6e0533c3 100644
--- a/UI/Shared/Toolbar/Radio/RadioButtonView.js
+++ b/UI/Shared/Toolbar/Radio/RadioButtonView.js
@@ -1,48 +1,52 @@
'use strict';
-define(['app', 'Config'], function () {
+define(
+ [
+ 'marionette',
+ 'Config'
+ ], function (Marionette, Config) {
- NzbDrone.Shared.Toolbar.RadioButtonView = Backbone.Marionette.ItemView.extend({
- template : 'Shared/Toolbar/ButtonTemplate',
- className: 'btn',
+ return Marionette.ItemView.extend({
+ template : 'Shared/Toolbar/ButtonTemplate',
+ className: 'btn',
- events: {
- 'click': 'onClick'
- },
+ events: {
+ 'click': 'onClick'
+ },
- initialize: function () {
+ initialize: function () {
- this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
- },
+ this.storageKey = this.model.get('menuKey') + ':' + this.model.get('key');
+ },
- onRender: function () {
- if (this.model.get('active')) {
- this.$el.addClass('active');
+ onRender: function () {
+ if (this.model.get('active')) {
+ this.$el.addClass('active');
+ this.invokeCallback();
+ }
+ },
+
+ onClick: function () {
+
+ Config.SetValue(this.model.get('menuKey'), this.model.get('key'));
this.invokeCallback();
- }
- },
+ },
- onClick: function () {
+ invokeCallback: function () {
- NzbDrone.Config.SetValue(this.model.get('menuKey'), this.model.get('key'));
- this.invokeCallback();
- },
+ if (!this.model.ownerContext) {
+ throw 'ownerContext must be set.';
+ }
- invokeCallback: function () {
- if (!this.model.ownerContext) {
- throw 'ownerContext must be set.';
+ var callback = this.model.get('callback');
+ if (callback) {
+ callback.call(this.model.ownerContext);
+ }
}
-
- var callback = this.model.get('callback');
- if (callback) {
- callback.call(this.model.ownerContext);
- }
- }
-
+ });
});
-});
diff --git a/UI/Shared/Toolbar/ToolbarLayout.js b/UI/Shared/Toolbar/ToolbarLayout.js
index 1c558dccf..701fdf07d 100644
--- a/UI/Shared/Toolbar/ToolbarLayout.js
+++ b/UI/Shared/Toolbar/ToolbarLayout.js
@@ -1,18 +1,13 @@
'use strict';
define(
[
- 'app',
- 'Shared/Toolbar/Radio/RadioButtonCollectionView',
- 'Shared/Toolbar/Button/ButtonCollectionView',
+ 'marionette',
'Shared/Toolbar/ButtonCollection',
- 'Shared/Toolbar/ButtonModel'
- ],
- function (App,
- RadioButtonCollectionView,
- ButtonCollectionView,
- ButtonCollection,
- ButtonModel) {
- NzbDrone.Shared.Toolbar.ToolbarLayout = Backbone.Marionette.Layout.extend({
+ 'Shared/Toolbar/ButtonModel',
+ 'Shared/Toolbar/Radio/RadioButtonCollectionView',
+ 'Shared/Toolbar/Button/ButtonCollectionView'
+ ], function (Marionette, ButtonCollection, ButtonModel, RadioButtonCollectionView, ButtonCollectionView) {
+ return Marionette.Layout.extend({
template: 'Shared/Toolbar/ToolbarLayoutTemplate',
regions: {
@@ -38,6 +33,7 @@ define(
},
+
onShow: function () {
if (this.left) {
_.each(this.left, this._showToolbarLeft, this);
@@ -79,17 +75,17 @@ define(
case 'radio':
{
buttonGroupView = new RadioButtonCollectionView({
- collection: groupCollection,
- menu : buttonGroup
- });
+ collection: groupCollection,
+ menu : buttonGroup
+ });
break;
}
default :
{
buttonGroupView = new ButtonCollectionView({
- collection: groupCollection,
- menu : buttonGroup
- });
+ collection: groupCollection,
+ menu : buttonGroup
+ });
break;
}
}
@@ -97,9 +93,6 @@ define(
this[position + '_' + (index + 1).toString()].show(buttonGroupView);
}
});
-
- return NzbDrone.Shared.Toolbar.ToolbarLayout;
-
});
diff --git a/UI/app.js b/UI/app.js
index 934c17a5a..c20f10551 100644
--- a/UI/app.js
+++ b/UI/app.js
@@ -1,4 +1,4 @@
-'use strict';
+'use strict';
require.config({
urlArgs: 'v=' + window.ServerStatus.version,
@@ -130,19 +130,29 @@ require.config({
exports: 'Backgrid',
init: function () {
- Backgrid.Column.prototype.defaults = {
- name : undefined,
- label : undefined,
- sortable : true,
- editable : false,
- renderable: true,
- formatter : undefined,
- cell : undefined,
- headerCell: 'nzbDrone'
- };
+ require(
+ [
+ 'Shared/Grid/HeaderCell'
+ ], function () {
+
+ Backgrid.Column.prototype.defaults = {
+ name : undefined,
+ label : undefined,
+ sortable : true,
+ editable : false,
+ renderable: true,
+ formatter : undefined,
+ cell : undefined,
+ headerCell: 'NzbDrone'
+ };
+
+ });
}
},
'backgrid.paginator': {
+
+ exports: 'Backgrid.Extension.Paginator',
+
deps:
[
'backgrid'
@@ -165,76 +175,29 @@ define(
]);
- window.NzbDrone = new Marionette.Application();
- window.NzbDrone.Config = {};
- window.NzbDrone.Form = {};
+ var app = new Marionette.Application();
- window.NzbDrone.Series = {
- Index : {
- Table : {},
- List : {},
- Posters: {}
-
- },
- Edit : {},
- Delete : {},
- Details: {}
- };
-
- window.NzbDrone.Episode = {
- Search : {},
- Summary : {},
- Activity: {}
- };
-
- window.NzbDrone.Quality = {};
-
- window.NzbDrone.Commands = {};
-
- window.NzbDrone.Shared = {
- Toolbar : {},
- Messenger : {},
- FormatHelpers: {},
- Grid : {}
- };
-
- window.NzbDrone.Cells = {};
-
- window.NzbDrone.Calendar = {};
-
- window.NzbDrone.Missing = {};
- window.NzbDrone.History = {};
- window.NzbDrone.Logs = {};
- window.NzbDrone.Release = {};
-
- window.NzbDrone.Events = {
+ app.Events = {
SeriesAdded: 'seriesAdded'
};
- window.NzbDrone.Commands = {
+ app.Commands = {
SaveSettings: 'saveSettings'
};
- window.NzbDrone.Constants = {
- ApiRoot: '/api'
- };
- window.NzbDrone.addInitializer(function () {
+ app.addInitializer(function () {
console.log('starting application');
});
- NzbDrone.addRegions({
+ app.addRegions({
mainRegion : '#main-region',
notificationRegion: '#notification-region',
modalRegion : ModalRegion,
footerRegion : '#footer-region'
});
- window.NzbDrone.start();
-
-
- //NzbDrone.footerRegion.show(new FooterView());
-
+ app.start();
window.require(
[
@@ -242,7 +205,7 @@ define(
'jQuery/TooltipBinder'
]);
- return NzbDrone;
+ return app;
});
diff --git a/UI/jQuery/RouteBinder.js b/UI/jQuery/RouteBinder.js
index 3905ae2ce..bff72622d 100644
--- a/UI/jQuery/RouteBinder.js
+++ b/UI/jQuery/RouteBinder.js
@@ -1,6 +1,6 @@
'use strict';
define(function () {
- //This module will automatically route all links through backbone router rather than
+ //This module will automatically route all relative links through backbone router rather than
//causing links to reload pages.
var routeBinder = {
@@ -37,7 +37,7 @@ define(function () {
}
if (!href) {
- throw 'couldnt find route target';
+ throw 'couldn\'t find route target';
}