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
|
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
|
|
|
|
|
|
|
|
def blob_path
|
|
|
|
Rails.application.routes.url_helpers.rails_blob_path(data)
|
|
|
|
end
|
|
|
|
end
|