Better editor entry

Ref #2308

- Double clicking a PostItemView on the content screen will open that post
  in the editor.
- Added `'ctrl+e, command+e': 'openEditor'` shortcut will open editor as well
This commit is contained in:
Matt Enlow 2014-06-21 08:44:53 -06:00
parent bcc135360c
commit 3cae5a55dd
3 changed files with 17 additions and 9 deletions

View File

@ -31,7 +31,7 @@ var PostsRoute = AuthenticatedRoute.extend(ShortcutsRoute, styleBody, loadingInd
}, },
actions: { actions: {
openEditor: function (post) { openEditor: function (post) {
this.transitionTo('editor', post); this.transitionTo('editor.edit', post);
}, },
moveUp: function () { moveUp: function () {
window.alert('@todo keyboard post navigation: up'); window.alert('@todo keyboard post navigation: up');

View File

@ -1,7 +1,8 @@
import AuthenticatedRoute from 'ghost/routes/authenticated'; import AuthenticatedRoute from 'ghost/routes/authenticated';
import loadingIndicator from 'ghost/mixins/loading-indicator'; import loadingIndicator from 'ghost/mixins/loading-indicator';
import ShortcutsRoute from 'ghost/mixins/shortcuts-route';
var PostsPostRoute = AuthenticatedRoute.extend(loadingIndicator, { var PostsPostRoute = AuthenticatedRoute.extend(loadingIndicator, ShortcutsRoute, {
model: function (params) { model: function (params) {
var self = this, var self = this,
post, post,
@ -33,6 +34,14 @@ var PostsPostRoute = AuthenticatedRoute.extend(loadingIndicator, {
return self.transitionTo('posts.index'); return self.transitionTo('posts.index');
}); });
}, },
shortcuts: {
'ctrl+e, command+e': 'openEditor'
},
actions: {
openEditor: function () {
this.transitionTo('editor.edit', this.get('controller.model'));
}
}
}); });
export default PostsPostRoute; export default PostsPostRoute;

View File

@ -7,12 +7,11 @@ var PostItemView = itemView.extend({
isPage: Ember.computed.alias('controller.model.page'), isPage: Ember.computed.alias('controller.model.page'),
// WIP for #2308 //Edit post on double click
/* doubleClick: function () {
openEditor: function () { this.get('controller').send('openEditor', this.get('controller.model'));
this.get('controller').send('openEditor', this.get('controller.model')); // send action to handle transition to editor route }
}.on('doubleClick')
*/
}); });
export default PostItemView; export default PostItemView;