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
Methods included from Utils::EvalHelpers
#call_method_or_proc_on, #evaluate_method
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) = [] @raw_title = title @title = title.is_a?(Symbol) ? I18n.t(title, scope: [:admin, :navigation]) : title = instance_eval &block if block_given? end |
Instance Method Details
#render(template) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ab_admin/menu/group.rb', line 12 def render(template) return if [:if] && !call_method_or_proc_on(template, [:if]) return if [:unless] && call_method_or_proc_on(template, [:unless]) wrapper_class = "dropdown-wrap-#{@raw_title}" if @raw_title.is_a?(Symbol) "<li class=\"dropdown \#{wrapper_class}\">\n <a class=\"dropdown-toggle\" href=\"\#{@options[:url] || '#'}\" >\#{title(template)}<b class=\"caret\"></b></a>\n <ul class=\"dropdown-menu\">\#{render_nested(template)}</ul>\n<li>\n HTML\nend\n".html_safe |