Module: Staypuft::ApplicationHelper
- Defined in:
- app/helpers/staypuft/application_helper.rb
Instance Method Summary collapse
- #change_label_width(width, html) ⇒ Object
- #check_box_f_non_inline(f, attr, options = {}) ⇒ Object
- #radio_button_f_non_inline(f, attr, options = {}) ⇒ Object
- #subtitle(page_subtitle) ⇒ Object
- #tabbed_nav_menu(menu_items, id = nil, class_name = nil, subclass_name = nil) ⇒ Object
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, = {}) text = .delete(:text) checked_value = .delete(:checked_value) unchecked_value = .delete(:unchecked_value) group_class = .delete(:group_class) content_tag(:div, :class => "checkbox #{group_class}") do label_tag('') do f.check_box(attr, , 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 (f, attr, = {}) text = .delete(:text) value = .delete(:value) content_tag(:div, :class => 'radio') do label_tag('') do f.(attr, value, ) + " #{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 (, id=nil, class_name=nil, subclass_name=nil) content_tag(:ul, :class => class_name, :id => id) do .each do | item | concat(content_tag(: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 |