Module: PureAdmin::DetailsPanelHelper
- Defined in:
- app/helpers/pure_admin/details_panel_helper.rb
Overview
Helper methods for the details panel.
Defined Under Namespace
Classes: DetailsPanelBuilder
Instance Method Summary collapse
-
#details_panel(options = {}) { ... } ⇒ Object
Renders a “details panel” to the view.
-
#details_panel_controls(options = {}) { ... } ⇒ Object
Renders a “details_panel_controls” element to the view.
-
#details_panel_for(resource, options = {}) { ... } ⇒ Object
Renders a “details panel” to the view using the details panel builder DSL.
-
#details_panel_heading(title = nil, options = nil) { ... } ⇒ Object
Renders a “details panel heading” to the view.
-
#details_panel_item(label, value = nil, options = nil) { ... } ⇒ Object
Renders a “details panel item” to the view.
Instance Method Details
#details_panel(options = {}) { ... } ⇒ Object
Renders a “details panel” to the view.
8 9 10 11 |
# File 'app/helpers/pure_admin/details_panel_helper.rb', line 8 def details_panel( = {}, &block) [:class] = merge_html_classes('pure-g details-panel', [:class]) content_tag(:div, , &block) end |
#details_panel_controls(options = {}) { ... } ⇒ Object
Renders a “details_panel_controls” element to the view.
54 55 56 57 |
# File 'app/helpers/pure_admin/details_panel_helper.rb', line 54 def details_panel_controls( = {}, &block) [:class] = merge_html_classes('details-panel-controls', [:class]) content_tag(:div, capture(&block), ) end |
#details_panel_for(resource, options = {}) { ... } ⇒ Object
Renders a “details panel” to the view using the details panel builder DSL.
64 65 66 67 68 69 |
# File 'app/helpers/pure_admin/details_panel_helper.rb', line 64 def details_panel_for(resource, = {}, &block) builder = DetailsPanelBuilder.new(resource, self) details_panel() do capture(builder, &block) end end |
#details_panel_heading(title = nil, options = nil) { ... } ⇒ Object
Renders a “details panel heading” to the view.
18 19 20 21 22 23 |
# File 'app/helpers/pure_admin/details_panel_helper.rb', line 18 def details_panel_heading(title = nil, = nil, &block) , title = title, capture(&block) if block_given? = || {} [:class] = merge_html_classes('pure-u details-panel-heading', [:class]) content_tag(:h4, title, ) end |
#details_panel_item(label, value = nil, options = nil) { ... } ⇒ Object
Renders a “details panel item” to the view.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/helpers/pure_admin/details_panel_helper.rb', line 31 def details_panel_item(label, value = nil, = nil, &block) , value = value, capture(&block) if block_given? = || {} label = label.to_s.titleize unless label.nil? || label.respond_to?(:titleize) item_html = .delete(:item_html) || {} item_html[:class] = merge_html_classes('details-panel-item pure-u-1', item_html[:class]) label_html = .delete(:label_html) || {} value = value.try(:to_s) value = content_tag :span, '(blank)', class: 'text-muted' unless value.present? content_tag(:div, item_html) do content_tag(:label, label, label_html) + value end end |