Sha256: 115f5f06866ec7a344d0fcba40874cf175a55831bb5e25e21c0dea3fd4d9618d

Contents?: true

Size: 965 Bytes

Versions: 23

Compression:

Stored size: 965 Bytes

Contents

class AdminAssistant
  class PaperclipColumn < Column
    attr_reader :name
    
    def initialize(name)
      @name = name.to_s
    end
    
    def contains?(column_name)
      column_name.to_s == @name ||
      column_name.to_s =~
          /^#{@name}_(file_name|content_type|file_size|updated_at)$/
    end
    
    class View < AdminAssistant::Column::View
      def image_html(record)
        @action_view.image_tag record.send(@column.name).url
      end
    end
    
    class FormView < View
      include AdminAssistant::Column::FormViewMethods
      
      def default_html(form)
        form.file_field name
      end
    end

    class IndexView < View
      include AdminAssistant::Column::IndexViewMethods
      
      def html(record)
        image_html record
      end
    end
    
    class ShowView < View
      include AdminAssistant::Column::ShowViewMethods
      
      def html(record)
        image_html record
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
admin_assistant-2.4.0 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.3.2 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.3.1 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.3.0 lib/admin_assistant/paperclip_column.rb
admin_assistant-1.0.4 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.8 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.7 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.6 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.5 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.4 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.3 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.2 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.1 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.2.0 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.1.1 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.1.0 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.0.1 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.0.0 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.0.0.pre2 lib/admin_assistant/paperclip_column.rb
admin_assistant-2.0.0.pre1 lib/admin_assistant/paperclip_column.rb