Sha256: 98030b35fdb7eef7408ab5633068e514d0eca2e3ff05bfa8155f8cba7169af06

Contents?: true

Size: 791 Bytes

Versions: 17

Compression:

Stored size: 791 Bytes

Contents

module ActiveScaffold
  module Helpers
    module ListColumnHelpers
      def active_scaffold_column_dragonfly(record, column)
        attachment = record.send("#{column.name}")
        return nil unless attachment.present?
        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')
      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

17 entries across 17 versions & 1 rubygems

Version Path
active_scaffold-3.4.17 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.16 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.14 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.13 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.12 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.11 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.10 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.9 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.8 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.7 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.5 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.4 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.3 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.2 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.0.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.0 lib/active_scaffold/bridges/dragonfly/list_ui.rb