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

Instance Method Details

#highlighted_metricsObject


16
17
18
19
20
21
22
23
24
25
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 16

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


27
28
29
30
31
32
33
34
35
36
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 27

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

#render_not_highlighted(metrics) ⇒ Object


8
9
10
11
12
13
14
# File 'decidim-admin/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb', line 8

def render_not_highlighted(metrics)
  safe_join(
    metrics.map do |metric|
      render_metrics_data(metric.metric_name, klass: not_highlighted_classes, graph_klass: "small")
    end
  )
end