demarches-normaliennes/app/components/attachment/progress_component.rb
2024-08-22 09:26:48 +02:00

24 lines
541 B
Ruby

# frozen_string_literal: true
class Attachment::ProgressComponent < ApplicationComponent
attr_reader :attachment
attr_reader :ignore_antivirus
def initialize(attachment:, ignore_antivirus: false)
@attachment = attachment
@ignore_antivirus = ignore_antivirus
end
def progress_label
case
when !ignore_antivirus && attachment.virus_scanner.pending?
t(".antivirus_pending")
when attachment.watermark_pending?
t(".watermark_pending")
end
end
def render?
progress_label.present?
end
end