Sha256: a350427653a6843769bf926aa1f37aff4c05ab7ed34547152c792d3ab93e7a12

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

class ::Admin::ContentsController < ::Admin::ResourceController

  before_filter :load_resource
  before_filter :parent, :only => :index

  belongs_to :page

  def update_positions
    @page = parent
    params[:positions].each do |id, index|
      @page.contents.update_all(['position=?', index], ['id=?', id])
    end
    respond_to do |format|
      format.html { redirect_to admin_page_contents_url(@oage) }
      format.js  { render :text => 'Ok' }
    end
  end
  
  private
    
    def parent
	    @page ||= Page.find_by_path(params[:page_id])
    end
    
    def collection
      params[:search] ||= {}
      params[:search][:meta_sort] ||= "page.asc"
      @search = parent.contents.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/contents_controller.rb