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.7.0 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.20 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.19 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.17 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.15 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.14 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.13 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.12 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.11.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.11 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.10 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.9 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.8 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.6 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.5 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.4.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.4 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.3 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.2 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.6.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb