diff options
| author | rr- | 2016-10-02 17:04:56 +0200 |
|---|---|---|
| committer | rr- | 2016-10-02 17:07:08 +0200 |
| commit | b0c50310011eaafd55956ddea4b2d37b3556fc7e (patch) | |
| tree | 24ba5b1f7d092e0e1ec256024ab1105bf4f0dcb0 /client | |
| parent | 8f275206af77b4c34f58f2aca9354d36d9cfcd6a (diff) | |
client+server/posts: reverse next/prev post role
In the post list, when we navigate to the page with ">" button, we
navigate to older posts.
In the post view, when we navigate to the page with ">" button, we
navigate to older posts as well.
However, in the post list, the ">" button is called "next page".
At the same time, in the post view, the ">" button was called "previous
post". Now it's called "next post".
The difference isn't visible to normal users nor even API consumers as
the "get posts around post X" request isn't documented.
The change is motivated not only by consistency, but to also improve
compatibility with Vimperator's `[[` and `]]`. Vimperator assumes the
word "next" refers to ">" and the word "previous" refers to "<".
Diffstat (limited to 'client')
| -rw-r--r-- | client/html/post.tpl | 20 | ||||
| -rw-r--r-- | client/js/controllers/post_controller.js | 2 | ||||
| -rw-r--r-- | client/js/views/post_view.js | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/client/html/post.tpl b/client/html/post.tpl index a1f7518..07ade0b 100644 --- a/client/html/post.tpl +++ b/client/html/post.tpl @@ -1,32 +1,32 @@ <div class='content-wrapper transparent post-view'> <aside class='sidebar'> <nav class='buttons'> - <article class='next-post'> - <% if (ctx.nextPostId) { %> + <article class='previous-post'> + <% if (ctx.prevPostId) { %> <% if (ctx.editMode) { %> - <a href='<%= ctx.getPostEditUrl(ctx.nextPostId, ctx.parameters) %>'> + <a href='<%= ctx.getPostEditUrl(ctx.prevPostId, ctx.parameters) %>'> <% } else { %> - <a href='<%= ctx.getPostUrl(ctx.nextPostId, ctx.parameters) %>'> + <a href='<%= ctx.getPostUrl(ctx.prevPostId, ctx.parameters) %>'> <% } %> <% } else { %> <a class='inactive'> <% } %> <i class='fa fa-chevron-left'></i> - <span class='vim-nav-hint'>< Next post</span> + <span class='vim-nav-hint'>< Previous post</span> </a> </article> - <article class='previous-post'> - <% if (ctx.prevPostId) { %> + <article class='next-post'> + <% if (ctx.nextPostId) { %> <% if (ctx.editMode) { %> - <a href='<%= ctx.getPostEditUrl(ctx.prevPostId, ctx.parameters) %>'> + <a href='<%= ctx.getPostEditUrl(ctx.nextPostId, ctx.parameters) %>'> <% } else { %> - <a href='<%= ctx.getPostUrl(ctx.prevPostId, ctx.parameters) %>'> + <a href='<%= ctx.getPostUrl(ctx.nextPostId, ctx.parameters) %>'> <% } %> <% } else { %> <a class='inactive'> <% } %> <i class='fa fa-chevron-right'></i> - <span class='vim-nav-hint'>Previous post ></span> + <span class='vim-nav-hint'>Next post ></span> </a> </article> <article class='edit-post'> diff --git a/client/js/controllers/post_controller.js b/client/js/controllers/post_controller.js index 7644e26..384643a 100644 --- a/client/js/controllers/post_controller.js +++ b/client/js/controllers/post_controller.js @@ -45,8 +45,8 @@ class PostController { this._view = new PostView({ post: post, editMode: editMode, - nextPostId: aroundResponse.next ? aroundResponse.next.id : null, prevPostId: aroundResponse.prev ? aroundResponse.prev.id : null, + nextPostId: aroundResponse.next ? aroundResponse.next.id : null, canEditPosts: api.hasPrivilege('posts:edit'), canDeletePosts: api.hasPrivilege('posts:delete'), canFeaturePosts: api.hasPrivilege('posts:feature'), diff --git a/client/js/views/post_view.js b/client/js/views/post_view.js index 87d19ac..256eb2d 100644 --- a/client/js/views/post_view.js +++ b/client/js/views/post_view.js @@ -67,13 +67,13 @@ class PostView { } }); keyboard.bind(['a', 'left'], () => { - if (ctx.nextPostId) { - router.show('/post/' + ctx.nextPostId); + if (ctx.prevPostId) { + router.show('/post/' + ctx.prevPostId); } }); keyboard.bind(['d', 'right'], () => { - if (ctx.prevPostId) { - router.show('/post/' + ctx.prevPostId); + if (ctx.nextPostId) { + router.show('/post/' + ctx.nextPostId); } }); } |