Sha256: e6597e7766fff6dc341bd1d48530fbb9eadd4ab8fe3e9f10fc43ca540523b4ed

Contents?: true

Size: 972 Bytes

Versions: 1

Compression:

Stored size: 972 Bytes

Contents

class ::Admin::PagesController < ::Admin::ResourceController
  
  before_filter :load_resource
  
  def index
    @pages = collection
  end
  
  def location_after_save
    case params[:action]
      when "create"
        edit_admin_page_content_path(@page, @page.contents.first)
      else
        admin_page_path(@page)
    end        
  end

  def update_positions
    params[:positions].each do |id, index|
      Page.update_all(['position=?', index], ['id=?', id])
    end
    respond_to do |format|
      format.html { redirect_to admin_pages_path }
      format.js  { render :text => 'Ok' }
    end
  end

  private
  
    def find_resource
      @page ||= Page.find_by_path(params[:id])
    end
  
    def collection
      params[:search] ||= {}
      params[:search][:meta_sort] ||= "page.asc"
      @search = Page.metasearch(params[:search])
      @collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page])
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_essential_cms-0.1.2 app/controllers/admin/pages_controller.rb