Sha256: 4982b5e17879ec4845cfcaafca9f6297862a2da7c9691525c0f27efa73cf120b
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
class Spree::Admin::ContentsController < Spree::Admin::ResourceController before_filter :load_resource before_filter :parent, :only => :index before_filter :get_pages, :only => [ :new, :edit, :create, :update ] belongs_to 'spree/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(@page) } format.js { render :text => 'Ok' } end end private def get_pages @pages = Spree::Page.order(:position).all end def parent @page ||= Spree::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.page(params[:page]).per(Spree::Config[:orders_per_page]) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_essential_cms-0.3.0.rc1 | app/controllers/spree/admin/contents_controller.rb |