aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/common
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2013-12-25 14:04:38 +0100
committerHarald Eilertsen <haraldei@anduin.net>2013-12-25 14:04:38 +0100
commitb72598485ace03615a1c39f6a8720c6fe6cfa458 (patch)
tree7838c2292eb05ea690331383908e3a36729af56f /app/views/common
parentde85692eb4cb19112e5b3a6d68c8867c65ff0da0 (diff)
downloadhmnoweb-b72598485ace03615a1c39f6a8720c6fe6cfa458.tar.gz
hmnoweb-b72598485ace03615a1c39f6a8720c6fe6cfa458.tar.bz2
hmnoweb-b72598485ace03615a1c39f6a8720c6fe6cfa458.zip
More sidebar module fixes.
There was some problems with the approach in the previous commits. - render_collection (render @sidebar_modules in our case) requires that all objects return the same partial path. Ours may not do that, so we wrote our own `render_sidebar_modules`-helper. - The way render_partial finds the correct path to the partial is to append what's returned by to_partial_path with whatever root the parent view is in. That would require duplication of the partials under all the different engines namespaces. Our `render_sidebar_modules` does it differently, and just looks up the partial according to the root namespace. This means the sidebar_module code can move back under the root application so we don't mess up the refinery namespaces. - Finally found the proper way to link to a blog_post so that it works from all namespaces. The correct way is: refinery.blog_post_path(post) This works in views (and presumably helpers,) but not in controllers which is why we struggled with it before.
Diffstat (limited to 'app/views/common')
-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.erb5
3 files changed, 2 insertions, 7 deletions
diff --git a/app/views/common/_left_sidebar.html.erb b/app/views/common/_left_sidebar.html.erb
index 1a55f7e..3cdbe0c 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 @sidebar_modules.select {|m| m.position == 1} %>
+ <%= render_sidebar_modules @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 9a40a11..082e4f1 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 @sidebar_modules.select {|m| m.position == 2} %>
+ <%= render_sidebar_modules @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
deleted file mode 100644
index c7a24e9..0000000
--- a/app/views/common/_sidebar_module.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<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>
-