diff options
-rw-r--r-- | app/decorators/controllers/refinery/pages_controller_decorator.rb | 14 | ||||
-rw-r--r-- | app/views/common/_left_sidebar.html.erb | 9 |
2 files changed, 22 insertions, 1 deletions
diff --git a/app/decorators/controllers/refinery/pages_controller_decorator.rb b/app/decorators/controllers/refinery/pages_controller_decorator.rb new file mode 100644 index 0000000..d86fe39 --- /dev/null +++ b/app/decorators/controllers/refinery/pages_controller_decorator.rb @@ -0,0 +1,14 @@ +ApplicationController.class_eval do + + before_filter :populate_sidebars + + protected + + def populate_sidebars + categories = Refinery::Blog::Category.all + @sidebar_contents = {} + categories.each do |c| + @sidebar_contents[c.title] = c.posts.limit(10) + end + end +end diff --git a/app/views/common/_left_sidebar.html.erb b/app/views/common/_left_sidebar.html.erb index 72f83bb..bf3b3a8 100644 --- a/app/views/common/_left_sidebar.html.erb +++ b/app/views/common/_left_sidebar.html.erb @@ -1,3 +1,10 @@ <div id="left_sidebar"> -No content yet, but that will hopefully change soon! + <% @sidebar_contents.keys.each do |c| -%> + <div class="sidebar_content"> + <h1><%= c %></h1> + <ul><%- @sidebar_contents[c].each do |p| %> + <li><%= p.title %></li> + <% end %></ul> + </div> + <% end -%> </div> |