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.
15 lines
308 B
Ruby
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
|