Class: Decidim::Assemblies::AssemblyStatsPresenter
- Inherits:
-
Rectify::Presenter
- Object
- Rectify::Presenter
- Decidim::Assemblies::AssemblyStatsPresenter
- Includes:
- IconHelper
- Defined in:
- app/presenters/decidim/assemblies/assembly_stats_presenter.rb
Overview
A presenter to render statistics in the homepage.
Instance Method Summary collapse
-
#highlighted ⇒ Object
Public: Render a collection of primary stats.
Instance Method Details
#highlighted ⇒ Object
Public: Render a collection of primary stats.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/presenters/decidim/assemblies/assembly_stats_presenter.rb', line 11 def highlighted highlighted_stats = component_stats(priority: StatsRegistry::HIGH_PRIORITY) highlighted_stats = highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY)) highlighted_stats = highlighted_stats.reject(&:empty?) highlighted_stats = highlighted_stats.reject { |_manifest, _name, data| data.zero? } grouped_highlighted_stats = highlighted_stats.group_by { |stats| stats.first.name } safe_join( grouped_highlighted_stats.map do |_manifest_name, stats| content_tag :div, class: "process_stats-item" do safe_join( stats.each_with_index.map do |stat, index| render_stats_data(stat[0], stat[1], stat[2], index) end ) end end ) end |