2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
2014-06-07 23:07:25 +04:00
|
|
|
import setScrollClassName from 'ghost/utils/set-scroll-classname';
|
2014-07-20 20:42:03 +04:00
|
|
|
import PaginationViewMixin from 'ghost/mixins/pagination-view-infinite-scroll';
|
2014-06-07 23:07:25 +04:00
|
|
|
|
2014-09-10 05:22:11 +04:00
|
|
|
var PaginatedScrollBox = Ember.View.extend(PaginationViewMixin, {
|
2015-06-03 05:56:42 +03:00
|
|
|
/**
|
|
|
|
* attach the scroll class handler event
|
|
|
|
*/
|
2014-09-10 05:22:11 +04:00
|
|
|
attachScrollClassHandler: function () {
|
2014-05-24 07:25:20 +04:00
|
|
|
var el = this.$();
|
2014-06-07 23:07:25 +04:00
|
|
|
el.on('scroll', Ember.run.bind(el, setScrollClassName, {
|
|
|
|
target: el.closest('.content-list'),
|
|
|
|
offset: 10
|
|
|
|
}));
|
2015-06-03 05:56:42 +03:00
|
|
|
},
|
2014-10-25 01:09:50 +04:00
|
|
|
|
2015-06-03 05:56:42 +03:00
|
|
|
didInsertElement: function () {
|
|
|
|
this.attachScrollClassHandler();
|
|
|
|
},
|
|
|
|
|
|
|
|
willDestroyElement: function () {
|
|
|
|
// removes scroll class handler event
|
2014-09-10 05:22:11 +04:00
|
|
|
this.$().off('scroll');
|
2015-06-03 05:56:42 +03:00
|
|
|
}
|
2014-05-24 07:25:20 +04:00
|
|
|
});
|
|
|
|
|
2014-09-10 05:22:11 +04:00
|
|
|
export default PaginatedScrollBox;
|