diff -r 3b2e76f5f3ca -r 70451a4dc9ae cms/app-client/app/components/playlist-component.js --- a/cms/app-client/app/components/playlist-component.js Mon Oct 17 00:33:28 2016 +0530 +++ b/cms/app-client/app/components/playlist-component.js Mon Oct 17 14:50:30 2016 +0530 @@ -7,6 +7,7 @@ filter: Ember.inject.service(), player: Ember.inject.service(), + model: [], documents: Ember.computed('model', 'filter.location', 'filter.language', 'filter.discourse', 'filter.date', 'filter.theme', function() { return this.get('model'); }), @@ -24,22 +25,20 @@ if(this.$() && this.get('player').get('item')) { var ul = this.$().find('ul'); var li = this.$().find('li#' + this.get('player').get('item').replace('.', '\\.').replace('/', '\\/')); - if(li.offset().top - ul.offset().top < 0) { - ul.animate({ - 'scrollTop': ul.scrollTop() + li.offset().top - ul.offset().top - }); - } else if(li.offset().top + li.outerHeight() - ul.offset().top > ul.outerHeight()) { - ul.animate({ - 'scrollTop': ul.scrollTop() + li.offset().top + li.outerHeight() - ul.offset().top - ul.height() - }); + if(li.length) { + if(li.offset().top - ul.offset().top < 0) { + ul.animate({ + 'scrollTop': ul.scrollTop() + li.offset().top - ul.offset().top + }); + } else if(li.offset().top + li.outerHeight() - ul.offset().top > ul.outerHeight()) { + ul.animate({ + 'scrollTop': ul.scrollTop() + li.offset().top + li.outerHeight() - ul.offset().top - ul.height() + }); + } } } }), - init: function() { - this._super(...arguments); - }, - didRender: function() { this._super(...arguments); this.$().find('ul').height(Ember.$('.corpus-app-wrapper').outerHeight() - (Ember.$('.filter-component').outerHeight() + this.$().find('h2').outerHeight())); @@ -47,6 +46,14 @@ actions: { + previous: function() { + this.sendAction('pageAction', 'previous'); + }, + + next: function() { + this.sendAction('pageAction', 'next'); + }, + select: function(id) { this.get('player').select(id); this.get('player').displayMetadata('notice');