Sha256: 9875606eea8df888d52fec83d72b749abf875993df077c9aeaa33219b80dcc23

Contents?: true

Size: 950 Bytes

Versions: 2

Compression:

Stored size: 950 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.page(params[:page]).per(Spree::Config[:orders_per_page])
    end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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