diff --git a/couchpotato/core/plugins/movie/static/list.js b/couchpotato/core/plugins/movie/static/list.js index 1a15b1d9..7e606abf 100644 --- a/couchpotato/core/plugins/movie/static/list.js +++ b/couchpotato/core/plugins/movie/static/list.js @@ -14,6 +14,7 @@ var MovieList = new Class({ movies: [], movies_added: {}, + total_movies: 0, letters: {}, filter: null, @@ -23,7 +24,7 @@ var MovieList = new Class({ self.offset = 0; self.filter = self.options.filter || { - 'startswith': null, + 'starts_with': null, 'search': null } @@ -115,7 +116,7 @@ var MovieList = new Class({ self.createMovie(movie); }); - self.total_movies = total; + self.total_movies += total; self.setCounter(total); }, @@ -127,6 +128,38 @@ var MovieList = new Class({ self.navigation_counter.set('text', (count || 0) + ' movies'); + if (self.empty_message) { + self.empty_message.destroy(); + self.empty_message = null; + } + + if(count == 0 && !self.empty_message){ + var message = (self.filter.search ? 'for "'+self.filter.search+'"' : '') + + (self.filter.starts_with ? ' in '+self.filter.starts_with+'' : ''); + + self.empty_message = new Element('.message', { + 'html': 'No movies found ' + message + '.
' + }).grab( + new Element('a', { + 'text': 'Reset filter', + 'events': { + 'click': function(){ + self.filter = { + 'starts_with': null, + 'search': null + }; + self.navigation_search_input.set('value', ''); + self.reset(); + self.activateLetter(); + self.getMovies(true); + self.last_search_value = ''; + } + } + }) + ).inject(self.movie_list); + + } + }, createMovie: function(movie, inject_at){ diff --git a/couchpotato/core/plugins/movie/static/movie.css b/couchpotato/core/plugins/movie/static/movie.css index 2a082d24..37cdcdf4 100644 --- a/couchpotato/core/plugins/movie/static/movie.css +++ b/couchpotato/core/plugins/movie/static/movie.css @@ -9,6 +9,18 @@ clear: both; } + .movies > div .message { + display: block; + padding: 20px; + font-size: 20px; + color: white; + text-align: center; + } + .movies > div .message a { + padding: 20px; + display: block; + } + .movies.thumbs_list > div:not(.description) { margin-right: -4px; }