2022-08-12 10:45:04 +02:00
|
|
|
class EditableChamp::ChampLabelContentComponent < ApplicationComponent
|
2022-11-21 12:22:12 +01:00
|
|
|
include ApplicationHelper
|
2023-05-05 09:13:05 +02:00
|
|
|
include Dsfr::InputErrorable
|
2022-11-21 12:22:12 +01:00
|
|
|
|
2023-05-05 09:13:05 +02:00
|
|
|
def initialize(form:, champ:, seen_at: nil)
|
|
|
|
@form, @champ, @seen_at = form, champ, seen_at
|
|
|
|
@attribute = :value
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|
2022-09-09 11:36:25 +02:00
|
|
|
|
|
|
|
def highlight_if_unseen_class
|
|
|
|
if highlight?
|
|
|
|
'highlighted'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def highlight?
|
|
|
|
@champ.updated_at.present? && @seen_at&.<(@champ.updated_at)
|
|
|
|
end
|
2022-08-12 10:45:04 +02:00
|
|
|
end
|