aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2013-12-25 14:49:46 +0100
committerHarald Eilertsen <haraldei@anduin.net>2013-12-25 14:49:46 +0100
commitbad5fbd942de1d3a059587f595cac2aa50407b15 (patch)
tree91cd00c0bfc1420795cff6ec83de574b3adc8180 /app/helpers
parentb72598485ace03615a1c39f6a8720c6fe6cfa458 (diff)
downloadhmnoweb-bad5fbd942de1d3a059587f595cac2aa50407b15.tar.gz
hmnoweb-bad5fbd942de1d3a059587f595cac2aa50407b15.tar.bz2
hmnoweb-bad5fbd942de1d3a059587f595cac2aa50407b15.zip
Refactor filtering of sidebar modules to helper.
Also strip out modules with empty bodies.
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/sidebar_helper.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/helpers/sidebar_helper.rb b/app/helpers/sidebar_helper.rb
index 2ae3e95..f9d4834 100644
--- a/app/helpers/sidebar_helper.rb
+++ b/app/helpers/sidebar_helper.rb
@@ -1,5 +1,13 @@
module SidebarHelper
- def render_sidebar_modules(mods)
+ def render_sidebar_modules(mods, options = {})
+ pos = options.delete(:position)
+
+ unless pos.nil? then
+ mods = mods.select {|m| m.position == pos}
+ end
+
+ mods = mods.reject {|m| m.body.empty?}
+
mods.map { |m|
render m.to_partial_path, :sidebar_module => m
}.join().html_safe