Files
nairobi/app/components/admin/stats/event_links_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

25 lines
456 B
Ruby

class Admin::Stats::EventLinksComponent < ApplicationComponent
attr_reader :event_names
use_helpers :link_list
def initialize(event_names)
@event_names = event_names
end
private
def link_text(event)
Ahoy::Chart.new(event).title
end
def title
t("admin.stats.graph.title")
end
def links
event_names.map do |event|
[link_text(event), graph_admin_stats_path(event: event)]
end
end
end