Merge pull request #5452 from jaswilli/issue-5450

Always get latest post from API when editing
This commit is contained in:
Hannah Wolfe 2015-06-19 15:04:22 +01:00
commit 6ea411c3b4
4 changed files with 4 additions and 10 deletions

View File

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

View File

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

View File

@ -11,7 +11,7 @@
{{#view "paginated-scroll-box" tagName="section" classNames="content-list-content js-content-scrollbox"}}
<ol class="posts-list">
{{#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>
<section class="entry-meta">
<span class="avatar" style={{post.authorAvatarBackground}}>

View File

@ -1,10 +1,10 @@
<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>
{{#view "content-preview-content-view" tagName="section"}}
<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}}
</div>
{{/view}}