Class: Decidim::MetricChartsPresenter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/presenters/decidim/metric_charts_presenter.rb

Overview

A presenter to render metrics in pages

Instance Method Summary collapse

Instance Method Details

#highlightedObject

Public: Render a collection of primary metrics.



13
14
15
# File 'app/presenters/decidim/metric_charts_presenter.rb', line 13

def highlighted
  render_highlighted(highlighted_metrics)
end

#highlighted_metricsObject



22
23
24
# File 'app/presenters/decidim/metric_charts_presenter.rb', line 22

def highlighted_metrics
  Decidim.metrics_registry.filtered(highlight: true, scope: "home")
end

#not_highlightedObject

Public: Render a collection of metrics that are not primary.



18
19
20
# File 'app/presenters/decidim/metric_charts_presenter.rb', line 18

def not_highlighted
  render_not_highlighted(not_highlighted_metrics)
end

#not_highlighted_metricsObject



26
27
28
# File 'app/presenters/decidim/metric_charts_presenter.rb', line 26

def not_highlighted_metrics
  Decidim.metrics_registry.filtered(highlight: false, scope: "home")
end

#view_contextObject



8
9
10
# File 'app/presenters/decidim/metric_charts_presenter.rb', line 8

def view_context
  @view_context ||= __getobj__.fetch(:view_context, ActionController::Base.new.view_context)
end