Sha256: 99c3eb09cca0a6d8b61a57c2f2df33aa9b6e55e335b728c1fb1d25dab0e47d97
Contents?: true
Size: 778 Bytes
Versions: 2
Compression:
Stored size: 778 Bytes
Contents
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 <li class="dropdown"> <a class="dropdown-toggle" href="#{@options[:url] || '#'}" >#{@title}<b class="caret"></b></a> <ul class="dropdown-menu">#{render_nested(template)}</ul> <li> HTML end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ab_admin-0.5.0 | lib/ab_admin/menu/group.rb |
ab_admin-0.4.0 | lib/ab_admin/menu/group.rb |