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';
|
|
|
|
|
|
|
|
var PostContentView = Ember.View.extend({
|
|
|
|
classNames: ['content-preview-content'],
|
|
|
|
|
|
|
|
didInsertElement: function () {
|
|
|
|
var el = this.$();
|
|
|
|
el.on('scroll', Ember.run.bind(el, setScrollClassName, {
|
|
|
|
target: el.closest('.content-preview'),
|
|
|
|
offset: 10
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
2015-06-03 05:56:42 +03:00
|
|
|
contentObserver: Ember.observer('controller.content', function () {
|
2015-05-05 22:38:57 +03:00
|
|
|
var el = this.$();
|
|
|
|
|
|
|
|
if (el) {
|
|
|
|
el.closest('.content-preview').scrollTop(0);
|
|
|
|
}
|
2015-06-03 05:56:42 +03:00
|
|
|
}),
|
2014-08-19 14:29:49 +04:00
|
|
|
|
2014-06-07 23:07:25 +04:00
|
|
|
willDestroyElement: function () {
|
|
|
|
var el = this.$();
|
|
|
|
el.off('scroll');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default PostContentView;
|