Class: AbAdmin::MenuGroup
- Inherits:
-
BaseMenuGroup
- Object
- BaseMenuGroup
- AbAdmin::MenuGroup
- Defined in:
- lib/ab_admin/menu_builder.rb
Instance Method Summary collapse
-
#initialize(title, options, &block) ⇒ MenuGroup
constructor
A new instance of MenuGroup.
- #render(template) ⇒ Object
Methods inherited from BaseMenuGroup
#group, #link, #model, #render_nested
Methods included from Utils::EvalHelpers
#call_method_or_proc_on, #evaluate_method
Constructor Details
#initialize(title, options, &block) ⇒ MenuGroup
Returns a new instance of MenuGroup.
49 50 51 52 53 54 |
# File 'lib/ab_admin/menu_builder.rb', line 49 def initialize(title, , &block) = [] @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
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ab_admin/menu_builder.rb', line 56 def render(template) return if [:if] && !call_method_or_proc_on(template, [:if]) return if [:unless] && call_method_or_proc_on(template, [:unless]) "<li class=\"dropdown\">\n<a class=\"dropdown-toggle\" data-toggle=\"dropdown\" href=\"#\" >\#{@title}<b class=\"caret\"></b></a>\n<ul class=\"dropdown-menu\">\#{render_nested(template)}</ul>\n<li>\n".html_safe end |