Files
openfoodnetwork/app/views/enterprises/shop.html.haml
Pau Perez cca15e75a6 Refactor to reveal how we load enterprises in shop
By sticking to Rails conventions we make it more obvious how (badly) we
are loading enterprises in EnterprisesController#shop and shed some
light on the obscure InjectionHelper.

This will also make it easier to improve its performance in the future as
it's among the top offenders. See https://www.skylight.io/app/applications/ibo3NOqCYMnq/1545851520/1d/endpoints/EnterprisesController%23shop?responseType=html
2019-01-03 11:17:10 +01:00

46 lines
1.6 KiB
Plaintext

- content_for(:title) do
= current_distributor.name
- content_for(:description) do
= current_distributor.description
- content_for(:image) do
= current_distributor.logo.url
= render partial: 'json/injection_ams', locals: enterprises
%shop.darkswarm
- if @shopfront_layout == 'embedded'
= render partial: 'shop/blocked_cookies'
.alert-box.changeable-orders-alert.info.animate-show{ ng: { show: "alert.visible && alert.html", cloak: true } }
%span{ ng: { bind: { html: "alert.html" } } }
%a.close{ ng: { click: "alert.close()" } } ×
- content_for :order_cycle_form do
%div{"ng-controller" => "OrderCycleChangeCtrl", "ng-cloak" => true}
%closing{"ng-if" => "OrderCycle.selected()"}
= t :enterprises_next_closing
%strong {{ OrderCycle.orders_close_at() | date_in_words }}
%span
= t :enterprises_ready_for
/ Will this label should be a variable to reflect 'Ready for pickup / delivery' as appropriate
%select.avenir#order_cycle_id{"ng-model" => "order_cycle.order_cycle_id",
"ofn-change-order-cycle" => true,
"disabled" => require_customer?,
"ng-options" => "oc.id as oc.time for oc in #{@order_cycles.map {|oc| {time: pickup_time(oc), id: oc.id}}.to_json}",
"popover-placement" => "left", "popover" => t(:enterprises_choose), "popover-trigger" => "openTrigger"}
= render partial: "shopping_shared/details"
= render partial: 'shop/messages'
- unless require_customer?
.row= render partial: "shop/products/form"
= render partial: "shared/footer"