Sha256: 7980dbbb64d7b0e6e1d314e1b27745a6f9b3dbf1e976b13186e4540ef1d37016

Contents?: true

Size: 583 Bytes

Versions: 46

Compression:

Stored size: 583 Bytes

Contents

require 'active_support/concern'

module ResourceRow
  module PaperclipExtensions
    extend ActiveSupport::Concern

    def thumbnail(attachment_name, options = {})
      options.reverse_merge!(style: :original)
      style = options.delete(:style)

      attachment = resource.send(attachment_name)
      return column(attachment_name) unless attachment.respond_to?(:url)

      image_tag = h.image_tag(attachment.url(style))
      column(attachment_name) { |resource| h.link_to(image_tag, h.send("#{resource.class.name.demodulize.underscore}_path", resource)) }
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
itsf_backend-5.0.0.pre app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.2.3 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.2.2 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.2.1 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.2.0 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.0.1 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-4.0.0 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.1.1 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.1.0 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.7 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.6 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.5 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.4 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.3 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.2 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.1 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-3.0.0 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-2.2.1 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-2.2.0 app/extensions/concerns/resource_row/paperclip_extensions.rb
itsf_backend-2.1.0 app/extensions/concerns/resource_row/paperclip_extensions.rb