Angularising Order Cycles Index

This commit is contained in:
Rob Harrington
2016-06-24 10:37:19 +10:00
parent bf69ed0008
commit 2a5f598fb0
24 changed files with 437 additions and 182 deletions

View File

@@ -106,10 +106,10 @@ module Admin
end
end
def for_line_items
def visible
respond_to do |format|
format.json do
render_as_json @collection, ams_prefix: 'basic', spree_current_user: spree_current_user
render_as_json @collection, ams_prefix: params[:ams_prefix] || 'basic', spree_current_user: spree_current_user
end
end
end
@@ -157,7 +157,7 @@ module Admin
else
Enterprise.where("1=0")
end
when :for_line_items
when :visible
OpenFoodNetwork::Permissions.new(spree_current_user).visible_enterprises.ransack(params[:q]).result
else
# TODO was ordered with is_distributor DESC as well, not sure why or how we want to sort this now
@@ -168,7 +168,7 @@ module Admin
end
def collection_actions
[:index, :for_order_cycle, :for_line_items, :bulk_update]
[:index, :for_order_cycle, :visible, :bulk_update]
end
def load_methods_and_fees