demarches-normaliennes/app/fields/attachment_field.rb

13 lines
276 B
Ruby
Raw Normal View History

# frozen_string_literal: true
require "administrate/field/base"
class AttachmentField < Administrate::Field::Base
include ActionView::Helpers::NumberHelper
def to_s
2023-03-22 09:28:08 +01:00
return "" if data.blank?
"#{data.filename} (#{number_to_human_size(data.byte_size)})"
end
end