From de85692eb4cb19112e5b3a6d68c8867c65ff0da0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Wed, 25 Dec 2013 00:15:57 +0100 Subject: 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. --- app/views/common/_left_sidebar.html.erb | 2 +- app/views/common/_right_sidebar.html.erb | 2 +- app/views/common/_sidebar_module.html.erb | 17 +++++------------ .../sidebar_modules/_sidebar_blog_category.html.erb | 8 ++++++++ 4 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 app/views/refinery/sidebar_modules/_sidebar_blog_category.html.erb (limited to 'app/views') diff --git a/app/views/common/_left_sidebar.html.erb b/app/views/common/_left_sidebar.html.erb index 37f8ccf..1a55f7e 100644 --- a/app/views/common/_left_sidebar.html.erb +++ b/app/views/common/_left_sidebar.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/common/_right_sidebar.html.erb b/app/views/common/_right_sidebar.html.erb index c9a3ca6..9a40a11 100644 --- a/app/views/common/_right_sidebar.html.erb +++ b/app/views/common/_right_sidebar.html.erb @@ -1,3 +1,3 @@ diff --git a/app/views/common/_sidebar_module.html.erb b/app/views/common/_sidebar_module.html.erb index 07eba16..c7a24e9 100644 --- a/app/views/common/_sidebar_module.html.erb +++ b/app/views/common/_sidebar_module.html.erb @@ -1,12 +1,5 @@ -<% unless modules.nil? %> - <% modules.keys.each do |c| -%> - - <% end -%> -<% end -%> + + diff --git a/app/views/refinery/sidebar_modules/_sidebar_blog_category.html.erb b/app/views/refinery/sidebar_modules/_sidebar_blog_category.html.erb new file mode 100644 index 0000000..c1d80f1 --- /dev/null +++ b/app/views/refinery/sidebar_modules/_sidebar_blog_category.html.erb @@ -0,0 +1,8 @@ +<% content_for "sidebar_module_#{sidebar_blog_category.title}_body" do %> + <% sidebar_blog_category.body.each do |post| %> + <%= content_tag :div, :class => :sidebar_blog_headline do %> + <%= link_to post.title, blog_post_path(post) %> + <% end %> + <% end %> +<% end %> +<%= render 'common/sidebar_module', :sidebar_module => sidebar_blog_category %> -- cgit v1.2.3