Search is now fixed too.

Leonardo Galli 8 years ago
parent 21fa96f78f
commit 15acb9d204

@ -2,7 +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 MoviesCollection = require('../../Movies/MoviesCollection'); var FullMovieCollection = require('../../Movies/FullMovieCollection');
module.exports = SelectAllCell.extend({ module.exports = SelectAllCell.extend({
_originalRender : SelectAllCell.prototype.render, _originalRender : SelectAllCell.prototype.render,
@ -13,7 +13,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 = MoviesCollection.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,6 +1,6 @@
var Marionette = require('marionette'); var Marionette = require('marionette');
var SearchResultView = require('./SearchResultView'); var SearchResultView = require('./SearchResultView');
var MoviesCollection = require('../Movies/MoviesCollection'); var FullMovieCollection = require('../Movies/FullMovieCollection');
var vent = require('vent'); var vent = require('vent');
module.exports = Marionette.CollectionView.extend({ module.exports = Marionette.CollectionView.extend({
@ -48,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 = MoviesCollection.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,7 +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 MoviesCollection = require('../Movies/MoviesCollection'); var FullMovieCollection = require('../Movies/FullMovieCollection');
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');
@ -106,7 +106,7 @@ var view = Marionette.ItemView.extend({
}, },
_configureTemplateHelpers : function() { _configureTemplateHelpers : function() {
var existingMovies = MoviesCollection.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();
} }
@ -217,7 +217,7 @@ var view = Marionette.ItemView.extend({
}); });
promise.done(function() { promise.done(function() {
MoviesCollection.add(self.model); FullMovieCollection.add(self.model);
self.close(); self.close();

Loading…
Cancel
Save