This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs TryGhost/Ghost#7860 - remove preview pane from content screen - add basic post status filters - replace custom infinite scroll with ember-infinity and increase trigger threshold for improved scroll behaviour Commits: * basic content list + filter using existing infinite scroll and pagination * swap our custom pagination + infinite loader for `ember-infinity` * minor cleanups * reset scroll position when changing filter * fix tests * remove client-side sorting step as we no longer have a live collection * remove unused `mobile-index-route` * add acceptance tests for content screen filters
- Loading branch information
1 parent
1189c1b
commit b73a3f0
Showing
27 changed files
with
502 additions
and
596 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,5 @@ | ||
import Ember from 'ember'; | ||
import Controller from 'ember-controller'; | ||
import computed, {equal} from 'ember-computed'; | ||
import injectService from 'ember-service/inject'; | ||
|
||
const {compare} = Ember; | ||
|
||
export default Controller.extend({ | ||
feature: injectService(), | ||
|
||
showDeletePostModal: false, | ||
|
||
// See PostsRoute's shortcuts | ||
postListFocused: equal('keyboardFocus', 'postList'), | ||
postContentFocused: equal('keyboardFocus', 'postContent'), | ||
|
||
sortedPosts: computed('model.@each.{status,publishedAtUTC,isNew,updatedAtUTC}', function () { | ||
return this.get('model').toArray().sort(compare); | ||
}), | ||
|
||
actions: { | ||
toggleDeletePostModal() { | ||
this.toggleProperty('showDeletePostModal'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Controller from 'ember-controller'; | ||
import computed from 'ember-computed'; | ||
import injectService from 'ember-service/inject'; | ||
|
||
export default Controller.extend({ | ||
|
||
queryParams: ['type'], | ||
type: null, | ||
|
||
session: injectService(), | ||
|
||
showDeletePostModal: false, | ||
|
||
showingAll: computed('type', function () { | ||
return this.get('type') === null; | ||
}), | ||
|
||
actions: { | ||
toggleDeletePostModal() { | ||
this.toggleProperty('showDeletePostModal'); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,5 @@ | ||
import $ from 'jquery'; | ||
import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; | ||
import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route'; | ||
import PaginationMixin from 'ghost-admin/mixins/pagination'; | ||
|
||
export default AuthenticatedRoute.extend(ShortcutsRoute, PaginationMixin, { | ||
titleToken: 'Content', | ||
|
||
paginationModel: 'post', | ||
paginationSettings: { | ||
status: 'all', | ||
staticPages: 'all' | ||
}, | ||
|
||
model() { | ||
let paginationSettings = this.get('paginationSettings'); | ||
|
||
return this.get('session.user').then((user) => { | ||
if (user.get('isAuthor')) { | ||
paginationSettings.filter = paginationSettings.filter | ||
? `${paginationSettings.filter}+author:${user.get('slug')}` : `author:${user.get('slug')}`; | ||
} | ||
|
||
return this.loadFirstPage().then(() => { | ||
// using `.filter` allows the template to auto-update when new models are pulled in from the server. | ||
// we just need to 'return true' to allow all models by default. | ||
return this.store.filter('post', (post) => { | ||
if (user.get('isAuthor')) { | ||
return post.isAuthoredByUser(user); | ||
} | ||
|
||
return true; | ||
}); | ||
}); | ||
}); | ||
}, | ||
|
||
stepThroughPosts(step) { | ||
let currentPost = this.get('controller.currentPost'); | ||
let posts = this.get('controller.sortedPosts'); | ||
let length = posts.get('length'); | ||
let newPosition = posts.indexOf(currentPost) + step; | ||
|
||
// if we are on the first or last item | ||
// just do nothing (desired behavior is to not | ||
// loop around) | ||
if (newPosition >= length) { | ||
return; | ||
} else if (newPosition < 0) { | ||
return; | ||
} | ||
|
||
this.transitionTo('posts.post', posts.objectAt(newPosition)); | ||
}, | ||
|
||
scrollContent(amount) { | ||
let content = $('.js-content-preview'); | ||
let scrolled = content.scrollTop(); | ||
|
||
content.scrollTop(scrolled + 50 * amount); | ||
}, | ||
|
||
shortcuts: { | ||
'up, k': 'moveUp', | ||
'down, j': 'moveDown', | ||
left: 'focusList', | ||
right: 'focusContent', | ||
c: 'newPost' | ||
}, | ||
|
||
actions: { | ||
focusList() { | ||
this.controller.set('keyboardFocus', 'postList'); | ||
}, | ||
|
||
focusContent() { | ||
this.controller.set('keyboardFocus', 'postContent'); | ||
}, | ||
|
||
newPost() { | ||
this.transitionTo('editor.new'); | ||
}, | ||
|
||
moveUp() { | ||
if (this.controller.get('postContentFocused')) { | ||
this.scrollContent(-1); | ||
} else { | ||
this.stepThroughPosts(-1); | ||
} | ||
}, | ||
|
||
moveDown() { | ||
if (this.controller.get('postContentFocused')) { | ||
this.scrollContent(1); | ||
} else { | ||
this.stepThroughPosts(1); | ||
} | ||
} | ||
} | ||
export default AuthenticatedRoute.extend({ | ||
titleToken: 'Content' | ||
}); |
Oops, something went wrong.