Sha256: a2c7e7098b3dca603224bea10e0b1149e13fb69832dbc9bf0d159500eec22c34

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 Bytes

Contents

module Admin

  class ImageUploadController < BaseController

    def upload_image
      @image = params[:image_class].classify.constantize.new
      @image.send("#{params[:field]}=", params[:image])
      @image.valid?
      @free_size = params[:free_size] || false

      @errors = @image.errors[params[:field].to_sym]
      if @errors.blank?
        @preview_url = if params[:version].present?
                         @image.send("#{params[:field]}_url", params[:version].to_sym)
                       else
                         @image.send("#{params[:field]}_url")
                       end
        @image_cache = @image.send("#{params[:field]}_cache")
        render '/admin/common/upload_image'
      else
        render '/admin/common/upload_failed'
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
coalla-cms-0.4.2.0 app/controllers/admin/image_upload_controller.rb
coalla-cms-0.4.4.3 app/controllers/admin/image_upload_controller.rb