Sha256: 19b9981556200f835617d5a538e69bfd360f7ccfaf58134d04ad6fc101ba869b
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
module Navigation module ControllerExtensions module ClassMethods def sec_nav_highlight(name) class_eval do before_filter { |c| c.instance_variable_set(:@sec_nav, name) } end end def main_nav_highlight(name) class_eval do before_filter { |c| c.instance_variable_set(:@main_nav, name) } end end end end module RailsHelpers def sec_nav(name, options = {}, &block) if @sec_nav == name if options[:class] options[:class] += " active" else options[:class] = "active" end end content = capture(&block) concat content_tag(:li, content, options) end def main_nav(name, options = {}, &block) if @main_nav == name if options[:class] options[:class] += " active" else options[:class] = "active" end end content = capture(&block) concat content_tag(:li, content, options) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sga_nav-0.2.0 | lib/nav/navigation.rb |
sga_nav-0.1.0 | lib/nav/navigation.rb |