aboutsummaryrefslogblamecommitdiffstats
path: root/app/helpers/sidebar_helper.rb
blob: dddadf28b769aad94408aac7d93cf1fcec9e21eb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                            
                    








                                                



                                                    

                               


                                                          
     
   
# This file is part of hmnoweb, a RefineryCMS based Webapp for heavymetal.no
# Copyright (C) 2018  Harald Eilertsen <haraldei@anduin.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

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.try(:body).try(:empty?)
    false
  end
end