mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-19 16:01:46 +02:00
Merge pull request #974 from geogolem/MovieEditorFixes
revert some changes -- use FullCollection (maybe just for now)
This commit is contained in:
commit
e742371d15
@ -2,8 +2,7 @@ var $ = require('jquery');
|
|||||||
var _ = require('underscore');
|
var _ = require('underscore');
|
||||||
var SelectAllCell = require('../../Cells/SelectAllCell');
|
var SelectAllCell = require('../../Cells/SelectAllCell');
|
||||||
var Backgrid = require('backgrid');
|
var Backgrid = require('backgrid');
|
||||||
//var FullMovieCollection = require('../../Movies/FullMovieCollection');
|
var FullMovieCollection = require('../../Movies/FullMovieCollection');
|
||||||
var MoviesCollectionClient = require('../../Movies/MoviesCollectionClient');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = SelectAllCell.extend({
|
module.exports = SelectAllCell.extend({
|
||||||
@ -15,7 +14,7 @@ module.exports = SelectAllCell.extend({
|
|||||||
this._originalInit.apply(this, arguments);
|
this._originalInit.apply(this, arguments);
|
||||||
|
|
||||||
var tmdbId = this.model.get('tmdbId');
|
var tmdbId = this.model.get('tmdbId');
|
||||||
var existingMovie = MoviesCollectionClient.fullCollection.where({ tmdbId: tmdbId });
|
var existingMovie = FullMovieCollection.where({ tmdbId: tmdbId });
|
||||||
this.isDuplicate = existingMovie.length > 0 ? true : false;
|
this.isDuplicate = existingMovie.length > 0 ? true : false;
|
||||||
|
|
||||||
this.listenTo(this.model, 'change', this._refresh);
|
this.listenTo(this.model, 'change', this._refresh);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
var SearchResultView = require('./SearchResultView');
|
var SearchResultView = require('./SearchResultView');
|
||||||
//var FullMovieCollection = require('../Movies/FullMovieCollection');
|
var FullMovieCollection = require('../Movies/FullMovieCollection');
|
||||||
var MoviesCollectionClient = require('../Movies/MoviesCollectionClient');
|
|
||||||
var vent = require('vent');
|
var vent = require('vent');
|
||||||
|
|
||||||
module.exports = Marionette.CollectionView.extend({
|
module.exports = Marionette.CollectionView.extend({
|
||||||
@ -49,7 +48,7 @@ module.exports = Marionette.CollectionView.extend({
|
|||||||
|
|
||||||
appendHtml : function(collectionView, itemView, index) {
|
appendHtml : function(collectionView, itemView, index) {
|
||||||
var tmdbId = itemView.model.get('tmdbId');
|
var tmdbId = itemView.model.get('tmdbId');
|
||||||
var existingMovies = MoviesCollectionClient.fullCollection.where({ tmdbId: tmdbId });
|
var existingMovies = FullMovieCollection.where({ tmdbId: tmdbId });
|
||||||
if(existingMovies.length > 0) {
|
if(existingMovies.length > 0) {
|
||||||
if(this.showExisting) {
|
if(this.showExisting) {
|
||||||
if (index < this.showing || index === 0) {
|
if (index < this.showing || index === 0) {
|
||||||
|
@ -6,8 +6,7 @@ var Marionette = require('marionette');
|
|||||||
var Profiles = require('../Profile/ProfileCollection');
|
var Profiles = require('../Profile/ProfileCollection');
|
||||||
var RootFolders = require('./RootFolders/RootFolderCollection');
|
var RootFolders = require('./RootFolders/RootFolderCollection');
|
||||||
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
|
var RootFolderLayout = require('./RootFolders/RootFolderLayout');
|
||||||
//var FullMovieCollection = require('../Movies/FullMovieCollection');
|
var FullMovieCollection = require('../Movies/FullMovieCollection');
|
||||||
var MoviesCollectionClient = require('../Movies/MoviesCollectionClient');
|
|
||||||
var Config = require('../Config');
|
var Config = require('../Config');
|
||||||
var Messenger = require('../Shared/Messenger');
|
var Messenger = require('../Shared/Messenger');
|
||||||
var AsValidatedView = require('../Mixins/AsValidatedView');
|
var AsValidatedView = require('../Mixins/AsValidatedView');
|
||||||
@ -107,7 +106,7 @@ var view = Marionette.ItemView.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_configureTemplateHelpers : function() {
|
_configureTemplateHelpers : function() {
|
||||||
var existingMovies = MoviesCollectionClient.fullCollection.where({ tmdbId : this.model.get('tmdbId') });
|
var existingMovies = FullMovieCollection.where({ tmdbId : this.model.get('tmdbId') });
|
||||||
if (existingMovies.length > 0) {
|
if (existingMovies.length > 0) {
|
||||||
this.templateHelpers.existing = existingMovies[0].toJSON();
|
this.templateHelpers.existing = existingMovies[0].toJSON();
|
||||||
}
|
}
|
||||||
@ -218,7 +217,7 @@ var view = Marionette.ItemView.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
promise.done(function() {
|
promise.done(function() {
|
||||||
MoviesCollectionClient.fullCollection.add(self.model);
|
FullMovieCollection.add(self.model);
|
||||||
|
|
||||||
self.close();
|
self.close();
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ var RootFolders = require('../../AddMovies/RootFolders/RootFolderCollection');
|
|||||||
var RootFolderLayout = require('../../AddMovies/RootFolders/RootFolderLayout');
|
var RootFolderLayout = require('../../AddMovies/RootFolders/RootFolderLayout');
|
||||||
var UpdateFilesMoviesView = require('./Organize/OrganizeFilesView');
|
var UpdateFilesMoviesView = require('./Organize/OrganizeFilesView');
|
||||||
var Config = require('../../Config');
|
var Config = require('../../Config');
|
||||||
|
var FullMovieCollection = require('../FullMovieCollection');
|
||||||
|
|
||||||
module.exports = Marionette.ItemView.extend({
|
module.exports = Marionette.ItemView.extend({
|
||||||
template : 'Movies/Editor/MovieEditorFooterViewTemplate',
|
template : 'Movies/Editor/MovieEditorFooterViewTemplate',
|
||||||
@ -44,11 +45,16 @@ module.exports = Marionette.ItemView.extend({
|
|||||||
|
|
||||||
|
|
||||||
this.listenTo(this.moviesCollection, 'backgrid:selected', function(model, selected) {
|
this.listenTo(this.moviesCollection, 'backgrid:selected', function(model, selected) {
|
||||||
var m = this.moviesCollection.fullCollection.findWhere({ tmdbId : model.get('tmdbId') });
|
var m = FullMovieCollection.findWhere({ tmdbId : model.get('tmdbId') });
|
||||||
m.set('selected', selected);
|
m.set('selected', selected);
|
||||||
this._updateInfo();
|
this._updateInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.listenTo(FullMovieCollection, 'save', function() {
|
||||||
|
window.alert(' Done Saving');
|
||||||
|
|
||||||
|
var selected = FullMovieCollection.where({ selected : true });
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.listenTo(RootFolders, 'all', this.render);
|
this.listenTo(RootFolders, 'all', this.render);
|
||||||
@ -61,14 +67,19 @@ module.exports = Marionette.ItemView.extend({
|
|||||||
_updateAndSave : function() {
|
_updateAndSave : function() {
|
||||||
//var selected = this.editorGrid.getSelectedModels();
|
//var selected = this.editorGrid.getSelectedModels();
|
||||||
|
|
||||||
var selected = this.moviesCollection.fullCollection.where({ selected : true });
|
var selected = FullMovieCollection.where({ selected : true });
|
||||||
var monitored = this.ui.monitored.val();
|
var monitored = this.ui.monitored.val();
|
||||||
var minAvail = this.ui.minimumAvailability.val();
|
var minAvail = this.ui.minimumAvailability.val();
|
||||||
var profile = this.ui.profile.val();
|
var profile = this.ui.profile.val();
|
||||||
var seasonFolder = this.ui.seasonFolder.val();
|
var seasonFolder = this.ui.seasonFolder.val();
|
||||||
var rootFolder = this.ui.rootFolder.val();
|
var rootFolder = this.ui.rootFolder.val();
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
var b = [];
|
||||||
_.each(selected, function(model) {
|
_.each(selected, function(model) {
|
||||||
|
|
||||||
|
b[i] = model.get('tmdbId');
|
||||||
|
i++;
|
||||||
if (monitored === 'true') {
|
if (monitored === 'true') {
|
||||||
model.set('monitored', true);
|
model.set('monitored', true);
|
||||||
} else if (monitored === 'false') {
|
} else if (monitored === 'false') {
|
||||||
@ -96,7 +107,38 @@ module.exports = Marionette.ItemView.extend({
|
|||||||
}
|
}
|
||||||
model.edited = true;
|
model.edited = true;
|
||||||
});
|
});
|
||||||
this.moviesCollection.save();
|
for (var j=0; j<i; j++) {
|
||||||
|
var m = this.moviesCollection.fullCollection.findWhere({ tmdbId : b[j] });
|
||||||
|
if (m!== undefined) {
|
||||||
|
if (monitored === 'true') {
|
||||||
|
m.set('monitored', true);
|
||||||
|
} else if (monitored === 'false') {
|
||||||
|
m.set('monitored', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minAvail !=='noChange') {
|
||||||
|
m.set('minimumAvailability', minAvail);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile !== 'noChange') {
|
||||||
|
m.set('profileId', parseInt(profile, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seasonFolder === 'true') {
|
||||||
|
m.set('seasonFolder', true);
|
||||||
|
} else if (seasonFolder === 'false') {
|
||||||
|
m.set('seasonFolder', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rootFolder !== 'noChange') {
|
||||||
|
var rootFolderPath = RootFolders.get(parseInt(rootFolder, 10));
|
||||||
|
m.set('rootFolderPath', rootFolderPath.get('path'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FullMovieCollection.save();
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateInfo : function() {
|
_updateInfo : function() {
|
||||||
|
@ -2,6 +2,7 @@ var vent = require('vent');
|
|||||||
var Marionette = require('marionette');
|
var Marionette = require('marionette');
|
||||||
var Backgrid = require('backgrid');
|
var Backgrid = require('backgrid');
|
||||||
var EmptyView = require('../Index/EmptyView');
|
var EmptyView = require('../Index/EmptyView');
|
||||||
|
var FullMovieCollection = require ('../FullMovieCollection');
|
||||||
var MoviesCollection = require('../MoviesCollectionClient');
|
var MoviesCollection = require('../MoviesCollectionClient');
|
||||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||||
var DownloadedQualityCell = require('../../Cells/DownloadedQualityCell');
|
var DownloadedQualityCell = require('../../Cells/DownloadedQualityCell');
|
||||||
@ -12,7 +13,6 @@ var FooterView = require('./MovieEditorFooterView');
|
|||||||
var GridPager = require('../../Shared/Grid/Pager');
|
var GridPager = require('../../Shared/Grid/Pager');
|
||||||
require('../../Mixins/backbone.signalr.mixin');
|
require('../../Mixins/backbone.signalr.mixin');
|
||||||
|
|
||||||
//require('../Globals');
|
|
||||||
window.shownOnce = false;
|
window.shownOnce = false;
|
||||||
module.exports = Marionette.Layout.extend({
|
module.exports = Marionette.Layout.extend({
|
||||||
template : 'Movies/Editor/MovieEditorLayoutTemplate',
|
template : 'Movies/Editor/MovieEditorLayoutTemplate',
|
||||||
@ -81,31 +81,27 @@ module.exports = Marionette.Layout.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
this.tableShown = window.shownOnce; //false;
|
|
||||||
this.movieCollection = MoviesCollection;
|
this.movieCollection = MoviesCollection;
|
||||||
this.movieCollection.bindSignalR();
|
this.movieCollection.bindSignalR();
|
||||||
//this.movieCollection.switchMode('client');
|
|
||||||
this.movieCollection.fullCollection.bindSignalR();
|
this.movieCollection.fullCollection.bindSignalR();
|
||||||
var selected = this.movieCollection.fullCollection.where( { selected : true });
|
|
||||||
|
|
||||||
|
var selected = FullMovieCollection.where( { selected : true });
|
||||||
_.each(selected, function(model) {
|
_.each(selected, function(model) {
|
||||||
model.set('selected', false);
|
model.set('selected', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.movieCollection, 'sync', function() {
|
this.listenTo(this.movieCollection, 'sync', function() {
|
||||||
this._showToolbar();
|
this._showToolbar();
|
||||||
if (!this.tableShown) {
|
|
||||||
this._showTable();
|
this._showTable();
|
||||||
this._showPager();
|
this._showPager();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.movieCollection.fullCollection, 'sync', function() {
|
this.listenTo(this.movieCollection.fullCollection, 'sync', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.movieCollection, 'save', function() {
|
//this.listenTo(FullMovieCollection, 'save', function() {
|
||||||
window.alert('Done Saving');
|
// window.alert('Done Saving');
|
||||||
});
|
//});
|
||||||
|
|
||||||
this.filteringOptions = {
|
this.filteringOptions = {
|
||||||
type : 'radio',
|
type : 'radio',
|
||||||
@ -157,15 +153,16 @@ module.exports = Marionette.Layout.extend({
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
window.shownOnce = true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender : function() {
|
onRender : function() {
|
||||||
if (this.tableShown) {
|
|
||||||
this._showToolbar();
|
this._showToolbar();
|
||||||
this._showTable();
|
this._showTable();
|
||||||
this._showPager();
|
this._showPager();
|
||||||
|
if (window.shownOnce){
|
||||||
|
this.movieCollection.fetch();
|
||||||
}
|
}
|
||||||
|
window.shownOnce = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onClose : function() {
|
onClose : function() {
|
||||||
@ -191,7 +188,6 @@ module.exports = Marionette.Layout.extend({
|
|||||||
this.toolbar.close();
|
this.toolbar.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.tableShown = true;
|
|
||||||
this.columns[0].sortedCollection = this.movieCollection;
|
this.columns[0].sortedCollection = this.movieCollection;
|
||||||
|
|
||||||
this.editorGrid = new Backgrid.Grid({
|
this.editorGrid = new Backgrid.Grid({
|
||||||
@ -226,6 +222,6 @@ module.exports = Marionette.Layout.extend({
|
|||||||
|
|
||||||
_setFilter : function(buttonContext) {
|
_setFilter : function(buttonContext) {
|
||||||
var mode = buttonContext.model.get('key');
|
var mode = buttonContext.model.get('key');
|
||||||
this.movieCollection.setFilterMode(mode, { reset : false });
|
this.movieCollection.setFilterMode(mode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/*var movieCollection = require('./MoviesCollection');
|
var movieCollection = require('./MoviesCollection');
|
||||||
|
|
||||||
var fullCollection = movieCollection.clone();
|
var fullCollection = movieCollection.clone();
|
||||||
fullCollection.bindSignalR();
|
fullCollection.bindSignalR();
|
||||||
fullCollection.state.pageSize = 100000;
|
fullCollection.state.pageSize = 100000;
|
||||||
fullCollection.fetch({reset : true});
|
fullCollection.fetch({reset : true});
|
||||||
module.exports = fullCollection;*/
|
module.exports = fullCollection;
|
||||||
|
|
||||||
var movieCollection = require('./MoviesCollectionClient');
|
/*var movieCollection = require('./MoviesCollectionClient');
|
||||||
|
|
||||||
movieCollection.bindSignalR();
|
movieCollection.bindSignalR();
|
||||||
module.exports = movieCollection.fullCollection;
|
module.exports = movieCollection.fullCollection;*/
|
||||||
|
@ -5,9 +5,12 @@ var PosterCollectionView = require('./Posters/SeriesPostersCollectionView');
|
|||||||
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
|
var ListCollectionView = require('./Overview/SeriesOverviewCollectionView');
|
||||||
var EmptyView = require('./EmptyView');
|
var EmptyView = require('./EmptyView');
|
||||||
var MoviesCollection = require('../MoviesCollection');
|
var MoviesCollection = require('../MoviesCollection');
|
||||||
//var FullMovieCollection = require('../FullMovieCollection');
|
|
||||||
//var InCinemasCell = require('../../Cells/InCinemasCell');
|
var FullMovieCollection = require('../FullMovieCollection');
|
||||||
|
var InCinemasCell = require('../../Cells/InCinemasCell');
|
||||||
|
|
||||||
var RelativeDateCell = require('../../Cells/RelativeDateCell');
|
var RelativeDateCell = require('../../Cells/RelativeDateCell');
|
||||||
|
|
||||||
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
var MovieTitleCell = require('../../Cells/MovieTitleCell');
|
||||||
var TemplatedCell = require('../../Cells/TemplatedCell');
|
var TemplatedCell = require('../../Cells/TemplatedCell');
|
||||||
var ProfileCell = require('../../Cells/ProfileCell');
|
var ProfileCell = require('../../Cells/ProfileCell');
|
||||||
@ -22,7 +25,7 @@ var FooterModel = require('./FooterModel');
|
|||||||
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
var ToolbarLayout = require('../../Shared/Toolbar/ToolbarLayout');
|
||||||
require('../../Mixins/backbone.signalr.mixin');
|
require('../../Mixins/backbone.signalr.mixin');
|
||||||
|
|
||||||
var MoviesCollectionClient = require('../MoviesCollectionClient');
|
//var MoviesCollectionClient = require('../MoviesCollectionClient');
|
||||||
|
|
||||||
|
|
||||||
//this variable prevents double fetching the FullMovieCollection on first load
|
//this variable prevents double fetching the FullMovieCollection on first load
|
||||||
@ -134,47 +137,28 @@ module.exports = Marionette.Layout.extend({
|
|||||||
|
|
||||||
initialize : function() {
|
initialize : function() {
|
||||||
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
//this variable prevents us from showing the list before seriesCollection has been fetched the first time
|
||||||
this.renderedOnce = false;
|
|
||||||
this.seriesCollection = MoviesCollection;//.clone();
|
this.seriesCollection = MoviesCollection;//.clone();
|
||||||
this.seriesCollection.bindSignalR();
|
this.seriesCollection.bindSignalR();
|
||||||
|
|
||||||
|
this.listenTo(FullMovieCollection, 'sync', function() {
|
||||||
|
|
||||||
/*var selected = MoviesCollectionClient.fullCollection.where( { saved : true });
|
|
||||||
|
|
||||||
_.each(selected, function(model) {
|
|
||||||
model.set('saved', false);
|
|
||||||
});*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (window.shownOnce) {
|
|
||||||
// FullMovieCollection.fetch({reset : true});
|
|
||||||
//}
|
|
||||||
|
|
||||||
this.listenTo(MoviesCollectionClient, 'sync', function(eventName) {
|
|
||||||
this._showFooter();
|
this._showFooter();
|
||||||
window.shownOnce = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.seriesCollection, 'sync', function(model, collection, options) {
|
this.listenTo(this.seriesCollection, 'sync', function(model, collection, options) {
|
||||||
this._renderView();
|
this._renderView();
|
||||||
//MoviesCollectionClient.fetch();
|
//MoviesCollectionClient.fetch();
|
||||||
this.renderedOnce = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.seriesCollection, "change", function(model) {
|
this.listenTo(this.seriesCollection, "change", function(model) {
|
||||||
if (model.get('saved')) {
|
if (model.get('saved')) {
|
||||||
model.set('saved', false);
|
model.set('saved', false);
|
||||||
this.seriesCollection.fetch();
|
this.seriesCollection.fetch();
|
||||||
//FullMovieCollection.fetch({reset : true });
|
//FullMovieCollection.fetch({reset : true });
|
||||||
//this._showFooter();
|
//this._showFooter();
|
||||||
var m = MoviesCollectionClient.fullCollection.findWhere( { tmdbId : model.get('tmdbId') });
|
var m = FullMovieCollection.findWhere( { tmdbId : model.get('tmdbId') });
|
||||||
m.set('monitored', model.get('monitored'));
|
m.set('monitored', model.get('monitored'));
|
||||||
m.set('minimumAvailability', model.get('minimumAvailability'));
|
m.set('minimumAvailability', model.get('minimumAvailability'));
|
||||||
m.set( {profileId : model.get('profileId') } );
|
m.set( {profileId : model.get('profileId') } );
|
||||||
|
|
||||||
|
|
||||||
this._showFooter();
|
this._showFooter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -184,7 +168,7 @@ module.exports = Marionette.Layout.extend({
|
|||||||
if (model.get('deleted')) {
|
if (model.get('deleted')) {
|
||||||
this.seriesCollection.fetch(); //need to do this so that the page shows a full page and the 'total records' number is updated
|
this.seriesCollection.fetch(); //need to do this so that the page shows a full page and the 'total records' number is updated
|
||||||
//FullMovieCollection.fetch({reset : true}); //need to do this to update the footer
|
//FullMovieCollection.fetch({reset : true}); //need to do this to update the footer
|
||||||
MoviesCollectionClient.fullCollection.remove(model);
|
FullMovieCollection.remove(model);
|
||||||
this._showFooter();
|
this._showFooter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,10 +287,11 @@ module.exports = Marionette.Layout.extend({
|
|||||||
|
|
||||||
onShow : function() {
|
onShow : function() {
|
||||||
this._showToolbar();
|
this._showToolbar();
|
||||||
//if (window.shownOnce) {
|
this._fetchCollection();
|
||||||
|
if (window.shownOnce) {
|
||||||
this._showFooter();
|
this._showFooter();
|
||||||
//}
|
}
|
||||||
//this._fetchCollection();
|
window.shownOnce = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_showTable : function() {
|
_showTable : function() {
|
||||||
@ -316,10 +301,8 @@ module.exports = Marionette.Layout.extend({
|
|||||||
className : 'table table-hover'
|
className : 'table table-hover'
|
||||||
});
|
});
|
||||||
|
|
||||||
//this._showPager();
|
this._showPager();
|
||||||
if (this.renderedOnce) {
|
|
||||||
this._renderView();
|
this._renderView();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_showList : function() {
|
_showList : function() {
|
||||||
@ -350,13 +333,19 @@ module.exports = Marionette.Layout.extend({
|
|||||||
this.toolbar.close();
|
this.toolbar.close();
|
||||||
this.toolbar2.close();
|
this.toolbar2.close();
|
||||||
} else {
|
} else {
|
||||||
|
this.renderedOnce = true;
|
||||||
this.seriesRegion.show(this.currentView);
|
this.seriesRegion.show(this.currentView);
|
||||||
this._showToolbar();
|
this.listenTo(this.currentView.collection, 'sync', function(eventName){
|
||||||
this._showPager();
|
this._showPager();
|
||||||
|
});
|
||||||
|
this._showToolbar();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_fetchCollection : function() {
|
||||||
|
this.seriesCollection.fetch();
|
||||||
|
},
|
||||||
|
|
||||||
_setFilter : function(buttonContext) {
|
_setFilter : function(buttonContext) {
|
||||||
var mode = buttonContext.model.get('key');
|
var mode = buttonContext.model.get('key');
|
||||||
this.seriesCollection.setFilterMode(mode);
|
this.seriesCollection.setFilterMode(mode);
|
||||||
@ -401,7 +390,7 @@ module.exports = Marionette.Layout.extend({
|
|||||||
|
|
||||||
_showFooter : function() {
|
_showFooter : function() {
|
||||||
var footerModel = new FooterModel();
|
var footerModel = new FooterModel();
|
||||||
var movies = MoviesCollectionClient.fullCollection.models.length;
|
var movies = FullMovieCollection.models.length;
|
||||||
//instead of all the counters could do something like this with different query in the where...
|
//instead of all the counters could do something like this with different query in the where...
|
||||||
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
//var releasedMovies = FullMovieCollection.where({ 'released' : this.model.get('released') });
|
||||||
// releasedMovies.length
|
// releasedMovies.length
|
||||||
@ -421,7 +410,7 @@ module.exports = Marionette.Layout.extend({
|
|||||||
var downloadedMonitored=0;
|
var downloadedMonitored=0;
|
||||||
var downloadedNotMonitored=0;
|
var downloadedNotMonitored=0;
|
||||||
|
|
||||||
_.each(MoviesCollectionClient.fullCollection.models, function(model) {
|
_.each(FullMovieCollection.models, function(model) {
|
||||||
|
|
||||||
if (model.get('status').toLowerCase() === 'released') {
|
if (model.get('status').toLowerCase() === 'released') {
|
||||||
released++;
|
released++;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
var movieCollection = require('./MoviesCollection');
|
var movieCollection = require('./MoviesCollection');
|
||||||
|
|
||||||
var GCCollection = movieCollection.clone();
|
var ClientCollection = movieCollection.clone();
|
||||||
GCCollection.bindSignalR();
|
ClientCollection.bindSignalR();
|
||||||
GCCollection.switchMode('client'); //state.pageSize = 100000;
|
ClientCollection.switchMode('client'); //state.pageSize = 100000;
|
||||||
//CCollection.fetch();
|
module.exports = ClientCollection;
|
||||||
module.exports = GCCollection;
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
var NzbDroneController = require('../Shared/NzbDroneController');
|
var NzbDroneController = require('../Shared/NzbDroneController');
|
||||||
var AppLayout = require('../AppLayout');
|
var AppLayout = require('../AppLayout');
|
||||||
var MoviesCollection = require('./MoviesCollection');
|
var MoviesCollection = require('./MoviesCollection');
|
||||||
//var FullMovieCollection = require("./FullMovieCollection");
|
var FullMovieCollection = require("./FullMovieCollection");
|
||||||
var MoviesCollectionClient = require('./MoviesCollectionClient');
|
|
||||||
var MoviesIndexLayout = require('./Index/MoviesIndexLayout');
|
var MoviesIndexLayout = require('./Index/MoviesIndexLayout');
|
||||||
var MoviesDetailsLayout = require('./Details/MoviesDetailsLayout');
|
var MoviesDetailsLayout = require('./Details/MoviesDetailsLayout');
|
||||||
|
|
||||||
@ -23,10 +22,11 @@ module.exports = NzbDroneController.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
seriesDetails : function(query) {
|
seriesDetails : function(query) {
|
||||||
if(MoviesCollectionClient.fullCollection.length > 0) {
|
|
||||||
|
if(FullMovieCollection.length > 0) {
|
||||||
this._renderMovieDetails(query);
|
this._renderMovieDetails(query);
|
||||||
} else {
|
} else {
|
||||||
this.listenTo(MoviesCollectionClient, 'sync', function(model, options) {
|
this.listenTo(FullMovieCollection, 'sync', function(model, options) {
|
||||||
this._renderMovieDetails(query);
|
this._renderMovieDetails(query);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ module.exports = NzbDroneController.extend({
|
|||||||
|
|
||||||
|
|
||||||
_renderMovieDetails: function(query) {
|
_renderMovieDetails: function(query) {
|
||||||
var movies = MoviesCollectionClient.fullCollection.where({ titleSlug : query });
|
var movies = FullMovieCollection.where({ titleSlug : query });
|
||||||
if (movies.length !== 0) {
|
if (movies.length !== 0) {
|
||||||
var targetMovie = movies[0];
|
var targetMovie = movies[0];
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ var _ = require('underscore');
|
|||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
var vent = require('vent');
|
var vent = require('vent');
|
||||||
var Backbone = require('backbone');
|
var Backbone = require('backbone');
|
||||||
//var FullMovieCollection = require('../Movies/FullMovieCollection');
|
var FullMovieCollection = require('../Movies/FullMovieCollection');
|
||||||
var MoviesCollectionClient = require('../Movies/MoviesCollectionClient');
|
|
||||||
require('typeahead');
|
require('typeahead');
|
||||||
|
|
||||||
vent.on(vent.Hotkeys.NavbarSearch, function() {
|
vent.on(vent.Hotkeys.NavbarSearch, function() {
|
||||||
@ -12,7 +11,7 @@ vent.on(vent.Hotkeys.NavbarSearch, function() {
|
|||||||
|
|
||||||
var substringMatcher = function() {
|
var substringMatcher = function() {
|
||||||
return function findMatches (q, cb) {
|
return function findMatches (q, cb) {
|
||||||
var matches = _.select(MoviesCollectionClient.fullCollection.toJSON(), function(series) {
|
var matches = _.select(FullMovieCollection.toJSON(), function(series) {
|
||||||
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
|
return series.title.toLowerCase().indexOf(q.toLowerCase()) > -1;
|
||||||
});
|
});
|
||||||
cb(matches);
|
cb(matches);
|
||||||
|
Loading…
Reference in New Issue
Block a user