refactor(champ_label): use ApplicationHelper

This commit is contained in:
simon lehericey 2022-11-21 12:22:12 +01:00 committed by LeSim
parent b185614c87
commit 0e610179fb

View file

@ -1,4 +1,6 @@
class EditableChamp::ChampLabelContentComponent < ApplicationComponent class EditableChamp::ChampLabelContentComponent < ApplicationComponent
include ApplicationHelper
def initialize(champ:, seen_at: nil) def initialize(champ:, seen_at: nil)
@champ, @seen_at = champ, seen_at @champ, @seen_at = champ, seen_at
end end
@ -12,8 +14,4 @@ class EditableChamp::ChampLabelContentComponent < ApplicationComponent
def highlight? def highlight?
@champ.updated_at.present? && @seen_at&.<(@champ.updated_at) @champ.updated_at.present? && @seen_at&.<(@champ.updated_at)
end end
def try_format_datetime(datetime)
datetime.present? ? I18n.l(datetime) : ''
end
end end