Skip to content

Commit

Permalink
Always get latest post from API when editing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jaswilli committed Jun 18, 2015
1 parent 8fe8f8a commit 7e3cf6e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
6 changes: 0 additions & 6 deletions core/client/app/routes/editor/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var EditorEditRoute = AuthenticatedRoute.extend(base, {

model: function (params) {
var self = this,
post,
postId,
query;

Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion core/client/app/routes/posts/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
2 changes: 1 addition & 1 deletion core/client/app/templates/posts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}>
Expand Down
4 changes: 2 additions & 2 deletions core/client/app/templates/posts/post.hbs
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit 7e3cf6e

Please sign in to comment.