diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2013-12-25 00:15:57 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2013-12-25 00:15:57 +0100 |
commit | de85692eb4cb19112e5b3a6d68c8867c65ff0da0 (patch) | |
tree | 2427f6544d15f28550256c5af8b4817bcb7e1dd8 /app/decorators/controllers | |
parent | 771532124d5486eb78c22f1c638ff647883d46b8 (diff) | |
download | hmnoweb-de85692eb4cb19112e5b3a6d68c8867c65ff0da0.tar.gz hmnoweb-de85692eb4cb19112e5b3a6d68c8867c65ff0da0.tar.bz2 hmnoweb-de85692eb4cb19112e5b3a6d68c8867c65ff0da0.zip |
Clean up sidebar modules.
Rewrite the _sidebar_module partial to render only one module,
and to not make any assumptions about the contents of a module.
(Except that it has a title and a body.)
Move the actual module logic into model classes, and use the
ActiveModel magic to have it find it's own partial. Now we
have the view logic for each module in it's own partial that
in turn renders as part of the _sidebar_module partial.
Only implementation this far is the blog-category module
listing the latest blog entries within each category.
Diffstat (limited to 'app/decorators/controllers')
-rw-r--r-- | app/decorators/controllers/refinery/pages_controller_decorator.rb | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/app/decorators/controllers/refinery/pages_controller_decorator.rb b/app/decorators/controllers/refinery/pages_controller_decorator.rb index 034939c..cc30030 100644 --- a/app/decorators/controllers/refinery/pages_controller_decorator.rb +++ b/app/decorators/controllers/refinery/pages_controller_decorator.rb @@ -7,19 +7,10 @@ ApplicationController.class_eval do protected def populate_sidebars - @sidebar_modules = {} + @sidebar_modules = [] Refinery::Blog::Category.all.each do |c| - pos = c.sidebar_position - unless pos == 0 - mod = [] - c.posts.limit(5).each do |post| - mod << SidebarPostDecorator.new(post) - end - - @sidebar_modules[pos] = {} unless @sidebar_modules[pos] - @sidebar_modules[pos][c.title] = mod - end + @sidebar_modules << SidebarBlogCategory.new(c) end end |