mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
Addressing jshint warnings (#1050)
* Cleaning up some jsLiniting problems * fix jshint issue with variablle declaration This shouldn't be an issue because of hoisting but, jshint is finicky.
This commit is contained in:
parent
961a6d89a4
commit
af2b5c2f1c
19 changed files with 61 additions and 89 deletions
|
@ -79,7 +79,7 @@ var BulkImportCollection = PageableCollection.extend({
|
|||
first : this.url,
|
||||
next: this.url,
|
||||
last : this.url
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ var _ = require('underscore');
|
|||
var vent = require("vent");
|
||||
var TemplatedCell = require('../../Cells/TemplatedCell');
|
||||
var NzbDroneCell = require("../../Cells/NzbDroneCell");
|
||||
var Marionette = require('marionette');
|
||||
|
||||
module.exports = TemplatedCell.extend({
|
||||
className : 'monitor-cell',
|
||||
|
|
|
@ -5,6 +5,7 @@ var _ = require('underscore');
|
|||
var vent = require("vent");
|
||||
var TemplatedCell = require('../../Cells/TemplatedCell');
|
||||
var NzbDroneCell = require("../../Cells/NzbDroneCell");
|
||||
var Marionette = require('marionette');
|
||||
|
||||
module.exports = TemplatedCell.extend({
|
||||
className : 'profile-cell',
|
||||
|
|
|
@ -75,7 +75,7 @@ module.exports = Marionette.Layout.extend({
|
|||
this.isExisting = options.isExisting;
|
||||
//this.collection = new AddFromListCollection();
|
||||
|
||||
this.templateHelpers = {}
|
||||
this.templateHelpers = {};
|
||||
this.listCollection = new ListCollection();
|
||||
this.templateHelpers.lists = this.listCollection.toJSON();
|
||||
|
||||
|
@ -155,7 +155,7 @@ module.exports = Marionette.Layout.extend({
|
|||
if (rootFolderValue === 'addNew') {
|
||||
//var rootFolderLayout = new SchemaModal(this.listCollection);
|
||||
//AppLayout.modalRegion.show(rootFolderLayout);
|
||||
SchemaModal.open(this.listCollection)
|
||||
SchemaModal.open(this.listCollection);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -165,7 +165,7 @@ module.exports = Marionette.Layout.extend({
|
|||
|
||||
this.fetchResult.show(new LoadingView());
|
||||
|
||||
this.currentFetchPromise = this.collection.fetch({ data: { listId: listId } })
|
||||
this.currentFetchPromise = this.collection.fetch({ data: { listId: listId } });
|
||||
this.currentFetchPromise.fail(function() {
|
||||
self._showError();
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ var view = Marionette.ItemView.extend({
|
|||
template : 'AddMovies/SearchResultViewTemplate',
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
AsValidatedView.apply(view);
|
||||
|
|
|
@ -175,7 +175,7 @@ module.exports = Marionette.ItemView.extend({
|
|||
var downloading = QueueCollection.findMovie(element.get('id')) || element.get('grabbed');
|
||||
var currentTime = moment();
|
||||
var start = moment(element.get('inCinemas'));
|
||||
var status = element.getStatus();
|
||||
var status = element.getStatus().toLowerCase();
|
||||
var end = moment(endTime);
|
||||
var monitored = element.get('monitored');
|
||||
|
||||
|
@ -193,15 +193,15 @@ module.exports = Marionette.ItemView.extend({
|
|||
statusLevel = 'unmonitored';
|
||||
}
|
||||
|
||||
else if (status == "inCinemas") {
|
||||
else if (status === "incinemas") {
|
||||
statusLevel = 'premiere';
|
||||
}
|
||||
|
||||
else if (status == "released") {
|
||||
else if (status === "released") {
|
||||
statusLevel = 'danger';
|
||||
}
|
||||
|
||||
else if (status == "announced") {
|
||||
else if (status === "announced") {
|
||||
statusLevel = 'primary';
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ module.exports = Marionette.ItemView.extend({
|
|||
|
||||
options.titleFormat = "L";
|
||||
|
||||
options.columnFormat = "L"/*{
|
||||
options.columnFormat = "L"; /*{
|
||||
month : 'ddd',
|
||||
week : UiSettings.get('calendarWeekColumnHeader'),
|
||||
day : 'dddd'
|
||||
|
|
|
@ -4,7 +4,6 @@ module.exports = TemplatedCell.extend({
|
|||
className : 'movie-title-cell',
|
||||
template : 'Cells/MovieDownloadStatusTemplate',
|
||||
sortKey : function(model) {
|
||||
debugger;
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -86,7 +86,7 @@ var singleton = function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
console.warn(options)
|
||||
console.warn(options);
|
||||
options.element.startSpin();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ Handlebars.registerHelper('StatusLevel', function() {
|
|||
var start = moment(this.airDateUtc);
|
||||
var end = moment(this.end);
|
||||
var monitored = this.series.monitored && this.monitored;
|
||||
debugger;
|
||||
|
||||
if (hasFile) {
|
||||
return 'success';
|
||||
}
|
||||
|
|
|
@ -61,10 +61,10 @@ Handlebars.registerHelper('homepage', function() {
|
|||
|
||||
Handlebars.registerHelper('alternativeTitlesString', function() {
|
||||
var titles = this.alternativeTitles;
|
||||
if (titles.length == 0) {
|
||||
if (titles.length === 0) {
|
||||
return "";
|
||||
}
|
||||
if (titles.length == 1) {
|
||||
if (titles.length === 1) {
|
||||
return titles[0];
|
||||
}
|
||||
return titles.slice(0,titles.length-1).join(", ") + " and " + titles[titles.length-1];
|
||||
|
@ -95,7 +95,7 @@ Handlebars.registerHelper('GetStatus', function() {
|
|||
else if (!monitored) {
|
||||
return new Handlebars.SafeString('<i class="icon-sonarr-series-unmonitored grid-icon" title=""></i> Not Monitored');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('GetBannerStatus', function() {
|
||||
var monitored = this.monitored;
|
||||
|
@ -138,7 +138,7 @@ Handlebars.registerHelper('DownloadedStatusColor', function() {
|
|||
}
|
||||
|
||||
return "danger";
|
||||
})
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('DownloadedStatus', function() {
|
||||
|
||||
|
@ -157,24 +157,26 @@ Handlebars.registerHelper("DownloadedQuality", function() {
|
|||
}
|
||||
|
||||
return "";
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Handlebars.registerHelper('inCinemas', function() {
|
||||
var monthNames = ["January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November", "December"
|
||||
];
|
||||
var year, month;
|
||||
|
||||
if (this.physicalRelease) {
|
||||
var d = new Date(this.physicalRelease);
|
||||
var day = d.getDate();
|
||||
var month = monthNames[d.getMonth()];
|
||||
var year = d.getFullYear();
|
||||
month = monthNames[d.getMonth()];
|
||||
year = d.getFullYear();
|
||||
return "Available: " + day + ". " + month + " " + year;
|
||||
}
|
||||
if (this.inCinemas) {
|
||||
var cinemasDate = new Date(this.inCinemas);
|
||||
var year = cinemasDate.getFullYear();
|
||||
var month = monthNames[cinemasDate.getMonth()];
|
||||
year = cinemasDate.getFullYear();
|
||||
month = monthNames[cinemasDate.getMonth()];
|
||||
return "In Cinemas: " + month + " " + year;
|
||||
}
|
||||
return "To be announced";
|
||||
|
|
|
@ -4,6 +4,7 @@ var Config = require('../Config');
|
|||
module.exports = function() {
|
||||
|
||||
var originalInit = this.prototype.initialize;
|
||||
var _setInitialState, _storeStateFromBackgrid, _storeState, _convertDirectionToInt;
|
||||
this.prototype.initialize = function(options) {
|
||||
|
||||
options = options || {};
|
||||
|
@ -35,7 +36,7 @@ module.exports = function() {
|
|||
};
|
||||
}
|
||||
|
||||
var _setInitialState = function() {
|
||||
_setInitialState = function() {
|
||||
var key = Config.getValue('{0}.sortKey'.format(this.tableName), this.state.sortKey);
|
||||
var direction = Config.getValue('{0}.sortDirection'.format(this.tableName), this.state.order);
|
||||
var order = parseInt(direction, 10);
|
||||
|
@ -44,7 +45,7 @@ module.exports = function() {
|
|||
this.state.order = order;
|
||||
};
|
||||
|
||||
var _storeStateFromBackgrid = function(column, sortDirection) {
|
||||
_storeStateFromBackgrid = function(column, sortDirection) {
|
||||
var order = _convertDirectionToInt(sortDirection);
|
||||
var sortKey = this._getSortMapping(column.get('name')).sortKey;
|
||||
|
||||
|
@ -52,7 +53,7 @@ module.exports = function() {
|
|||
Config.setValue('{0}.sortDirection'.format(this.tableName), order);
|
||||
};
|
||||
|
||||
var _storeState = function(sortModel, sortDirection) {
|
||||
_storeState = function(sortModel, sortDirection) {
|
||||
var order = _convertDirectionToInt(sortDirection);
|
||||
var sortKey = this._getSortMapping(sortModel.get('name')).sortKey;
|
||||
|
||||
|
@ -60,7 +61,7 @@ module.exports = function() {
|
|||
Config.setValue('{0}.sortDirection'.format(this.tableName), order);
|
||||
};
|
||||
|
||||
var _convertDirectionToInt = function(dir) {
|
||||
_convertDirectionToInt = function(dir) {
|
||||
if (dir === 'ascending') {
|
||||
return '-1';
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ module.exports = Marionette.Layout.extend({
|
|||
this._setMonitoredState();
|
||||
this._showInfo();
|
||||
if (this.model.get("movieFile")) {
|
||||
this._showFiles()
|
||||
this._showFiles();
|
||||
} else {
|
||||
this._showHistory();
|
||||
}
|
||||
|
@ -223,37 +223,6 @@ module.exports = Marionette.Layout.extend({
|
|||
var self = this;
|
||||
|
||||
return;
|
||||
|
||||
reqres.setHandler(reqres.Requests.GetEpisodeFileById, function(episodeFileId) {
|
||||
return self.episodeFileCollection.get(episodeFileId);
|
||||
});
|
||||
|
||||
reqres.setHandler(reqres.Requests.GetAlternateNameBySeasonNumber, function(moviesId, seasonNumber, sceneSeasonNumber) {
|
||||
if (self.model.get('id') !== moviesId) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (sceneSeasonNumber === undefined) {
|
||||
sceneSeasonNumber = seasonNumber;
|
||||
}
|
||||
|
||||
return _.where(self.model.get('alternateTitles'),
|
||||
function(alt) {
|
||||
return alt.sceneSeasonNumber === sceneSeasonNumber || alt.seasonNumber === seasonNumber;
|
||||
});
|
||||
});
|
||||
|
||||
$.when(this.episodeCollection.fetch(), this.episodeFileCollection.fetch()).done(function() {
|
||||
var seasonCollectionView = new SeasonCollectionView({
|
||||
collection : self.seasonCollection,
|
||||
episodeCollection : self.episodeCollection,
|
||||
movies : self.model
|
||||
});
|
||||
|
||||
if (!self.isClosed) {
|
||||
self.seasons.show(seasonCollectionView);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_showInfo : function() {
|
||||
|
@ -311,7 +280,7 @@ module.exports = Marionette.Layout.extend({
|
|||
_manualSearchM : function() {
|
||||
console.warn("Manual Search started");
|
||||
console.warn(this.model.id);
|
||||
console.warn(this.model)
|
||||
console.warn(this.model);
|
||||
console.warn(this.episodeCollection);
|
||||
vent.trigger(vent.Commands.ShowEpisodeDetails, {
|
||||
episode : this.model,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
var _ = require('underscore');
|
||||
var vent = require('vent');
|
||||
var Marionette = require('marionette');
|
||||
var Backgrid = require('backgrid');
|
||||
|
@ -82,6 +83,7 @@ module.exports = Marionette.Layout.extend({
|
|||
},
|
||||
|
||||
initialize : function() {
|
||||
|
||||
this.movieCollection = MoviesCollection.clone();
|
||||
var pageSize = parseInt(Config.getValue("pageSize")) || 10;
|
||||
this.movieCollection.switchMode('client', {fetch: false});
|
||||
|
|
|
@ -24,17 +24,17 @@ var view = Marionette.ItemView.extend({
|
|||
this.qualities = new Qualities();
|
||||
var self = this;
|
||||
this.listenTo(this.qualities, 'all', this._qualitiesUpdated);
|
||||
this.qualities.fetch()
|
||||
this.qualities.fetch();
|
||||
|
||||
},
|
||||
|
||||
onRender : function() {
|
||||
this.ui.quality.val(this.model.get("quality").quality.id)
|
||||
this.ui.quality.val(this.model.get("quality").quality.id);
|
||||
},
|
||||
|
||||
_onBeforeSave : function() {
|
||||
var qualityId = this.ui.quality.val();
|
||||
var quality = this.qualities.find(function(m){return m.get("quality").id == qualityId}).get("quality");
|
||||
var quality = this.qualities.find(function(m){return m.get("quality").id === qualityId;}).get("quality");
|
||||
var mQuality = this.model.get("quality");
|
||||
mQuality.quality = quality;
|
||||
this.model.set({ quality : mQuality });
|
||||
|
|
|
@ -81,16 +81,12 @@ var Collection = PageableCollection.extend({
|
|||
}
|
||||
},
|
||||
|
||||
sortMappings : {
|
||||
'movie' : { sortKey : 'series.sortTitle' }
|
||||
},
|
||||
|
||||
parseState : function(resp) {
|
||||
if (this.mode === 'client') {
|
||||
return {};
|
||||
}
|
||||
var direction = -1;
|
||||
if (resp.sortDirection == "descending") {
|
||||
if (resp.sortDirection.toLowerCase() === "descending") {
|
||||
direction = 1;
|
||||
}
|
||||
return { totalRecords : resp.totalRecords, order : direction, currentPage : resp.page };
|
||||
|
@ -169,18 +165,21 @@ var Collection = PageableCollection.extend({
|
|||
filterModes : filterModes,
|
||||
|
||||
sortMappings : {
|
||||
movie : {
|
||||
sortKey : 'series.sortTitle'
|
||||
},
|
||||
title : {
|
||||
sortKey : 'sortTitle'
|
||||
},
|
||||
statusWeight : {
|
||||
sortValue : function(model, attr) {
|
||||
if (model.getStatus() == "released") {
|
||||
if (model.getStatus().toLowerCase() === "released") {
|
||||
return 3;
|
||||
}
|
||||
if (model.getStatus() == "inCinemas") {
|
||||
if (model.getStatus().toLowerCase() === "incinemas") {
|
||||
return 2;
|
||||
}
|
||||
if (model.getStatus() == "announced") {
|
||||
if (model.getStatus().toLowerCase() === "announced") {
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
|
@ -212,7 +211,6 @@ var Collection = PageableCollection.extend({
|
|||
},
|
||||
status: {
|
||||
sortValue : function(model, attr) {
|
||||
debugger;
|
||||
if (model.get("downloaded")) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ module.exports = Marionette.Layout.extend({
|
|||
_manualSearchM : function() {
|
||||
console.warn("Manual Search started");
|
||||
console.warn(this.model.get("seriesId"));
|
||||
console.warn(this.model)
|
||||
console.warn(this.model);
|
||||
console.warn(this.episodeCollection);
|
||||
vent.trigger(vent.Commands.ShowEpisodeDetails, {
|
||||
episode : this.episodeCollection.models[0],
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = NzbDroneController.extend({
|
|||
},
|
||||
|
||||
seriesDetails : function(query) {
|
||||
console.warn(AppLayout.mainRegion)
|
||||
console.warn(AppLayout.mainRegion);
|
||||
|
||||
var series = SeriesCollection.where({ titleSlug : query });
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var _ = require('underscore');
|
||||
var $ = require('jquery');
|
||||
var vent = require('vent');
|
||||
var AppLayout = require('../../../AppLayout');
|
||||
var Marionette = require('marionette');
|
||||
var DeleteView = require('../Delete/IndexerDeleteView');
|
||||
var Profiles = require('../../../Profile/ProfileCollection');
|
||||
|
@ -55,7 +56,7 @@ var view = Marionette.ItemView.extend({
|
|||
profileId : profile,
|
||||
rootFolderPath : rootFolderPath,
|
||||
minimumAvailability : minAvail,
|
||||
})
|
||||
});
|
||||
},
|
||||
|
||||
_onAfterSave : function() {
|
||||
|
@ -95,7 +96,6 @@ var view = Marionette.ItemView.extend({
|
|||
|
||||
_rootFoldersUpdated : function() {
|
||||
this._configureTemplateHelpers();
|
||||
debugger;
|
||||
this.render();
|
||||
},
|
||||
|
||||
|
|
|
@ -31,13 +31,12 @@ module.exports = Marionette.CompositeView.extend({
|
|||
}
|
||||
|
||||
collection.setSorting(sortModel.get('name'), order);
|
||||
if (collection.mode == "server"){
|
||||
if (collection.mode.toLowerCase() === "server"){
|
||||
collection.fetch({reset: true});
|
||||
} else {
|
||||
collection.fullCollection.sort();
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue