mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
29 lines
717 B
Ruby
29 lines
717 B
Ruby
module Admin
|
|
class DistributorsController < ResourceController
|
|
before_filter :load_distributor_set, :only => :index
|
|
before_filter :load_countries, :except => :index
|
|
|
|
def bulk_update
|
|
@distributor_set = DistributorSet.new(params[:distributor_set])
|
|
if @distributor_set.save
|
|
redirect_to main_app.admin_distributors_path, :notice => 'Distributor collection times updated.'
|
|
else
|
|
render :index
|
|
end
|
|
end
|
|
|
|
private
|
|
def load_distributor_set
|
|
@distributor_set = DistributorSet.new :distributors => collection
|
|
end
|
|
|
|
def load_countries
|
|
@countries = Spree::Country.order(:name)
|
|
end
|
|
|
|
def collection
|
|
super.order(:name)
|
|
end
|
|
end
|
|
end
|