Method: ApplicationHelper#stat_panel

Defined in:
app/helpers/application_helper.rb

#stat_panel(heading, value, caption: nil) ⇒ ActiveSupport::SafeBuffer

Creates a panel for display of a single statistic. Used in reports.

Parameters:

  • heading (String)

    A title for the panel.

  • value (#to_s)

    The statistic value.

  • caption (String) (defaults to: nil)

    A short explanatory caption to display.

Returns:

  • (ActiveSupport::SafeBuffer)


83
84
85
86
87
88
89
# File 'app/helpers/application_helper.rb', line 83

def stat_panel(heading, value, caption: nil)
  tag.div class: 'stat-panel' do
    tag.h4(heading, class: 'stat-panel-heading') +
      (caption.nil? ? '' : tag.span(caption, class: 'stat-panel-caption')) +
      tag.span(value, class: 'stat-value')
  end
end