Browse Source

Update counter on movie add / delete

fix #1383
pull/1765/head
Ruud 12 years ago
parent
commit
1258f34c78
  1. 11
      couchpotato/core/plugins/movie/static/list.js

11
couchpotato/core/plugins/movie/static/list.js

@ -63,7 +63,8 @@ var MovieList = new Class({
self.movies.each(function(movie){
if(movie.get('id') == notification.data.id){
movie.destroy();
delete self.movies_added[notification.data.id]
delete self.movies_added[notification.data.id];
self.setCounter(self.counter_count-1);
}
})
}
@ -77,6 +78,7 @@ var MovieList = new Class({
if(self.options.add_new && !self.movies_added[notification.data.id] && notification.data.status.identifier == self.options.status){
window.scroll(0,0);
self.createMovie(notification.data, 'top');
self.setCounter(self.counter_count+1);
self.checkIfEmpty();
}
@ -126,6 +128,7 @@ var MovieList = new Class({
if(!self.navigation_counter) return;
self.counter_count = count;
self.navigation_counter.set('text', (count || 0) + ' movies');
if (self.empty_message) {
@ -377,14 +380,14 @@ var MovieList = new Class({
self.movies.each(function(movie){
if (movie.isSelected()){
$(movie).destroy()
erase_movies.include(movie)
erase_movies.include(movie);
}
});
erase_movies.each(function(movie){
self.movies.erase(movie);
movie.destroy()
movie.destroy();
self.setCounter(self.counter_count-1);
});
self.calculateSelected();

Loading…
Cancel
Save