aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2013-12-25 00:15:57 +0100
committerHarald Eilertsen <haraldei@anduin.net>2013-12-25 00:15:57 +0100
commitde85692eb4cb19112e5b3a6d68c8867c65ff0da0 (patch)
tree2427f6544d15f28550256c5af8b4817bcb7e1dd8 /app/views
parent771532124d5486eb78c22f1c638ff647883d46b8 (diff)
downloadhmnoweb-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')
-rw-r--r--app/views/common/_left_sidebar.html.erb2
-rw-r--r--app/views/common/_right_sidebar.html.erb2
-rw-r--r--app/views/common/_sidebar_module.html.erb17
-rw-r--r--app/views/refinery/sidebar_modules/_sidebar_blog_category.html.erb8
4 files changed, 15 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>
+
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 %>