2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-17 10:43:50 +02:00
|
|
|
require "administrate/field/base"
|
|
|
|
|
|
|
|
class AttachmentField < Administrate::Field::Base
|
2022-04-21 17:29:42 +02:00
|
|
|
include ActionView::Helpers::NumberHelper
|
2019-05-17 10:43:50 +02:00
|
|
|
def to_s
|
2023-03-22 09:28:08 +01:00
|
|
|
return "" if data.blank?
|
|
|
|
|
2022-04-21 17:29:42 +02:00
|
|
|
"#{data.filename} (#{number_to_human_size(data.byte_size)})"
|
2019-05-17 10:43:50 +02:00
|
|
|
end
|
|
|
|
end
|