fix post presenter / arrow ordering
This commit is contained in:
parent
7ec13d26ac
commit
30de08b340
4 changed files with 11 additions and 12 deletions
|
|
@ -33,7 +33,7 @@ class PostsController < ApplicationController
|
|||
respond_to do |format|
|
||||
format.xml{ render :xml => @post.to_diaspora_xml }
|
||||
format.mobile{render 'posts/show.mobile.haml'}
|
||||
format.json{ render :json => PostPresenter.new(@post).to_json }
|
||||
format.json{ render :json => PostPresenter.new(@post, current_user).to_json }
|
||||
format.any{render 'posts/show.html.haml', :layout => 'layouts/post'}
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ class Post < ActiveRecord::Base
|
|||
}
|
||||
|
||||
def self.next(post)
|
||||
where("posts.id > ?", post.id)
|
||||
where("posts.created_at > ?", post.created_at)
|
||||
end
|
||||
|
||||
def self.previous(post)
|
||||
where("posts.id < ?", post.id)
|
||||
where("posts.created_at < ?", post.created_at)
|
||||
end
|
||||
|
||||
def post_type
|
||||
|
|
|
|||
|
|
@ -41,11 +41,10 @@ class PostPresenter
|
|||
protected
|
||||
|
||||
def post_base
|
||||
scope = if current_user
|
||||
Post.owned_or_visible_by_user(current_user)
|
||||
if current_user
|
||||
current_user.posts_from(self.post.author)
|
||||
else
|
||||
Post.all_public
|
||||
self.post.author.posts.all_public
|
||||
end
|
||||
scope.where(:author_id => post.author_id)
|
||||
end
|
||||
end
|
||||
|
|
@ -39,8 +39,8 @@
|
|||
%i.icon-comment.icon-white
|
||||
|
||||
|
||||
= link_to image_tag('arrow-left.png'), '#', :class => 'nav-arrow left', :id => 'back'
|
||||
= link_to image_tag('arrow-right.png'), '#', :class => 'nav-arrow right', :id => 'forward'
|
||||
= link_to image_tag('arrow-left.png'), '#', :class => 'nav-arrow left', :id => 'forward'
|
||||
= link_to image_tag('arrow-right.png'), '#', :class => 'nav-arrow right', :id => 'back'
|
||||
|
||||
#comment.modal.fade
|
||||
.modal-header
|
||||
|
|
|
|||
Loading…
Reference in a new issue