Sha256: 74e62cde92feefeeba487927bcb19d322600ad869715390576c5b29824835124
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module EaselHelpers module Helpers module NavigationHelper def tab(name, path, options = {}, li_options = {}) opts = parse_tab_options(name, li_options) active = "active" if (opts[:active] == opts[:comparison]) || opts[:compare] css_classes = [] << opts[:li_classes] << active css_classes = clean_css_classes(css_classes) li_options.merge!(:class => css_classes) if css_classes.present? content_tag :li, link_to(name, path, options), li_options end private def parse_tab_options(name, li_options = {}) returning({}) do |result| result[:active] = li_options.delete(:active) || (name.gsub(/\s/, '').tableize || "") result[:comparison] = li_options.delete(:active_compare) || controller.controller_name result[:compare] = li_options.delete(:compare) || false result[:li_classes] = li_options.delete(:class) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
easel_helpers-0.3.0 | lib/easel_helpers/helpers/navigation_helper.rb |