aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2013-12-23 20:36:48 +0100
committerHarald Eilertsen <haraldei@anduin.net>2013-12-23 20:36:48 +0100
commita6c3b6f6bb3aa603dd25d47f15f26e53d3427a5b (patch)
treedfa794d1fc6aeb7c79912759da29c0be73a15e9d /app
parent595b16a783b7a99cadbf7cd61086ead32c6298a9 (diff)
downloadhmnoweb-a6c3b6f6bb3aa603dd25d47f15f26e53d3427a5b.tar.gz
hmnoweb-a6c3b6f6bb3aa603dd25d47f15f26e53d3427a5b.tar.bz2
hmnoweb-a6c3b6f6bb3aa603dd25d47f15f26e53d3427a5b.zip
Use blog category position to populate sidebars.
Diffstat (limited to 'app')
-rw-r--r--app/decorators/controllers/refinery/pages_controller_decorator.rb16
-rw-r--r--app/views/common/_left_sidebar.html.erb2
-rw-r--r--app/views/common/_right_sidebar.html.erb2
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>