added global NzbDrone namespace.

This commit is contained in:
kay.one 2013-09-14 00:10:19 -07:00
parent d5e5d6de29
commit 27c57612f4
30 changed files with 36 additions and 35 deletions

View File

@ -5,7 +5,7 @@ define(
'Series/SeriesModel' 'Series/SeriesModel'
], function (Backbone, SeriesModel) { ], function (Backbone, SeriesModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/series/lookup', url : window.NzbDrone.ApiRoot + '/series/lookup',
model: SeriesModel, model: SeriesModel,
initialize: function (options) { initialize: function (options) {

View File

@ -7,7 +7,7 @@ define(
], function (Backbone, RootFolderModel) { ], function (Backbone, RootFolderModel) {
var RootFolderCollection = Backbone.Collection.extend({ var RootFolderCollection = Backbone.Collection.extend({
url : window.ApiRoot + '/rootfolder', url : window.NzbDrone.ApiRoot + '/rootfolder',
model: RootFolderModel model: RootFolderModel
}); });

View File

@ -4,7 +4,7 @@ define(
'backbone' 'backbone'
], function (Backbone) { ], function (Backbone) {
return Backbone.Model.extend({ return Backbone.Model.extend({
urlRoot : window.ApiRoot + '/rootfolder', urlRoot : window.NzbDrone.ApiRoot + '/rootfolder',
defaults: { defaults: {
freeSpace: 0 freeSpace: 0
} }

View File

@ -5,7 +5,7 @@ define(
'Series/EpisodeModel' 'Series/EpisodeModel'
], function (Backbone, EpisodeModel) { ], function (Backbone, EpisodeModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/calendar', url : window.NzbDrone.ApiRoot + '/calendar',
model: EpisodeModel, model: EpisodeModel,
comparator: function (model) { comparator: function (model) {

View File

@ -6,7 +6,7 @@ define(
'Series/EpisodeModel' 'Series/EpisodeModel'
], function (Backbone, Moment, EpisodeModel) { ], function (Backbone, Moment, EpisodeModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/calendar', url : window.NzbDrone.ApiRoot + '/calendar',
model: EpisodeModel, model: EpisodeModel,
comparator: function (model1, model2) { comparator: function (model1, model2) {

View File

@ -7,7 +7,7 @@ define(
], function (Backbone, CommandModel) { ], function (Backbone, CommandModel) {
var CommandCollection = Backbone.Collection.extend({ var CommandCollection = Backbone.Collection.extend({
url : window.ApiRoot + '/command', url : window.NzbDrone.ApiRoot + '/command',
model: CommandModel, model: CommandModel,
findCommand: function (command) { findCommand: function (command) {

View File

@ -4,7 +4,7 @@ define(
'backbone' 'backbone'
], function (Backbone) { ], function (Backbone) {
return Backbone.Model.extend({ return Backbone.Model.extend({
url: window.ApiRoot + '/command', url: window.NzbDrone.ApiRoot + '/command',
parse: function (response) { parse: function (response) {
response.name = response.name.toLocaleLowerCase(); response.name = response.name.toLocaleLowerCase();

View File

@ -5,7 +5,7 @@ define(
'backbone.pageable' 'backbone.pageable'
], function (HistoryModel, PageableCollection) { ], function (HistoryModel, PageableCollection) {
return PageableCollection.extend({ return PageableCollection.extend({
url : window.ApiRoot + '/history', url : window.NzbDrone.ApiRoot + '/history',
model: HistoryModel, model: HistoryModel,
state: { state: {

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
define(['backbone.pageable', 'Logs/Model', ], function (PagableCollection, LogsModel) { define(['backbone.pageable', 'Logs/Model', ], function (PagableCollection, LogsModel) {
return PagableCollection.extend({ return PagableCollection.extend({
url : window.ApiRoot + '/log', url : window.NzbDrone.ApiRoot + '/log',
model: LogsModel, model: LogsModel,
state: { state: {

View File

@ -2,7 +2,7 @@
define(['Logs/Files/Model' ], define(['Logs/Files/Model' ],
function (LogFileModel) { function (LogFileModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/log/files', url : window.NzbDrone.ApiRoot + '/log/files',
model: LogFileModel, model: LogFileModel,
state: { state: {

View File

@ -5,7 +5,7 @@ define(
'backbone.pageable' 'backbone.pageable'
], function (EpisodeModel, PagableCollection) { ], function (EpisodeModel, PagableCollection) {
return PagableCollection.extend({ return PagableCollection.extend({
url : window.ApiRoot + '/missing', url : window.NzbDrone.ApiRoot + '/missing',
model: EpisodeModel, model: EpisodeModel,
state: { state: {

View File

@ -6,7 +6,7 @@ define(function () {
$(this).typeahead({ $(this).typeahead({
source : function (filter, callback) { source : function (filter, callback) {
$.ajax({ $.ajax({
url : window.ApiRoot + resource, url : window.NzbDrone.ApiRoot + resource,
dataType: 'json', dataType: 'json',
type : 'GET', type : 'GET',
data : { query: filter }, data : { query: filter },

View File

@ -8,7 +8,7 @@ define(
], function (App, Backbone, Messenger) { ], function (App, Backbone, Messenger) {
var ProgressMessageCollection = Backbone.Collection.extend({ var ProgressMessageCollection = Backbone.Collection.extend({
url : window.ApiRoot + '/progressmessage', url : window.NzbDrone.ApiRoot + '/progressmessage',
model: Backbone.Model, model: Backbone.Model,
initialize: function(){ initialize: function(){

View File

@ -7,7 +7,7 @@ define(
var QualityProfileCollection = Backbone.Collection.extend({ var QualityProfileCollection = Backbone.Collection.extend({
model: QualityProfileModel, model: QualityProfileModel,
url : window.ApiRoot + '/qualityprofiles' url : window.NzbDrone.ApiRoot + '/qualityprofiles'
}); });
var profiles = new QualityProfileCollection(); var profiles = new QualityProfileCollection();

View File

@ -5,6 +5,6 @@ define(
], function (QualitySizeModel) { ], function (QualitySizeModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
model: QualitySizeModel, model: QualitySizeModel,
url : window.ApiRoot + '/qualitysize' url : window.NzbDrone.ApiRoot + '/qualitysize'
}); });
}); });

View File

@ -5,7 +5,7 @@ define(
'backbone.pageable' 'backbone.pageable'
], function (ReleaseModel, PagableCollection) { ], function (ReleaseModel, PagableCollection) {
return PagableCollection.extend({ return PagableCollection.extend({
url : window.ApiRoot + '/release', url : window.NzbDrone.ApiRoot + '/release',
model: ReleaseModel, model: ReleaseModel,
mode: 'client', mode: 'client',

View File

@ -5,7 +5,7 @@ define(
'Series/EpisodeModel' 'Series/EpisodeModel'
], function (Backbone, EpisodeModel) { ], function (Backbone, EpisodeModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/episodes', url : window.NzbDrone.ApiRoot + '/episodes',
model: EpisodeModel, model: EpisodeModel,
state: { state: {

View File

@ -5,7 +5,7 @@ define(
'Series/EpisodeFileModel' 'Series/EpisodeFileModel'
], function (Backbone, EpisodeFileModel) { ], function (Backbone, EpisodeFileModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/episodefile', url : window.NzbDrone.ApiRoot + '/episodefile',
model: EpisodeFileModel, model: EpisodeFileModel,
originalFetch: Backbone.Collection.prototype.fetch, originalFetch: Backbone.Collection.prototype.fetch,

View File

@ -5,7 +5,7 @@ define(
'Series/SeriesModel' 'Series/SeriesModel'
], function (Backbone, SeriesModel) { ], function (Backbone, SeriesModel) {
var Collection = Backbone.Collection.extend({ var Collection = Backbone.Collection.extend({
url : window.ApiRoot + '/series', url : window.NzbDrone.ApiRoot + '/series',
model: SeriesModel, model: SeriesModel,
comparator: function (model) { comparator: function (model) {

View File

@ -7,7 +7,7 @@ define(
], function (Backbone, _) { ], function (Backbone, _) {
return Backbone.Model.extend({ return Backbone.Model.extend({
urlRoot: ApiRoot + '/series', urlRoot: window.NzbDrone.ApiRoot + '/series',
defaults: { defaults: {
episodeFileCount: 0, episodeFileCount: 0,

View File

@ -1,18 +1,19 @@
window.ApiRoot = '/api'; window.NzbDrone = {};
window.NzbDrone.ApiRoot = '/api';
var statusText = $.ajax({ var statusText = $.ajax({
type : 'GET', type : 'GET',
url : window.ApiRoot + '/system/status', url : window.NzbDrone.ApiRoot + '/system/status',
async: false async: false
}).responseText; }).responseText;
window.ServerStatus = JSON.parse(statusText); window.NzbDrone.ServerStatus = JSON.parse(statusText);
var footerText = window.ServerStatus.version; var footerText = window.NzbDrone.ServerStatus.version;
$(document).ready(function () { $(document).ready(function () {
if (window.ServerStatus.branch != 'master') { if (window.NzbDrone.ServerStatus.branch != 'master') {
footerText += '</br>' + window.ServerStatus.branch; footerText += '</br>' + window.NzbDrone.ServerStatus.branch;
} }
$('#footer-region .version').html(footerText); $('#footer-region .version').html(footerText);
}); });

View File

@ -5,7 +5,7 @@ define(
], function (SettingsModelBase) { ], function (SettingsModelBase) {
return SettingsModelBase.extend({ return SettingsModelBase.extend({
url : window.ApiRoot + '/settings/host', url : window.NzbDrone.ApiRoot + '/settings/host',
successMessage: 'General settings saved', successMessage: 'General settings saved',
errorMessage : 'Failed to save general settings' errorMessage : 'Failed to save general settings'

View File

@ -5,7 +5,7 @@ define(
'Form/FormBuilder' 'Form/FormBuilder'
], function (IndexerModel) { ], function (IndexerModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/indexer', url : window.NzbDrone.ApiRoot + '/indexer',
model: IndexerModel model: IndexerModel
}); });
}); });

View File

@ -4,7 +4,7 @@ define(
'Settings/SettingsModelBase' 'Settings/SettingsModelBase'
], function (ModelBase) { ], function (ModelBase) {
return ModelBase.extend({ return ModelBase.extend({
url : window.ApiRoot + '/config/naming', url : window.NzbDrone.ApiRoot + '/config/naming',
successMessage: 'MediaManagement settings saved', successMessage: 'MediaManagement settings saved',
errorMessage : 'Couldn\'t save naming settings' errorMessage : 'Couldn\'t save naming settings'
}); });

View File

@ -45,7 +45,7 @@ define(
var promise = $.ajax({ var promise = $.ajax({
type: 'GET', type: 'GET',
url : window.ApiRoot + '/config/naming/samples', url : window.NzbDrone.ApiRoot + '/config/naming/samples',
data: this.model.toJSON() data: this.model.toJSON()
}); });

View File

@ -4,7 +4,7 @@ define(
'Settings/Notifications/Model' 'Settings/Notifications/Model'
], function (NotificationModel) { ], function (NotificationModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.ApiRoot + '/notification', url : window.NzbDrone.ApiRoot + '/notification',
model: NotificationModel model: NotificationModel
}); });
}); });

View File

@ -8,6 +8,6 @@ define(
return Backbone.Collection.extend({ return Backbone.Collection.extend({
model: QualityProfileModel, model: QualityProfileModel,
url : window.ApiRoot + '/qualityprofiles/schema' url : window.NzbDrone.ApiRoot + '/qualityprofiles/schema'
}); });
}); });

View File

@ -2,7 +2,7 @@
define(['app', define(['app',
'Settings/SettingsModelBase'], function (App, SettingsModelBase) { 'Settings/SettingsModelBase'], function (App, SettingsModelBase) {
return SettingsModelBase.extend({ return SettingsModelBase.extend({
url : window.ApiRoot + '/settings', url : window.NzbDrone.ApiRoot + '/settings',
successMessage: 'Settings saved', successMessage: 'Settings saved',
errorMessage : 'Failed to save settings' errorMessage : 'Failed to save settings'
}); });

View File

@ -5,7 +5,7 @@ define(
], function (Backbone) { ], function (Backbone) {
var model = Backbone.Model.extend({ var model = Backbone.Model.extend({
url: window.ApiRoot + '/system/status' url: window.NzbDrone.ApiRoot + '/system/status'
}); });

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
require.config({ require.config({
urlArgs: 'v=' + window.ServerStatus.version, urlArgs: 'v=' + window.NzbDrone.ServerStatus.version,
paths: { paths: {
'backbone' : 'JsLibraries/backbone', 'backbone' : 'JsLibraries/backbone',