Class: Decidim::Admin::DashboardMetricChartsPresenter

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

Instance Method Summary collapse

Instance Method Details

#highlighted_metricsObject



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

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



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

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



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

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

#summary?Boolean

Returns:

  • (Boolean)


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

def summary?
  __getobj__.fetch(:summary)
end