From 0aa8b1a30eaa1146750e72fd9141bca3a962a7a2 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sun, 12 May 2019 08:41:14 +0100 Subject: [PATCH] Make shop hidden ams injection consistent with other uses --- app/controllers/enterprises_controller.rb | 16 +--------------- app/views/enterprises/shop.html.haml | 2 +- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb index e33a10a296..ebc139c461 100644 --- a/app/controllers/enterprises_controller.rb +++ b/app/controllers/enterprises_controller.rb @@ -17,15 +17,11 @@ class EnterprisesController < BaseController return redirect_to spree.cart_path unless enough_stock? set_noindex_meta_tag - enterprises = current_distributor + @enterprises = current_distributor .plus_relatives_and_oc_producers(shop_order_cycles) .activated .includes(address: :state) .all - - enterprises = inject_json_ams('enterprises', enterprises) - - render locals: { enterprises: enterprises } end def relatives @@ -111,14 +107,4 @@ class EnterprisesController < BaseController def set_noindex_meta_tag @noindex_meta_tag = true unless current_distributor.visible? end - - def inject_json_ams(name, object) - options = { - each_serializer: Api::EnterpriseSerializer, - data: OpenFoodNetwork::EnterpriseInjectionData.new - } - serializer_instance = ActiveModel::ArraySerializer.new(object, options) - - { name: name, json: serializer_instance.to_json } - end end diff --git a/app/views/enterprises/shop.html.haml b/app/views/enterprises/shop.html.haml index 041c8be07b..ed27346d2d 100644 --- a/app/views/enterprises/shop.html.haml +++ b/app/views/enterprises/shop.html.haml @@ -5,7 +5,7 @@ - content_for(:image) do = current_distributor.logo.url -= render partial: 'json/injection_ams', locals: enterprises += inject_enterprises(@enterprises) %shop.darkswarm - if @shopfront_layout == 'embedded'