Sha256: 79e350e1dc97b7631462fe74d597a2d350a78ff23eb6377301eb8c0743b98a32

Contents?: true

Size: 695 Bytes

Versions: 2

Compression:

Stored size: 695 Bytes

Contents

class Blog::Admin::PostImagesController < Admin::ResourceController
  
  before_filter :load_data

  create.before :set_viewable
  update.before :set_viewable
  destroy.before :destroy_before

  def update_positions
    params[:positions].each do |id, index|
      PostImage.update_all(['position=?', index], ['id=?', id])
    end

    respond_to do |format|
      format.js  { render :text => 'Ok' }
    end
  end
  
  private
  
  def location_after_save
    admin_post_images_url(@post)
  end

  def load_data
    @post = Post.find_by_path(params[:post_id])
  end

  def set_viewable
    @post_image.viewable = @post
  end

  def destroy_before
    @viewable = @post_image.viewable
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_essential_blog-0.1.0 app/controllers/blog/admin/post_images_controller.rb
spree_essential_blog-0.1.0.rc1 app/controllers/blog/admin/post_images_controller.rb