module AbAdmin module Menu class Group < BaseGroup def initialize(title, options, &block) @menu_tree = [] @raw_title = title @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 unless template.option_conditions_met?(@options) wrapper_class = "dropdown-wrap-#{@raw_title}" if @raw_title.is_a?(Symbol) <<-HTML.html_safe
  • HTML end private def title(template) return @title unless @options[:badge] badge = @options[:badge].is_a?(Symbol) ? template.public_send(@options[:badge]) : template.instance_exec(&@options[:badge]) return @title if !badge || badge == 0 "#{@title} #{badge}".html_safe end end end end