Update dashboard when the search ends of added new movie
This commit is contained in:
@@ -65,6 +65,7 @@ var MovieList = new Class({
|
|||||||
movie.destroy();
|
movie.destroy();
|
||||||
delete self.movies_added[notification.data.id];
|
delete self.movies_added[notification.data.id];
|
||||||
self.setCounter(self.counter_count-1);
|
self.setCounter(self.counter_count-1);
|
||||||
|
self.total_movies--;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -75,6 +76,7 @@ var MovieList = new Class({
|
|||||||
movieAdded: function(notification){
|
movieAdded: function(notification){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
self.fireEvent('movieAdded', notification);
|
||||||
if(self.options.add_new && !self.movies_added[notification.data.id] && notification.data.status.identifier == self.options.status){
|
if(self.options.add_new && !self.movies_added[notification.data.id] && notification.data.status.identifier == self.options.status){
|
||||||
window.scroll(0,0);
|
window.scroll(0,0);
|
||||||
self.createMovie(notification.data, 'top');
|
self.createMovie(notification.data, 'top');
|
||||||
@@ -390,6 +392,7 @@ var MovieList = new Class({
|
|||||||
self.movies.erase(movie);
|
self.movies.erase(movie);
|
||||||
movie.destroy();
|
movie.destroy();
|
||||||
self.setCounter(self.counter_count-1);
|
self.setCounter(self.counter_count-1);
|
||||||
|
self.total_movies--;
|
||||||
});
|
});
|
||||||
|
|
||||||
self.calculateSelected();
|
self.calculateSelected();
|
||||||
|
|||||||
@@ -57,6 +57,17 @@ Page.Home = new Class({
|
|||||||
'limit': null,
|
'limit': null,
|
||||||
'onLoaded': function(){
|
'onLoaded': function(){
|
||||||
self.chain.callChain();
|
self.chain.callChain();
|
||||||
|
},
|
||||||
|
'onMovieAdded': function(notification){
|
||||||
|
|
||||||
|
// Track movie added
|
||||||
|
var after_search = function(data){
|
||||||
|
// Force update after search
|
||||||
|
self.available_list.update();
|
||||||
|
App.removeEvent('movie.searcher.ended.' + notification.data.id, after_search);
|
||||||
|
}
|
||||||
|
App.addEvent('movie.searcher.ended.' + notification.data.id, after_search);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user