From 6ae881e91892f4be0cbe0700c5daf9424f4b97c5 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 3 Aug 2017 10:06:58 +0400 Subject: [PATCH] Remove unused gh-infinite-scroll component and infinite-scroll mixin no issue - this component and mixin has been replaced by `ember-infinity` --- .../app/components/gh-infinite-scroll.js | 10 ----- ghost/admin/app/mixins/infinite-scroll.js | 42 ------------------- .../components/gh-infinite-scroll.hbs | 1 - .../tests/unit/mixins/infinite-scroll-test.js | 18 -------- 4 files changed, 71 deletions(-) delete mode 100644 ghost/admin/app/components/gh-infinite-scroll.js delete mode 100644 ghost/admin/app/mixins/infinite-scroll.js delete mode 100644 ghost/admin/app/templates/components/gh-infinite-scroll.hbs delete mode 100644 ghost/admin/tests/unit/mixins/infinite-scroll-test.js diff --git a/ghost/admin/app/components/gh-infinite-scroll.js b/ghost/admin/app/components/gh-infinite-scroll.js deleted file mode 100644 index c72a4ebaca..0000000000 --- a/ghost/admin/app/components/gh-infinite-scroll.js +++ /dev/null @@ -1,10 +0,0 @@ -import Component from 'ember-component'; -import InfiniteScrollMixin from 'ghost-admin/mixins/infinite-scroll'; - -export default Component.extend(InfiniteScrollMixin, { - actions: { - checkScroll() { - this._checkScroll(); - } - } -}); diff --git a/ghost/admin/app/mixins/infinite-scroll.js b/ghost/admin/app/mixins/infinite-scroll.js deleted file mode 100644 index b740257015..0000000000 --- a/ghost/admin/app/mixins/infinite-scroll.js +++ /dev/null @@ -1,42 +0,0 @@ -import Mixin from 'ember-metal/mixin'; -import run from 'ember-runloop'; - -export default Mixin.create({ - isLoading: false, - triggerPoint: 100, - - /** - * Determines if we are past a scroll point where we need to fetch the next page - */ - _checkScroll() { - let element = this.get('element'); - let triggerPoint = this.get('triggerPoint'); - let isLoading = this.get('isLoading'); - - // If we haven't passed our threshold or we are already fetching content, exit - if (isLoading || (element.scrollTop + element.clientHeight + triggerPoint <= element.scrollHeight)) { - return; - } - - this.sendAction('fetch'); - }, - - didInsertElement() { - this._super(...arguments); - - let el = this.get('element'); - - el.onscroll = run.bind(this, this._checkScroll); - - // run on load, on the offchance that the initial load - // did not fill the view. - this._checkScroll(); - }, - - willDestroyElement() { - this._super(...arguments); - - // turn off the scroll handler - this.get('element').onscroll = null; - } -}); diff --git a/ghost/admin/app/templates/components/gh-infinite-scroll.hbs b/ghost/admin/app/templates/components/gh-infinite-scroll.hbs deleted file mode 100644 index adc76bdb1f..0000000000 --- a/ghost/admin/app/templates/components/gh-infinite-scroll.hbs +++ /dev/null @@ -1 +0,0 @@ -{{yield (action "checkScroll")}} diff --git a/ghost/admin/tests/unit/mixins/infinite-scroll-test.js b/ghost/admin/tests/unit/mixins/infinite-scroll-test.js deleted file mode 100644 index 3008cd4b9d..0000000000 --- a/ghost/admin/tests/unit/mixins/infinite-scroll-test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* jshint expr:true */ -import EmberObject from 'ember-object'; -import InfiniteScrollMixin from 'ghost-admin/mixins/infinite-scroll'; -import { - describe, - it -} from 'mocha'; -import {expect} from 'chai'; - -describe('Unit: Mixin: infinite-scroll', function () { - // Replace this with your real tests. - it('works', function () { - let InfiniteScrollObject = EmberObject.extend(InfiniteScrollMixin); - let subject = InfiniteScrollObject.create(); - - expect(subject).to.be.ok; - }); -});