Sha256: f3a2d30c5b395a65cc3bf7713b57ccc94f6b3e38fe0d93f397773251ee2f5381
Contents?: true
Size: 1.15 KB
Versions: 32
Compression:
Stored size: 1.15 KB
Contents
require 'rails_admin/config/fields/base' require 'rails_admin/config/fields/types/file_upload' module RailsAdmin module Config module Fields module Types # Field type that supports Paperclip file uploads class Dragonfly < RailsAdmin::Config::Fields::Types::FileUpload RailsAdmin::Config::Fields::Types.register(self) register_instance_option :image? do false unless value if abstract_model.model.new.respond_to?("#{name}_name") bindings[:object].send("#{name}_name").to_s.split('.').last =~ /jpg|jpeg|png|gif/i else true # Dragonfly really is image oriented end end register_instance_option :delete_method do "remove_#{name}" end register_instance_option :cache_method do "retained_#{name}" end register_instance_option :thumb_method do '100x100>' end def resource_url(thumb = false) return nil unless (v = value) thumb ? v.thumb(thumb).try(:url) : v.url end end end end end end
Version data entries
32 entries across 32 versions & 2 rubygems