Class: Decidim::Admin::DashboardMetricChartsPresenter

Inherits:
MetricChartsPresenter show all
Defined in:
decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb

Instance Method Summary collapse

Methods inherited from MetricChartsPresenter

#highlighted, #not_highlighted, #render_charts, #render_metrics, #view_context

Instance Method Details

#highlighted_metricsObject



10
11
12
13
14
15
16
17
18
19
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 10

def highlighted_metrics
  return super unless summary?

  Decidim.metrics_registry.filtered(
    highlight: true,
    scope: "home"
  ).select do |registry|
    %w(users proposals).include? registry.metric_name
  end
end

#not_highlighted_metricsObject



21
22
23
24
25
26
27
28
29
30
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 21

def not_highlighted_metrics
  return super unless summary?

  Decidim.metrics_registry.filtered(
    highlight: false,
    scope: "home"
  ).select do |registry|
    %w(comments meetings accepted_proposals results blocked_users user_reports reported_users).include? registry.metric_name
  end
end

#summary?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 6

def summary?
  __getobj__.fetch(:summary)
end