Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

Commit

Permalink
admin page can now sort published by kudos
Browse files Browse the repository at this point in the history
  • Loading branch information
masukomi committed Jul 6, 2012
1 parent fe98d4f commit fce02e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/controllers/posts_controller.rb
Expand Up @@ -90,8 +90,13 @@ def admin
@placeholder_post = Post.new
#todo re-implement the paging mongoid style
all_published = nil
booleanify_params(params)
unless params[:tag]
all_published = Post.where(:draft=>false, :page=>false).order_by(:posted_at=>:desc).entries
if (not params[:by_kudos])
all_published = Post.where(:draft=>false, :page=>false).order_by(:posted_at=>:desc).entries
else
all_published = Post.loved.entries
end
else
all_published = Post.any_in({:tags_array => [params[:tag]]}).descending(:posted_at).entries
#BUG, this will currently include static pages
Expand Down
6 changes: 5 additions & 1 deletion app/views/posts/admin.html.haml
Expand Up @@ -21,7 +21,11 @@
#published
%h1
Published
= link_to 'Home', root_url, :class => 'button'
%div
Show
=link_to("the loved", '/admin/?by_kudos=true')
\/
=link_to("all", '/admin/')
.tags_list
-if @tags.size > 0
%ul.tags_list
Expand Down

0 comments on commit fce02e7

Please sign in to comment.