app/controllers/admin/retailers_controller.rb in spree_retailers-0.50.0.0 vs app/controllers/admin/retailers_controller.rb in spree_retailers-0.70.0.0

- old
+ new

@@ -1,40 +1,19 @@ -class Admin::RetailersController < Admin::BaseController +class Admin::RetailersController < Admin::ResourceController - resource_controller + before_filter :get_locations, :except => [:index,:destroy] - actions :all - - create.response do |wants| - wants.html {redirect_to admin_retailers_path} - end - - update.response do |wants| - wants.html {redirect_to admin_retailers_path} - end - - index.response do |wants| - wants.html { render :action => :index } - wants.json { render :json => @collection.to_json() } - end - - destroy.success.wants.js { render_js_for_destroy } - private - def object - get_states - super - end - def collection params[:search] ||= {} params[:search][:meta_sort] ||= "name.asc" - @search = end_of_association_chain.metasearch(params[:search]) - @collection = @search.paginate(:per_page => Spree::Config[:orders_per_page], :page => params[:page]) + @search = super.search(params[:search]) + @collection = @search.page(params[:page]).per(Spree::Config[:orders_per_page]) end - def get_states + def get_locations + @countries = Country.all.collect{|country| country.name }.sort @states = State.where(:country_id => 214).collect{|state| [state.name, state.abbr] }.sort end end