demarches-normaliennes/app/components/editable_champ/champ_label_content_component.rb

18 lines
361 B
Ruby
Raw Normal View History

2022-08-12 10:45:04 +02:00
class EditableChamp::ChampLabelContentComponent < ApplicationComponent
include ApplicationHelper
def initialize(champ:, seen_at: nil)
@champ, @seen_at = champ, seen_at
2022-08-12 10:45:04 +02:00
end
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