Sha256: 210899eb61fd77b03766db64adf8357125814af20a6b57d0143bebe3bc47e780

Contents?: true

Size: 735 Bytes

Versions: 29

Compression:

Stored size: 735 Bytes

Contents

module ActiveAdminAddons
  class PaperclipImageBuilder < CustomBuilder
    def render
      return nil if data.nil?
      raise 'you need to pass a paperclip image attribute' unless data.respond_to?(:url)
      style = options.fetch(:style, :original)
      context.image_tag(data.url(style)) if data.exists?
    end
  end

  module ::ActiveAdmin
    module Views
      class TableFor
        def image_column(*args, &block)
          column(*args) { |model| PaperclipImageBuilder.render(self, model, *args, &block) }
        end
      end
      class AttributesTable
        def image_row(*args, &block)
          row(*args) { |model| PaperclipImageBuilder.render(self, model, *args, &block) }
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
activeadmin_addons-0.12.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.11.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.10.1 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.10.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.9.3 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.9.2 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.9.1 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.9.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.8.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.7.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.6.4 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.6.3 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.6.2 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.6.1 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.6.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.5.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.4.0 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.3.4 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.3.3 lib/activeadmin_addons/addons/paperclip_image.rb
activeadmin_addons-0.3.2 lib/activeadmin_addons/addons/paperclip_image.rb