Note we're delegating the `t` method because i18n-tasks doesn't detect code like `ApplicationController.helpers.t` and so reports we aren't using the `admin.stats.graph` translations.
26 lines
379 B
Ruby
26 lines
379 B
Ruby
class Admin::Stats::ChartComponent < ApplicationComponent
|
|
attr_reader :chart
|
|
|
|
def initialize(chart)
|
|
@chart = chart
|
|
end
|
|
|
|
private
|
|
|
|
def count
|
|
chart.count
|
|
end
|
|
|
|
def event
|
|
chart.event_name
|
|
end
|
|
|
|
def chart_tag
|
|
tag.div("data-graph": admin_api_stats_path(event: event))
|
|
end
|
|
|
|
def title
|
|
"#{chart.title} (#{count})"
|
|
end
|
|
end
|