Files
grecia/app/components/polls/poll_component.rb
Javi Martín d9662164b8 Remove unused code to display polls with no dates
When this code was added, in commit 1a20a3ce4, we had no validation
rules checking the presence of the start and end dates of a poll. Now we
do, so we don't have to check this condition in the view.
2024-06-07 16:19:29 +02:00

15 lines
308 B
Ruby

class Polls::PollComponent < ApplicationComponent
attr_reader :poll
use_helpers :cannot?, :current_user, :link_to_poll
def initialize(poll)
@poll = poll
end
private
def dates
I18n.t("polls.dates", open_at: l(poll.starts_at.to_date), closed_at: l(poll.ends_at.to_date))
end
end