Class: AbAdmin::Menu::Group
- Defined in:
- lib/ab_admin/menu/group.rb
Instance Method Summary collapse
-
#initialize(title, options, &block) ⇒ Group
constructor
A new instance of Group.
- #render(template) ⇒ Object
Methods inherited from BaseGroup
#group, #link, #model, #render_nested
Constructor Details
#initialize(title, options, &block) ⇒ Group
Returns a new instance of Group.
4 5 6 7 8 9 10 |
# File 'lib/ab_admin/menu/group.rb', line 4 def initialize(title, , &block) @menu_tree = [] @raw_title = title @title = title.is_a?(Symbol) ? I18n.t(title, scope: [:admin, :navigation]) : title @options = instance_eval &block if block_given? end |
Instance Method Details
#render(template) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ab_admin/menu/group.rb', line 12 def render(template) return unless template.option_conditions_met?(@options) wrapper_class = "dropdown-wrap-#{@raw_title}" if @raw_title.is_a?(Symbol) <<-HTML.html_safe <li class="dropdown #{wrapper_class}"> <a class="dropdown-toggle" href="#{@options[:url] || '#'}" >#{title(template)}<b class="caret"></b></a> <ul class="dropdown-menu">#{render_nested(template)}</ul> <li> HTML end |