From a045cc11fe0291ac7e0c14bfce0d3ae12a52d56d Mon Sep 17 00:00:00 2001 From: Joe Sak Date: Wed, 16 Feb 2011 00:13:46 -0600 Subject: Add controller action and view template for uncategorized posts --- app/controllers/admin/blog/posts_controller.rb | 7 ++++++ app/views/admin/blog/posts/uncategorized.html.erb | 26 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 app/views/admin/blog/posts/uncategorized.html.erb (limited to 'app') diff --git a/app/controllers/admin/blog/posts_controller.rb b/app/controllers/admin/blog/posts_controller.rb index bd5dd49..1b6efc3 100644 --- a/app/controllers/admin/blog/posts_controller.rb +++ b/app/controllers/admin/blog/posts_controller.rb @@ -3,6 +3,13 @@ class Admin::Blog::PostsController < Admin::BaseController crudify :blog_post, :title_attribute => :title, :order => 'published_at DESC' + + def uncategorized + @blog_posts = BlogPost.uncategorized.paginate({ + :page => params[:page], + :per_page => BlogPost.per_page + }) + end before_filter :find_all_categories, :only => [:new, :edit, :create, :update] diff --git a/app/views/admin/blog/posts/uncategorized.html.erb b/app/views/admin/blog/posts/uncategorized.html.erb new file mode 100644 index 0000000..888daab --- /dev/null +++ b/app/views/admin/blog/posts/uncategorized.html.erb @@ -0,0 +1,26 @@ +<%= render :partial => '/admin/blog/submenu' %> +
+ <% if searching? %> +

<%= t('shared.admin.search.results_for', :query => params[:search]) %>

+ <% if @blog_posts.any? %> + <%= render :partial => "blog_posts", + :collection => @blog_posts %> + <% else %> +

<%= t('admin.search_no_results') %>

+ <% end %> + <% else %> + <% if @blog_posts.any? %> + <%= will_paginate @blog_posts %> + + <%= render :partial => "sortable_list" %> + + <%= will_paginate @blog_posts %> + <% else %> +

+ + <%= t('.no_items_yet', :create => t('admin.blog.submenu.posts.new')) %> + +

+ <% end %> + <% end %> +
-- cgit v1.2.3