Sha256: d5f962753694fd1b0f2d031be305d108274ea69361cb2dec2cfa69446d4bcd93

Contents?: true

Size: 689 Bytes

Versions: 3

Compression:

Stored size: 689 Bytes

Contents

class Admin::PageImagesController < 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|
      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 = 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

3 entries across 3 versions & 1 rubygems

Version Path
spree_essential_cms-0.1.2 app/controllers/admin/page_images_controller.rb
spree_essential_cms-0.2.1 app/controllers/admin/page_images_controller.rb
spree_essential_cms-0.2.0 app/controllers/admin/page_images_controller.rb