Sha256: 37c36a023ce3fa0a11f34c3fd677d6cb595f3ac01648b83860ecb8bef39fcc64

Contents?: true

Size: 809 Bytes

Versions: 29

Compression:

Stored size: 809 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

29 entries across 29 versions & 1 rubygems

Version Path
active_scaffold-3.4.43 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.42 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.41.1 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.41 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.40 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.39 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.38 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.37 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.36 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.35 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.34 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.33 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.32 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.31 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.30 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.29 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.28 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.27 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.26 lib/active_scaffold/bridges/dragonfly/list_ui.rb
active_scaffold-3.4.25 lib/active_scaffold/bridges/dragonfly/list_ui.rb