From e9e43c985f53e55ba775b57af882622359d27e06 Mon Sep 17 00:00:00 2001 From: Lucas Hiago Date: Sat, 6 Jun 2020 23:05:53 -0300 Subject: [PATCH 1/2] add missing i18n key for closed OC --- app/controllers/application_controller.rb | 2 +- config/locales/en.yml | 1 + spec/controllers/base_controller_spec.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5e2777feac..8d0ca487c6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -117,7 +117,7 @@ class ApplicationController < ActionController::Base session[:expired_order_cycle_id] = current_order_cycle.id current_order.empty! current_order.set_order_cycle! nil - flash[:info] = "The order cycle you've selected has just closed. Please try again!" + flash[:info] = I18n.t('order_cycle_closed') redirect_to main_app.root_url end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 0c23d12125..34db38bc7b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2435,6 +2435,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using order_cycles_email_to_producers_notice: 'Emails to be sent to producers have been queued for sending.' order_cycles_no_permission_to_coordinate_error: "None of your enterprises have permission to coordinate an order cycle" order_cycles_no_permission_to_create_error: "You don't have permission to create an order cycle coordinated by that enterprise" + order_cycle_closed: "The order cycle you've selected has just closed. Please try again!" back_to_orders_list: "Back to order list" no_orders_found: "No Orders Found" order_information: "Order Information" diff --git a/spec/controllers/base_controller_spec.rb b/spec/controllers/base_controller_spec.rb index 43feeaf6c3..ee7dcb4bcc 100644 --- a/spec/controllers/base_controller_spec.rb +++ b/spec/controllers/base_controller_spec.rb @@ -20,6 +20,6 @@ describe BaseController, type: :controller do expect(session[:expired_order_cycle_id]).to eq oc.id expect(response).to redirect_to root_url - expect(flash[:info]).to eq "The order cycle you've selected has just closed. Please try again!" + expect(flash[:info]).to eq I18n.t('order_cycle_closed') end end From 419b3ef26eee0c01cf2ec567f709ffaaa42c5908 Mon Sep 17 00:00:00 2001 From: Lucas Hiago Date: Wed, 10 Jun 2020 22:30:12 -0300 Subject: [PATCH 2/2] add missing i18n key for check hub ready for checkout --- app/controllers/application_controller.rb | 3 +-- config/locales/en.yml | 1 + spec/controllers/checkout_controller_spec.rb | 2 +- spec/controllers/spree/orders_controller_spec.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8d0ca487c6..d4e42207fb 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -99,8 +99,7 @@ class ApplicationController < ActionController::Base if current_distributor_closed? current_order.empty! current_order.set_distribution! nil, nil - flash[:info] = "The hub you have selected is temporarily closed for orders. "\ - "Please try again later." + flash[:info] = I18n.t('order_cycles_closed_for_hub') redirect_to main_app.root_url end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 34db38bc7b..b91b326326 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2197,6 +2197,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using hub_sidebar_at_least: "At least one hub must be selected" hub_sidebar_blue: "blue" hub_sidebar_red: "red" + order_cycles_closed_for_hub: "The hub you have selected is temporarily closed for orders. Please try again later." report_customers_distributor: "Distributor" report_customers_supplier: "Supplier" report_customers_cycle: "Order Cycle" diff --git a/spec/controllers/checkout_controller_spec.rb b/spec/controllers/checkout_controller_spec.rb index a07f37ff3d..1e113378d2 100644 --- a/spec/controllers/checkout_controller_spec.rb +++ b/spec/controllers/checkout_controller_spec.rb @@ -33,7 +33,7 @@ describe CheckoutController, type: :controller do get :edit expect(response).to redirect_to root_url - expect(flash[:info]).to eq("The hub you have selected is temporarily closed for orders. Please try again later.") + expect(flash[:info]).to eq(I18n.t('order_cycles_closed_for_hub')) end describe "redirection to cart and stripe" do diff --git a/spec/controllers/spree/orders_controller_spec.rb b/spec/controllers/spree/orders_controller_spec.rb index 783c868366..f943512677 100644 --- a/spec/controllers/spree/orders_controller_spec.rb +++ b/spec/controllers/spree/orders_controller_spec.rb @@ -116,7 +116,7 @@ describe Spree::OrdersController, type: :controller do spree_get :edit expect(response).to redirect_to root_url - expect(flash[:info]).to eq("The hub you have selected is temporarily closed for orders. Please try again later.") + expect(flash[:info]).to eq(I18n.t('order_cycles_closed_for_hub')) end describe "when an item is in the cart" do