aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2014-03-02 21:57:14 +0100
committerHarald Eilertsen <haraldei@anduin.net>2014-03-02 21:57:14 +0100
commita565503bef77c14892a131575e1927b2b98c859f (patch)
treeffcff80acc325a9cebd5b3a085a6b4d485ecaeb5 /app
parent455abf20321fbf2cd8247a95973787b1af21ccde (diff)
downloadhmnoweb-a565503bef77c14892a131575e1927b2b98c859f.tar.gz
hmnoweb-a565503bef77c14892a131575e1927b2b98c859f.tar.bz2
hmnoweb-a565503bef77c14892a131575e1927b2b98c859f.zip
Allow customization of number of sidebar items for each category.
Diffstat (limited to 'app')
-rw-r--r--app/decorators/models/refinery/blog_category_decorator.rb2
-rw-r--r--app/models/sidebar_blog_category.rb2
-rw-r--r--app/views/refinery/blog/admin/categories/_form.html.erb5
3 files changed, 7 insertions, 2 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,