Sha256: 271bb426904a5c9ae0a893080b4f6fe007a2861edd4cee471e549a79af2186e9

Contents?: true

Size: 730 Bytes

Versions: 4

Compression:

Stored size: 730 Bytes

Contents

class Spud::Admin::MediaPickerController < Spud::Admin::ApplicationController

  include RespondsToParent

  layout false
  respond_to :html

  def index
    @media = SpudMedia.all
    respond_with @media
  end

  def create
    @media = SpudMedia.new(media_params)
    if @media.save
      if request.xhr?
        render 'create', :status => 200
      else
        respond_to_parent do
          render 'create.js', :status => 200
        end
      end
    else
      render nil, :status => 422
    end
  end

private
  def media_params
    params.require(:spud_media).permit(:attachment_content_type,:attachment_file_name,:attachment_file_size,:attachment, :is_protected, :crop_x, :crop_y, :crop_w, :crop_h, :crop_s)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spud_media-1.0.1 app/controllers/spud/admin/media_picker_controller.rb
spud_media-1.0.0 app/controllers/spud/admin/media_picker_controller.rb
spud_media-1.0.0.rc1.1 app/controllers/spud/admin/media_picker_controller.rb
spud_media-1.0.0.rc1 app/controllers/spud/admin/media_picker_controller.rb