Sha256: b31b87c2bdbe1ebb93e69d5a54c2dbd6c7140ff5838ecef0addb874f9dac04e4

Contents?: true

Size: 831 Bytes

Versions: 23

Compression:

Stored size: 831 Bytes

Contents

module ActiveScaffold
  module Helpers
    module ListColumnHelpers
      def active_scaffold_column_dragonfly(record, column)
        attachment = record.send(column.name.to_s)
        return nil if attachment.blank?
        content =
          if attachment.image?
            image_tag(attachment.thumb(column.options[:thumb] || ActiveScaffold::Bridges::Dragonfly::DragonflyBridgeHelpers.thumbnail_style).url, :border => 0)
          else
            attachment.name
          end
        link_to(content, dragonfly_url_for_attachment(attachment, record, column), :target => '_blank', rel: 'noopener noreferrer')
      end

      def dragonfly_url_for_attachment(attachment, record, column)
        url_method = column.options[:private_store] ? :url : :remote_url
        attachment.send(url_method)
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
active_scaffold-3.6.0 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.0.rc2 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.0.rc1 lib/active_scaffold/bridges/dragonfly/list_ui.rb