From b76defc602ca04b1430a6c3b2c2d126bb39a8fc9 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Wed, 8 Dec 2021 17:58:52 +0100 Subject: [PATCH] Improve notify producer button Add icon Better confirmation message Adds tooltip Adds small icon and change text if already notified --- .../stylesheets/admin/components/buttons.scss | 16 ++++++++++++++++ app/views/admin/order_cycles/edit.html.haml | 8 +++++++- config/locales/en.yml | 4 +++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/admin/components/buttons.scss b/app/assets/stylesheets/admin/components/buttons.scss index 90394f6ad4..078c064c3c 100644 --- a/app/assets/stylesheets/admin/components/buttons.scss +++ b/app/assets/stylesheets/admin/components/buttons.scss @@ -44,4 +44,20 @@ input[type="submit"], input[type="button"], button, .button { box-shadow: none; } } + + .badge { + position: absolute; + top: 0; + right: 0; + transform: translateY(-50%); + font-size: 10px; + text-transform: capitalize; + padding: 0px 5px; + border-radius: 3px; + + &:before { padding: 0 } + + &.danger { background-color: $warning-red; } + &.success { background-color: $spree-green; } + } } \ No newline at end of file diff --git a/app/views/admin/order_cycles/edit.html.haml b/app/views/admin/order_cycles/edit.html.haml index 5c700c5b18..35d0704ae4 100644 --- a/app/views/admin/order_cycles/edit.html.haml +++ b/app/views/admin/order_cycles/edit.html.haml @@ -2,7 +2,13 @@ - content_for :page_actions do - if can? :notify_producers, @order_cycle %li - = button_to t(:notify_producers), main_app.notify_producers_admin_order_cycle_path, :id => 'admin_notify_producers', :confirm => t(:are_you_sure) + - processed = @order_cycle.processed_at.present? + - url = main_app.notify_producers_admin_order_cycle_path + - confirm_msg = "#{t('.notify_producers_tip')} #{t(:are_you_sure)}" + %a.button.icon-email.with-tip{ href: url, data: { method: 'post', confirm: confirm_msg }, 'data-powertip': t('.notify_producers_tip') } + = processed ? t('.re_notify_producers') : t(:notify_producers) + - if processed + .badge.icon-ok.success - content_for :page_title do = t :edit_order_cycle diff --git a/config/locales/en.yml b/config/locales/en.yml index a8f201c096..a14775b280 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1038,6 +1038,8 @@ en: back_to_list: "Back To List" save_and_back_to_list: "Save and Back to List" choose_products_from: "Choose Products From:" + re_notify_producers: Re notify producers + notify_producers_tip: This will send an email to each producer with the list of their orders. incoming: incoming: "Incoming" supplier: "Supplier" @@ -2405,7 +2407,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using new_order_cycle: "New Order Cycle" new_order_cycle_tooltip: "Open shop for a certain time period" select_a_coordinator_for_your_order_cycle: "Select a coordinator for your order cycle" - notify_producers: 'Notify producers' + notify_producers: 'Notify producers' edit_order_cycle: "Edit Order Cycle" roles: "Roles" update: "Update"