Sha256: 70213e7ae7e83855cf6c6d111335da747483bcbbe55b076164459c9f8ffc5e95

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

class Spree::Admin::PageImagesController < Spree::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|
      Spree::PageImage.update_all(['position=?', index], ['id=?', id])
    end
    respond_to do |format|
      format.js  { render :text => 'Ok' }
    end
  end
  
  private
  
  def location_after_save
    admin_page_images_url(@page)
  end

  def load_data
    @page = Spree::Page.find_by_path(params[:page_id])
  end

  def set_viewable
    @page_image.viewable = @page
  end

  def destroy_before
    @viewable = @page_image.viewable
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_essential_cms-0.4.0 app/controllers/spree/admin/page_images_controller.rb
spree_essential_cms-0.3.0.rc1 app/controllers/spree/admin/page_images_controller.rb