Class: TabsFor::Rails::TabsForHelper::TabBuilder
- Inherits:
-
ViewBuilder
- Object
- ViewBuilder
- TabsFor::Rails::TabsForHelper::TabBuilder
- Includes:
- FontAwesome::Rails::IconHelper
- Defined in:
- app/helpers/tabs_for/rails/tabs_for_helper.rb
Instance Attribute Summary
Attributes inherited from ViewBuilder
#object, #output_buffer, #template
Instance Method Summary collapse
Methods inherited from ViewBuilder
Constructor Details
This class inherits a constructor from TabsFor::Rails::TabsForHelper::ViewBuilder
Instance Method Details
#tab(attribute, options = {}) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/tabs_for/rails/tabs_for_helper.rb', line 33 def tab(attribute, = {}) content = if [:label] .delete(:label) elsif object.respond_to? attribute human_name attribute else attribute.to_s.titleize end id = [:id] ? [:id].to_s : identifier(attribute) if [:size] content += ' ' + content_tag(:span, [:size], class: 'badge') end content_tag(:li, (attribute, )) do link_to '#' + id, (id) do if [:icon] wrap_with_icon(content.html_safe, ) else content.html_safe end end end end |