aboutsummaryrefslogblamecommitdiffstats
path: root/app/helpers/sidebar_helper.rb
blob: e8e076afc92e04e37ae226dee8c49d8c046625af (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                    








                                                



                                                    




                                             
   
module SidebarHelper
  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
  end

  def page_has_side_body?(page)
    part = page.part_with_title("Side Body")
    return part.present? && !part.body.empty?
  end
end