Module: Penmanship::ActionView::Extension::InstanceMethods

Defined in:
lib/penmanship/action_view/extension.rb

Instance Method Summary collapse

Instance Method Details

A helper that renders the sec navigation highlight



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/penmanship/action_view/extension.rb', line 15

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)
  (:li, content, options)
end

#sec_nav(name, options = {}, &block) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/penmanship/action_view/extension.rb', line 27

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)
  (:li, content, options)
end

#translate_attribute(klass, attribute_name) ⇒ Object Also known as: ta

A helper that set the i18n columns



9
10
11
# File 'lib/penmanship/action_view/extension.rb', line 9

def translate_attribute(klass, attribute_name)
  klass.human_attribute_name(attribute_name)
end