module AbAdmin module Menu class Group < BaseGroup def initialize(title, options, &block) @menu_tree = [] @title = title.is_a?(Symbol) ? I18n.t(title, scope: [:admin, :navigation]) : title @options = options instance_eval &block if block_given? end def render(template) return if @options[:if] && !call_method_or_proc_on(template, @options[:if]) return if @options[:unless] && call_method_or_proc_on(template, @options[:unless]) <<-HTML.html_safe
  • HTML end private def title(template) return @title unless @options[:badge] badge = call_method_or_proc_on(template, @options[:badge]) return @title if !badge || badge == 0 "#{@title} #{badge}".html_safe end end end end