Module: SimpleContentManagement::SimpleMenusHelper
- Defined in:
- app/helpers/simple_content_management/simple_menus_helper.rb
Instance Method Summary collapse
Instance Method Details
#simple_menu(id, *content_tag_args, &block) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'app/helpers/simple_content_management/simple_menus_helper.rb', line 2 def id, *content_tag_args, &block = SimpleContentManagement::SimpleMenu.find id content = "".html_safe ..includes(:children).sort_by(&:position).each do |smi| smi.children.sort_by!(&:position) content << capture(smi, &block) end content_tag_args.any? ? content_tag(content_tag_args.shift, content, *content_tag_args) : content end |
#simple_menu_item_link_for(smi) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/helpers/simple_content_management/simple_menus_helper.rb', line 12 def smi if smi.uri[0] == "$" smc = SimpleContentManagement::SimpleMenu. smi.uri[1..-1] if smc.condition.nil? || self.instance_eval(&smc.condition) link_to smi.name, *self.instance_eval(&smc.link) end else = {} [:target] = "_blank" if smi.is_target_blank? link_to smi.name, smi.uri, end end |