Module: Staypuft::ApplicationHelper

Defined in:
app/helpers/staypuft/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#change_label_width(width, html) ⇒ Object



41
42
43
# File 'app/helpers/staypuft/application_helper.rb', line 41

def change_label_width(width, html)
  html.gsub(/class="col-md-2 control-label"/, "class=\"col-md-#{width} control-label\"").html_safe
end

#check_box_f_non_inline(f, attr, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/staypuft/application_helper.rb', line 29

def check_box_f_non_inline(f, attr, options = {})
  text            = options.delete(:text)
  checked_value   = options.delete(:checked_value)
  unchecked_value = options.delete(:unchecked_value)
  group_class     = options.delete(:group_class)
  (:div, :class => "checkbox #{group_class}") do
    label_tag('') do
      f.check_box(attr, options, checked_value, unchecked_value) + " #{text} "
    end
  end
end

#radio_button_f_non_inline(f, attr, options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'app/helpers/staypuft/application_helper.rb', line 19

def radio_button_f_non_inline(f, attr, options = {})
  text  = options.delete(:text)
  value = options.delete(:value)
  (:div, :class => 'radio') do
    label_tag('') do
      f.radio_button(attr, value, options) + " #{text} "
    end
  end
end

#subtitle(page_subtitle) ⇒ Object



4
5
6
# File 'app/helpers/staypuft/application_helper.rb', line 4

def subtitle(page_subtitle)
  content_for(:subtitle, page_subtitle.to_s)
end

#tabbed_nav_menu(menu_items, id = nil, class_name = nil, subclass_name = nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/staypuft/application_helper.rb', line 8

def tabbed_nav_menu(menu_items, id=nil, class_name=nil, subclass_name=nil)
  (:ul, :class => class_name, :id => id) do
    menu_items.each do | item |
      concat((:li, link_to(item[:title], "#{item[:target_id]}",
                                      :class => subclass_name,
                                      :data => { :id => item[:target_id], :toggle => 'tab'}),
                                      :class => item[:active] ? "#{item[:class]} active" : item[:class] ))
    end
  end
end