0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Always get latest post from API when editing

Closes #5450
- No longer provide the edit route a model when transitioning from the
  posts list/content screen and no longer check to see if a copy of the
  post already exists in the store from the model hook.
This commit is contained in:
Jason Williams 2015-06-18 11:53:40 -05:00
parent 8fe8f8a07b
commit 7e3cf6efd9
4 changed files with 4 additions and 10 deletions

View file

@ -8,7 +8,6 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, {
model: function (params) { model: function (params) {
var self = this, var self = this,
post,
postId, postId,
query; query;
@ -18,11 +17,6 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, {
return this.transitionTo('error404', 'editor/' + params.post_id); return this.transitionTo('error404', 'editor/' + params.post_id);
} }
post = this.store.getById('post', postId);
if (post) {
return post;
}
query = { query = {
id: postId, id: postId,
status: 'all', status: 'all',

View file

@ -61,7 +61,7 @@ var PostsPostRoute = AuthenticatedRoute.extend(ShortcutsRoute, {
actions: { actions: {
openEditor: function () { openEditor: function () {
this.transitionTo('editor.edit', this.get('controller.model')); this.transitionTo('editor.edit', this.get('controller.model.id'));
}, },
deletePost: function () { deletePost: function () {

View file

@ -11,7 +11,7 @@
{{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}} {{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}}
<ol class="posts-list"> <ol class="posts-list">
{{#each controller itemController="posts/post" itemView="post-item-view" itemTagName="li" as |post|}} {{#each controller itemController="posts/post" itemView="post-item-view" itemTagName="li" as |post|}}
{{#link-to "posts.post" post.model class="permalink" alternateActive=view.active title="Edit this post"}} {{#link-to "posts.post" post.model.id class="permalink" alternateActive=view.active title="Edit this post"}}
<h3 class="entry-title">{{post.model.title}}</h3> <h3 class="entry-title">{{post.model.title}}</h3>
<section class="entry-meta"> <section class="entry-meta">
<span class="avatar" style={{post.authorAvatarBackground}}> <span class="avatar" style={{post.authorAvatarBackground}}>

View file

@ -1,10 +1,10 @@
<section class="post-controls"> <section class="post-controls">
{{#link-to "editor.edit" model class="btn btn-minor post-edit"}}<i class="icon-edit"></i>{{/link-to}} {{#link-to "editor.edit" model.id class="btn btn-minor post-edit"}}<i class="icon-edit"></i>{{/link-to}}
</section> </section>
{{#view "content-preview-content-view" tagName="section"}} {{#view "content-preview-content-view" tagName="section"}}
<div class="wrapper"> <div class="wrapper">
<h1 class="content-preview-title">{{#link-to "editor.edit" model}}{{model.title}}{{/link-to}}</h1> <h1 class="content-preview-title">{{#link-to "editor.edit" model.id}}{{model.title}}{{/link-to}}</h1>
{{gh-format-html model.html}} {{gh-format-html model.html}}
</div> </div>
{{/view}} {{/view}}