Sha256: 795f9d62b8a864f3f5c6219701dc85ff7d1825197600f4a781466160aa76f0bf
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
module AbAdmin module Menu class Item include ::AbAdmin::Utils::EvalHelpers def initialize(title, path, options) @title = title.is_a?(Symbol) ? I18n.t(title, scope: [:admin, :navigation]) : title @path = path @options = options 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]) active = template.request.path.split('/')[2] == @path.split('/')[2] <<-HTML.html_safe <li class="#{'active' if active}">#{template.link_to @title, @path, @options.except(:if, :unless)}</li> HTML end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ab_admin-0.4.0 | lib/ab_admin/menu/item.rb |