5 classNames: ['playlist-component'], |
5 classNames: ['playlist-component'], |
6 |
6 |
7 filter: Ember.inject.service(), |
7 filter: Ember.inject.service(), |
8 player: Ember.inject.service(), |
8 player: Ember.inject.service(), |
9 |
9 |
|
10 model: [], |
10 documents: Ember.computed('model', 'filter.location', 'filter.language', 'filter.discourse', 'filter.date', 'filter.theme', function() { |
11 documents: Ember.computed('model', 'filter.location', 'filter.language', 'filter.discourse', 'filter.date', 'filter.theme', function() { |
11 return this.get('model'); |
12 return this.get('model'); |
12 }), |
13 }), |
13 |
14 |
14 documentsLoaded: Ember.observer('documents', function() { |
15 documentsLoaded: Ember.observer('documents', function() { |
22 |
23 |
23 playerItemObserver: Ember.observer('player.item', function() { |
24 playerItemObserver: Ember.observer('player.item', function() { |
24 if(this.$() && this.get('player').get('item')) { |
25 if(this.$() && this.get('player').get('item')) { |
25 var ul = this.$().find('ul'); |
26 var ul = this.$().find('ul'); |
26 var li = this.$().find('li#' + this.get('player').get('item').replace('.', '\\.').replace('/', '\\/')); |
27 var li = this.$().find('li#' + this.get('player').get('item').replace('.', '\\.').replace('/', '\\/')); |
27 if(li.offset().top - ul.offset().top < 0) { |
28 if(li.length) { |
28 ul.animate({ |
29 if(li.offset().top - ul.offset().top < 0) { |
29 'scrollTop': ul.scrollTop() + li.offset().top - ul.offset().top |
30 ul.animate({ |
30 }); |
31 'scrollTop': ul.scrollTop() + li.offset().top - ul.offset().top |
31 } else if(li.offset().top + li.outerHeight() - ul.offset().top > ul.outerHeight()) { |
32 }); |
32 ul.animate({ |
33 } else if(li.offset().top + li.outerHeight() - ul.offset().top > ul.outerHeight()) { |
33 'scrollTop': ul.scrollTop() + li.offset().top + li.outerHeight() - ul.offset().top - ul.height() |
34 ul.animate({ |
34 }); |
35 'scrollTop': ul.scrollTop() + li.offset().top + li.outerHeight() - ul.offset().top - ul.height() |
|
36 }); |
|
37 } |
35 } |
38 } |
36 } |
39 } |
37 }), |
40 }), |
38 |
|
39 init: function() { |
|
40 this._super(...arguments); |
|
41 }, |
|
42 |
41 |
43 didRender: function() { |
42 didRender: function() { |
44 this._super(...arguments); |
43 this._super(...arguments); |
45 this.$().find('ul').height(Ember.$('.corpus-app-wrapper').outerHeight() - (Ember.$('.filter-component').outerHeight() + this.$().find('h2').outerHeight())); |
44 this.$().find('ul').height(Ember.$('.corpus-app-wrapper').outerHeight() - (Ember.$('.filter-component').outerHeight() + this.$().find('h2').outerHeight())); |
46 }, |
45 }, |
47 |
46 |
48 actions: { |
47 actions: { |
|
48 |
|
49 previous: function() { |
|
50 this.sendAction('pageAction', 'previous'); |
|
51 }, |
|
52 |
|
53 next: function() { |
|
54 this.sendAction('pageAction', 'next'); |
|
55 }, |
49 |
56 |
50 select: function(id) { |
57 select: function(id) { |
51 this.get('player').select(id); |
58 this.get('player').select(id); |
52 this.get('player').displayMetadata('notice'); |
59 this.get('player').displayMetadata('notice'); |
53 }, |
60 }, |