diff options
-rw-r--r-- | app/decorators/controllers/refinery/pages_controller_decorator.rb | 16 | ||||
-rw-r--r-- | app/views/common/_left_sidebar.html.erb | 2 | ||||
-rw-r--r-- | app/views/common/_right_sidebar.html.erb | 2 |
3 files changed, 12 insertions, 8 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 diff --git a/app/views/common/_left_sidebar.html.erb b/app/views/common/_left_sidebar.html.erb index 968f1fa..37f8ccf 100644 --- a/app/views/common/_left_sidebar.html.erb +++ b/app/views/common/_left_sidebar.html.erb @@ -1,3 +1,3 @@ <div id="left_sidebar"> - <%= render "common/sidebar_module", :modules => @sidebar_modules[:left] %> + <%= render "common/sidebar_module", :modules => @sidebar_modules[1] %> </div> diff --git a/app/views/common/_right_sidebar.html.erb b/app/views/common/_right_sidebar.html.erb index 1707324..c9a3ca6 100644 --- a/app/views/common/_right_sidebar.html.erb +++ b/app/views/common/_right_sidebar.html.erb @@ -1,3 +1,3 @@ <div id="right_sidebar"> -No content yet, but that will hopefully change soon! + <%= render "common/sidebar_module", :modules => @sidebar_modules[2] %> </div> |