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/views/common | |
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/views/common')
-rw-r--r-- | app/views/common/_left_sidebar.html.erb | 2 | ||||
-rw-r--r-- | app/views/common/_right_sidebar.html.erb | 2 | ||||
-rw-r--r-- | app/views/common/_sidebar_module.html.erb | 17 |
3 files changed, 7 insertions, 14 deletions
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 @@ <div id="left_sidebar"> - <%= render "common/sidebar_module", :modules => @sidebar_modules[1] %> + <%= render @sidebar_modules.select {|m| m.position == 1} %> </div> 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 @@ <div id="right_sidebar"> - <%= render "common/sidebar_module", :modules => @sidebar_modules[2] %> + <%= render @sidebar_modules.select {|m| m.position == 2} %> </div> 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| -%> - <div class="sidebar_content"> - <h1><%= c %></h1> - <%- modules[c].each do |item| %> - <h2><%= link_to(item.title, item.friendly_id) %></h2> - <div><%= item.body %></div> - <div><%= link_to(t('read_more'), item.friendly_id) %></div> - <% end %> - </div> - <% end -%> -<% end -%> +<div id="sidebar_module_<%= sidebar_module.title %>" class="sidebar_module"> + <h1><%= sidebar_module.title %></h1> + <div><%= content_for "sidebar_module_#{sidebar_module.title}_body" %></div> +</div> + |