diff options
Diffstat (limited to 'app/decorators')
-rw-r--r-- | app/decorators/controllers/refinery/pages_controller_decorator.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/decorators/controllers/refinery/pages_controller_decorator.rb b/app/decorators/controllers/refinery/pages_controller_decorator.rb index d49e194..da020da 100644 --- a/app/decorators/controllers/refinery/pages_controller_decorator.rb +++ b/app/decorators/controllers/refinery/pages_controller_decorator.rb @@ -5,15 +5,19 @@ ApplicationController.class_eval do protected def populate_sidebars - @sidebar_modules = {:left => {}, :right => {}} + @sidebar_modules = {} Refinery::Blog::Category.all.each do |c| - mod = [] - c.posts.limit(5).each do |post| - mod << SidebarPostDecorator.new(post) - end + pos = c.sidebar_position + unless pos == 0 + mod = [] + c.posts.limit(5).each do |post| + mod << SidebarPostDecorator.new(post) + end - @sidebar_modules[:left][c.title] = mod + @sidebar_modules[pos] = {} unless @sidebar_modules[pos] + @sidebar_modules[pos][c.title] = mod + end end end end |