Files
nairobi/app/components/admin/stats/chart_component.rb
Javi Martín 328413373e Use the same texts on event links and graphs
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.
2024-05-09 14:28:32 +02:00

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