Module: Crm::Reports::ConversionReportHelper
- Defined in:
- app/helpers/crm/reports/conversion_report_helper.rb
Overview
View helper for the CRM conversion report
(Crm::Reports::ConversionReportController), rendering the opportunity and
conversion-rate metric cells for each report row and its totals row.
Instance Method Summary collapse
-
#cr_metric_cells(row) ⇒ ActiveSupport::SafeBuffer
Renders the table cells for a single conversion report data row (opportunities created/won, conversion rate, and average closing time, each for previous and current periods plus their variance).
-
#cr_total_cells(row) ⇒ ActiveSupport::SafeBuffer
Renders the table cells for the conversion report totals row, mirroring #cr_metric_cells but wrapping each value in a strong tag.
Instance Method Details
#cr_metric_cells(row) ⇒ ActiveSupport::SafeBuffer
Renders the table cells for a single conversion report data row
(opportunities created/won, conversion rate, and average closing time,
each for previous and current periods plus their variance).
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/crm/reports/conversion_report_helper.rb', line 15 def cr_metric_cells(row) safe_join([ content_tag(:td, values_format_without_symbol(row[:opps_created_prev].to_i), class: 'text-end font-monospace border-start'), content_tag(:td, values_format_without_symbol(row[:opps_created_cur].to_i), class: 'text-end font-monospace'), content_tag(:td, value_ptg(row[:opps_growth].to_i), class: "text-end font-monospace#{' text-danger' if row[:opps_growth].to_f.negative?}"), content_tag(:td, values_format_without_symbol(row[:opps_won_prev].to_i), class: 'text-end font-monospace border-start col-shaded'), content_tag(:td, values_format_without_symbol(row[:opps_won_cur].to_i), class: 'text-end font-monospace col-shaded'), content_tag(:td, values_format_without_symbol(row[:opp_won_var].to_i), class: "text-end font-monospace col-shaded#{' text-danger' if row[:opp_won_var].to_i.negative?}"), content_tag(:td, value_ptg(row[:conversion_rate_prev].to_i), class: 'text-end font-monospace border-start'), content_tag(:td, value_ptg(row[:conversion_rate_cur].to_i), class: 'text-end font-monospace'), content_tag(:td, value_ptg(row[:conversion_rate_var].to_i), class: "text-end font-monospace#{' text-danger' if row[:conversion_rate_var].to_f.negative?}"), content_tag(:td, values_format_without_symbol(row[:avg_closing_time_prev].to_i), class: 'text-end font-monospace border-start col-shaded'), content_tag(:td, values_format_without_symbol(row[:avg_closing_time_cur].to_i), class: 'text-end font-monospace col-shaded'), content_tag(:td, values_format_without_symbol(row[:avg_closing_time_var].to_i), class: "text-end font-monospace col-shaded#{' text-success' if row[:avg_closing_time_var].to_i.negative?}") ]) end |
#cr_total_cells(row) ⇒ ActiveSupport::SafeBuffer
Renders the table cells for the conversion report totals row, mirroring
#cr_metric_cells but wrapping each value in a strong tag.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/helpers/crm/reports/conversion_report_helper.rb', line 41 def cr_total_cells(row) safe_join([ content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:opps_created_prev].to_i)), class: 'text-end font-monospace border-start'), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:opps_created_cur].to_i)), class: 'text-end font-monospace'), content_tag(:td, content_tag(:strong, value_ptg(row[:opps_growth].to_i)), class: "text-end font-monospace#{' text-danger' if row[:opps_growth].to_f.negative?}"), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:opps_won_prev].to_i)), class: 'text-end font-monospace border-start col-shaded'), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:opps_won_cur].to_i)), class: 'text-end font-monospace col-shaded'), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:opp_won_var].to_i)), class: "text-end font-monospace col-shaded#{' text-danger' if row[:opp_won_var].to_i.negative?}"), content_tag(:td, content_tag(:strong, value_ptg(row[:conversion_rate_prev].to_i)), class: 'text-end font-monospace border-start'), content_tag(:td, content_tag(:strong, value_ptg(row[:conversion_rate_cur].to_i)), class: 'text-end font-monospace'), content_tag(:td, content_tag(:strong, value_ptg(row[:conversion_rate_var].to_i)), class: "text-end font-monospace#{' text-danger' if row[:conversion_rate_var].to_f.negative?}"), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:avg_closing_time_prev].to_i)), class: 'text-end font-monospace border-start col-shaded'), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:avg_closing_time_cur].to_i)), class: 'text-end font-monospace col-shaded'), content_tag(:td, content_tag(:strong, values_format_without_symbol(row[:avg_closing_time_var].to_i)), class: "text-end font-monospace col-shaded#{' text-success' if row[:avg_closing_time_var].to_i.negative?}") ]) end |