From e7d88f0df9cf4d4ce2703af9de760aeffab1a7ae Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 8 Jan 2020 13:58:22 +0100 Subject: [PATCH] Move "orders closed" message to "shop" tab and adjust "home" tab message display logic --- app/helpers/shop_helper.rb | 3 +-- app/views/shop/_messages.html.haml | 6 ------ .../shopping_shared/_order_cycles.html.haml | 14 +------------ .../shopping_shared/tabs/_shop.html.haml | 21 +++++++++++++++++++ 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/app/helpers/shop_helper.rb b/app/helpers/shop_helper.rb index 12aa5ee69e..4bc9a53907 100644 --- a/app/helpers/shop_helper.rb +++ b/app/helpers/shop_helper.rb @@ -38,8 +38,7 @@ module ShopHelper private def show_home_tab? - require_customer? || shopfront_closed_message? || - current_distributor.preferred_shopfront_message.present? + require_customer? || current_distributor.preferred_shopfront_message.present? end def shopfront_closed_message? diff --git a/app/views/shop/_messages.html.haml b/app/views/shop/_messages.html.haml index 88b541baf9..1bc1bdac8f 100644 --- a/app/views/shop/_messages.html.haml +++ b/app/views/shop/_messages.html.haml @@ -14,12 +14,6 @@ = t '.require_customer_html', {contact: link_to(t('.contact'), '#contact'), enterprise: current_distributor.name} -- elsif @order_cycles and @order_cycles.empty? - - if current_distributor.preferred_shopfront_closed_message.present? - .row - .small-12.columns - .shopfront_closed_message - = current_distributor.preferred_shopfront_closed_message.html_safe - elsif current_distributor.preferred_shopfront_message.present? .row .small-12.columns diff --git a/app/views/shopping_shared/_order_cycles.html.haml b/app/views/shopping_shared/_order_cycles.html.haml index f8a60b14a3..df7bcddd0c 100644 --- a/app/views/shopping_shared/_order_cycles.html.haml +++ b/app/views/shopping_shared/_order_cycles.html.haml @@ -3,18 +3,6 @@ %ordercycle{"ng-controller" => "OrderCycleCtrl"} - - if @order_cycles and @order_cycles.empty? - %h4 - %i.ofn-i_012-warning - = t :shopping_oc_closed - %p - = t :shopping_oc_closed_description - .text-right - %small - %em - = render partial: "shopping_shared/next_order_cycle" - = render partial: "shopping_shared/last_order_cycle" - - - else + - unless @order_cycles and @order_cycles.empty? %form.custom = yield :order_cycle_form diff --git a/app/views/shopping_shared/tabs/_shop.html.haml b/app/views/shopping_shared/tabs/_shop.html.haml index 9983859fce..29feaf5790 100644 --- a/app/views/shopping_shared/tabs/_shop.html.haml +++ b/app/views/shopping_shared/tabs/_shop.html.haml @@ -1,3 +1,24 @@ %script{ type: "text/ng-template", id: "shop/shop.html" } + - if @order_cycles and @order_cycles.empty? + .content + .row + %h4 + %i.ofn-i_012-warning + = t :shopping_oc_closed + %small + %em + ( + = render partial: "shopping_shared/next_order_cycle" + = render partial: "shopping_shared/last_order_cycle" + ) + %p + = t :shopping_oc_closed_description + + + - if shopfront_closed_message? + .row + .shopfront_closed_message + = current_distributor.preferred_shopfront_closed_message.html_safe + - unless require_customer? = render partial: "shop/products/form"