From 387a5ec950bc7558523624c7682fdefc688e0acf Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 23 May 2020 12:48:38 +0200 Subject: [PATCH] Implement "Take me shopping" button --- .../darkswarm/controllers/cart_controller.js.coffee | 3 ++- .../stylesheets/darkswarm/cart-dropdown.css.scss | 11 ++++++++++- .../stylesheets/darkswarm/expanding-sidebar.css.scss | 4 ---- app/assets/stylesheets/darkswarm/ui.css.scss | 4 ++++ app/views/shared/menu/_cart_sidebar.html.haml | 5 ++++- config/locales/en.yml | 1 + 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee b/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee index ebad820ebd..119fb640f3 100644 --- a/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee +++ b/app/assets/javascripts/darkswarm/controllers/cart_controller.js.coffee @@ -1,2 +1,3 @@ -Darkswarm.controller "CartCtrl", ($scope, Cart, $timeout) -> +Darkswarm.controller "CartCtrl", ($scope, Cart, CurrentHub) -> $scope.Cart = Cart + $scope.CurrentHub = CurrentHub diff --git a/app/assets/stylesheets/darkswarm/cart-dropdown.css.scss b/app/assets/stylesheets/darkswarm/cart-dropdown.css.scss index a689e1dbd9..c551d7cde2 100644 --- a/app/assets/stylesheets/darkswarm/cart-dropdown.css.scss +++ b/app/assets/stylesheets/darkswarm/cart-dropdown.css.scss @@ -43,12 +43,21 @@ padding-top: 10em; width: 100%; - span { + p { font-size: 1.5em; } } } + .go-shopping { + display: none; + padding: 0 1.5em; + + @include breakpoint(mobile) { + display: inline-block; + } + } + table { width: 100%; border: none; diff --git a/app/assets/stylesheets/darkswarm/expanding-sidebar.css.scss b/app/assets/stylesheets/darkswarm/expanding-sidebar.css.scss index e6b2becbac..b4688e2e84 100644 --- a/app/assets/stylesheets/darkswarm/expanding-sidebar.css.scss +++ b/app/assets/stylesheets/darkswarm/expanding-sidebar.css.scss @@ -57,10 +57,6 @@ button, a.button { width: 48%; } - - a.button { - line-height: 2.75em; - } } @include breakpoint(tablet) { diff --git a/app/assets/stylesheets/darkswarm/ui.css.scss b/app/assets/stylesheets/darkswarm/ui.css.scss index 5143d52cab..26a371daca 100644 --- a/app/assets/stylesheets/darkswarm/ui.css.scss +++ b/app/assets/stylesheets/darkswarm/ui.css.scss @@ -124,6 +124,10 @@ button.success, .button.success { } } +a.button.large { + line-height: 2.75em; +} + button.large, a.button.large { height: 3em; font-size: 1em; diff --git a/app/views/shared/menu/_cart_sidebar.html.haml b/app/views/shared/menu/_cart_sidebar.html.haml index 0b153f7c43..c20b1b21d7 100644 --- a/app/views/shared/menu/_cart_sidebar.html.haml +++ b/app/views/shared/menu/_cart_sidebar.html.haml @@ -23,9 +23,12 @@ %span.total-price.right {{ line_item.total_price | localizeCurrency }} .cart-empty{"ng-show" => "Cart.line_items.length == 0"} - %span + %p = t('.cart_empty') + %a.go-shopping.button.large.bright{ng: {href: "{{ CurrentHub.hub.id ? '#{main_app.shop_path}' : '#{main_app.shops_path}' }}"}} + = t('.take_me_shopping') + .sidebar-footer{"ng-show" => "Cart.line_items.length > 0"} %p.cart-total %strong diff --git a/config/locales/en.yml b/config/locales/en.yml index 89acb46306..614eae8d59 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1222,6 +1222,7 @@ en: items_in_cart: "%{num} items in your cart" close: "Close" cart_empty: "Your cart is empty" + take_me_shopping: "Take me shopping!" signed_in: profile: "Profile" mobile_menu: