From 27bc5805aea806328a665e84a8cfe728d0747565 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 11 Feb 2022 10:44:46 +0000 Subject: [PATCH 1/3] Removes signup string from private shop login screen --- app/views/shop/messages/_customer_required.html.haml | 2 +- config/locales/en.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/views/shop/messages/_customer_required.html.haml b/app/views/shop/messages/_customer_required.html.haml index 9e050c5092..05a49e2eeb 100644 --- a/app/views/shop/messages/_customer_required.html.haml +++ b/app/views/shop/messages/_customer_required.html.haml @@ -6,7 +6,7 @@ %p - if spree_current_user.nil? %p - = t('.require_login_html', login: ('' + t('.login') + '').html_safe, signup: ('' + t('.signup') + '').html_safe) + = t('.require_login_3_html', login: ('' + t('.login') + '').html_safe) %p = t('.require_login_2_html', contact: link_to(t('.contact'), '#contact'), enterprise: current_distributor.name) - else diff --git a/config/locales/en.yml b/config/locales/en.yml index e639a9faa5..606fa075d5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1487,10 +1487,9 @@ en: messages: customer_required: login: "login" - signup: "signup" contact: "contact" require_customer_login: "Only approved customers can access this shop." - require_login_html: "If you're already an approved customer, %{login} or %{signup} to proceed." + require_login_3_html: "If you're already an approved customer, %{login} to proceed." require_login_2_html: "Want to start shopping here? Please %{contact} %{enterprise} and ask about joining." require_customer_html: "If you'd like to start shopping here, please %{contact} %{enterprise} to ask about joining." select_oc: From 1113aefe11af1a51d4c41dd3493a8fcd4fba0c00 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 11 Feb 2022 11:04:36 +0000 Subject: [PATCH 2/3] Adds login modal test case from #8861 --- spec/system/consumer/authentication_spec.rb | 19 +++++++++++++++++++ .../system/consumer/shopping/shopping_spec.rb | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/spec/system/consumer/authentication_spec.rb b/spec/system/consumer/authentication_spec.rb index dc2a8930ba..f236037fcf 100644 --- a/spec/system/consumer/authentication_spec.rb +++ b/spec/system/consumer/authentication_spec.rb @@ -156,6 +156,25 @@ describe "Authentication", js: true do end end + describe "Logging in from the private shop page" do + let(:distributor) { create(:distributor_enterprise, require_login: true) } + let!(:order_cycle) { + create(:simple_order_cycle, distributors: [distributor], + coordinator: create(:distributor_enterprise)) + } + before do + visit enterprise_shop_path(distributor) + end + + it "clicking login triggers the login modal" do + within "#shop-tabs" do + find("a", text: "login").click + end + expect(page).to have_selector("a.active", text: "Login") + expect(page).to have_button("Login") + end + end + describe "after following email confirmation link" do it "shows confirmed message in modal" do visit root_path(anchor: "/login", validation: "confirmed") diff --git a/spec/system/consumer/shopping/shopping_spec.rb b/spec/system/consumer/shopping/shopping_spec.rb index e22b841bcf..35290dfdaa 100644 --- a/spec/system/consumer/shopping/shopping_spec.rb +++ b/spec/system/consumer/shopping/shopping_spec.rb @@ -543,7 +543,7 @@ describe "As a consumer I want to shop with a distributor", js: true do it "tells us to login" do visit shop_path expect(page).to have_content "Only approved customers can access this shop." - expect(page).to have_content "login or signup" + expect(page).to have_content "login to proceed" expect(page).to have_no_content product.name expect(page).not_to have_selector "ordercycle" end From cefd5db6ebe682a5c973097209cc0d1e8ee88cac Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 18 Feb 2022 11:07:37 +0000 Subject: [PATCH 3/3] Renames require_login_3_html key --- app/views/shop/messages/_customer_required.html.haml | 2 +- config/locales/en.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/shop/messages/_customer_required.html.haml b/app/views/shop/messages/_customer_required.html.haml index 05a49e2eeb..8943568258 100644 --- a/app/views/shop/messages/_customer_required.html.haml +++ b/app/views/shop/messages/_customer_required.html.haml @@ -6,7 +6,7 @@ %p - if spree_current_user.nil? %p - = t('.require_login_3_html', login: ('' + t('.login') + '').html_safe) + = t('.require_login_link_html', login: ('' + t('.login') + '').html_safe) %p = t('.require_login_2_html', contact: link_to(t('.contact'), '#contact'), enterprise: current_distributor.name) - else diff --git a/config/locales/en.yml b/config/locales/en.yml index 606fa075d5..96c26482c5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1489,7 +1489,7 @@ en: login: "login" contact: "contact" require_customer_login: "Only approved customers can access this shop." - require_login_3_html: "If you're already an approved customer, %{login} to proceed." + require_login_link_html: "If you're already an approved customer, %{login} to proceed." require_login_2_html: "Want to start shopping here? Please %{contact} %{enterprise} and ask about joining." require_customer_html: "If you'd like to start shopping here, please %{contact} %{enterprise} to ask about joining." select_oc: