diff options
-rw-r--r-- | app/decorators/models/refinery/blog_category_decorator.rb | 2 | ||||
-rw-r--r-- | app/models/sidebar_blog_category.rb | 2 | ||||
-rw-r--r-- | app/views/refinery/blog/admin/categories/_form.html.erb | 5 | ||||
-rw-r--r-- | db/migrate/20140302204529_add_sidebar_item_count_to_blog_categories.rb | 5 | ||||
-rw-r--r-- | db/schema.rb | 3 |
5 files changed, 14 insertions, 3 deletions
diff --git a/app/decorators/models/refinery/blog_category_decorator.rb b/app/decorators/models/refinery/blog_category_decorator.rb index d338d63..3c4cf08 100644 --- a/app/decorators/models/refinery/blog_category_decorator.rb +++ b/app/decorators/models/refinery/blog_category_decorator.rb @@ -1,3 +1,3 @@ Refinery::Blog::Category.class_eval do - attr_accessible :sidebar_position + attr_accessible :sidebar_position, :sidebar_items end diff --git a/app/models/sidebar_blog_category.rb b/app/models/sidebar_blog_category.rb index 53d15af..fb867ac 100644 --- a/app/models/sidebar_blog_category.rb +++ b/app/models/sidebar_blog_category.rb @@ -2,7 +2,7 @@ class SidebarBlogCategory < SidebarModule def initialize(category) @title = category.title @position = category.sidebar_position - @posts = category.posts.recent(5) + @posts = category.posts.recent(category.sidebar_items) end def body diff --git a/app/views/refinery/blog/admin/categories/_form.html.erb b/app/views/refinery/blog/admin/categories/_form.html.erb index 3af3fc9..4538aef 100644 --- a/app/views/refinery/blog/admin/categories/_form.html.erb +++ b/app/views/refinery/blog/admin/categories/_form.html.erb @@ -15,6 +15,11 @@ <%= f.select :sidebar_position, make_choice_from(t('.sidebar_positions')) -%> </div> + <div class='field'> + <%= f.label :sidebar_items -%> + <%= f.select :sidebar_items, (1..25) -%> + </div> + <%= render :partial => "/refinery/admin/form_actions", :locals => { :f => f, diff --git a/db/migrate/20140302204529_add_sidebar_item_count_to_blog_categories.rb b/db/migrate/20140302204529_add_sidebar_item_count_to_blog_categories.rb new file mode 100644 index 0000000..7268cd6 --- /dev/null +++ b/db/migrate/20140302204529_add_sidebar_item_count_to_blog_categories.rb @@ -0,0 +1,5 @@ +class AddSidebarItemCountToBlogCategories < ActiveRecord::Migration + def change + add_column "refinery_blog_categories", "sidebar_items", :integer, :default => 5 + end +end diff --git a/db/schema.rb b/db/schema.rb index 94a7af9..dfb4893 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140216165732) do +ActiveRecord::Schema.define(:version => 20140302204529) do create_table "refinery_banners", :force => true do |t| t.string "name" @@ -42,6 +42,7 @@ ActiveRecord::Schema.define(:version => 20140216165732) do t.string "cached_slug" t.string "slug" t.integer "sidebar_position", :default => 0 + t.integer "sidebar_items", :default => 5 end add_index "refinery_blog_categories", ["id"], :name => "index_refinery_blog_categories_on_id" |