Module: Refinery::Formtastic::PageTabsHelper
- Defined in:
- app/helpers/refinery/formtastic/page_tabs_helper.rb
Instance Method Summary collapse
- #tabbed_fieldset_bodies(form, tabs) ⇒ Object
- #tabbed_fieldset_body(form, tab) ⇒ Object
- #tabbed_fieldset_headers(tabs, i18n_scope = nil) ⇒ Object
- #tabbed_fieldsets(form, tabs, i18n_scope = nil) ⇒ Object
Instance Method Details
#tabbed_fieldset_bodies(form, tabs) ⇒ Object
27 28 29 30 31 32 33 |
# File 'app/helpers/refinery/formtastic/page_tabs_helper.rb', line 27 def tabbed_fieldset_bodies(form, tabs) content_tag(:div, :id => 'page_part_editors') do tabs.map do |tab| tabbed_fieldset_body(form, tab) end.join("\n").html_safe end end |
#tabbed_fieldset_body(form, tab) ⇒ Object
35 36 37 38 39 40 41 |
# File 'app/helpers/refinery/formtastic/page_tabs_helper.rb', line 35 def tabbed_fieldset_body(form, tab) if tab.is_a?(Symbol) editor_only_fieldset_body(form, tab) else partial_fieldset_body(form, tab) end end |
#tabbed_fieldset_headers(tabs, i18n_scope = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/refinery/formtastic/page_tabs_helper.rb', line 13 def tabbed_fieldset_headers(tabs, i18n_scope = nil) content_tag(:ul, :id => 'page_parts') do contents = [] tabs.each_with_index do |tab, tab_index| classes = ['ui-state-default'] classes << 'ui-state-active' if tab_index == 0 contents << content_tag(:li, :class => classes.join(' ')) do link_to tab_name(tab, i18n_scope), "##{tab_id(tab)}" end end contents.join("\n").html_safe end end |
#tabbed_fieldsets(form, tabs, i18n_scope = nil) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/helpers/refinery/formtastic/page_tabs_helper.rb', line 4 def tabbed_fieldsets(form, tabs, i18n_scope = nil) content_tag(:div, :class => 'field') do content_tag(:div, :id => 'page-tabs', :class => 'clearfix ui-tabs ui-widget ui-widget-content ui-corner-all') do tabbed_fieldset_headers(tabs, i18n_scope) + tabbed_fieldset_bodies(form, tabs) end end end |