From 35de9077daad36cb2def095c6bc1b8488a8bd514 Mon Sep 17 00:00:00 2001 From: jazzdragon Date: Sat, 27 Apr 2019 16:57:02 -0700 Subject: [PATCH 1/5] Add config for taTranslations (no functional change) --- .../admin/enterprises/enterprises.js.coffee | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee index da122761b8..6dd9562557 100644 --- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee +++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee @@ -1 +1,25 @@ -angular.module("admin.enterprises", [ "admin.paymentMethods", "admin.utils", "admin.shippingMethods", "admin.users", "textAngular", "admin.side_menu", "admin.taxons", 'admin.indexUtils', 'admin.tagRules', 'admin.dropdown', 'ngSanitize'] ) \ No newline at end of file +angular.module("admin.enterprises", [ + "admin.paymentMethods", + "admin.utils", + "admin.shippingMethods", + "admin.users", + "textAngular", + "admin.side_menu", + "admin.taxons", + 'admin.indexUtils', + 'admin.tagRules', + 'admin.dropdown', + 'ngSanitize'] +) +.config [ + '$provide', ($provide) -> + $provide.decorator 'taTranslations', [ + '$delegate' + (taTranslations) -> + taTranslations.insertLink = { + tooltip: 'Insert / edit link', + dialogPrompt: "Please enter a URL to insert" + } + taTranslations + ] +] From f6c00715549ea012bf3cd72b73565bed0971802c Mon Sep 17 00:00:00 2001 From: jazzdragon Date: Sat, 27 Apr 2019 17:01:07 -0700 Subject: [PATCH 2/5] Add reference comment --- app/assets/javascripts/admin/enterprises/enterprises.js.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee index 6dd9562557..c16ea65b0a 100644 --- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee +++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee @@ -11,6 +11,7 @@ angular.module("admin.enterprises", [ 'admin.dropdown', 'ngSanitize'] ) +# For more options: https://github.com/textAngular/textAngular/blob/master/src/textAngularSetup.js .config [ '$provide', ($provide) -> $provide.decorator 'taTranslations', [ From b42426a3b81e916ecd694c0ea897a5cb9941433e Mon Sep 17 00:00:00 2001 From: jazzdragon Date: Sat, 27 Apr 2019 18:52:23 -0700 Subject: [PATCH 3/5] Add test for existing input alert text --- spec/features/admin/enterprises_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/features/admin/enterprises_spec.rb b/spec/features/admin/enterprises_spec.rb index ffc2d010b6..ca3b72682f 100644 --- a/spec/features/admin/enterprises_spec.rb +++ b/spec/features/admin/enterprises_spec.rb @@ -209,6 +209,12 @@ feature %q{ page.should have_checked_field "enterprise_preferred_shopfront_order_cycle_order_orders_open_at" expect(page).to have_checked_field "enterprise_require_login_true" expect(page).to have_checked_field "enterprise_enable_subscriptions_true" + + # Test that the right input alert text is displayed + accept_alert('Please enter a URL to insert') do + first('.ta-text').click + first('button[name="insertLink"]').click + end end describe "producer properties" do From 7a27973ae36ed0c1ff41566be084815cf7797b17 Mon Sep 17 00:00:00 2001 From: jazzdragon Date: Sat, 27 Apr 2019 19:22:15 -0700 Subject: [PATCH 4/5] Add translation and references in taTranslations (not working in alert) --- .../javascripts/admin/enterprises/enterprises.js.coffee | 4 ++-- config/locales/en.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee index c16ea65b0a..b33220089a 100644 --- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee +++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee @@ -18,8 +18,8 @@ angular.module("admin.enterprises", [ '$delegate' (taTranslations) -> taTranslations.insertLink = { - tooltip: 'Insert / edit link', - dialogPrompt: "Please enter a URL to insert" + tooltip: "{{'admin.enterprises.form.shop_preferences.shopfront_message_link_tooltip' | t}}", + dialogPrompt: "{{'admin.enterprises.form.shop_preferences.shopfront_message_link_prompt' | t}}" } taTranslations ] diff --git a/config/locales/en.yml b/config/locales/en.yml index eed0881ba6..c6c4f287b0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -793,6 +793,8 @@ en: shopfront_message_placeholder: > An optional explanation for customers detailing how your shopfront works, to be displayed above the product list on your shop page. + shopfront_message_link_tooltip: Insert / edit link + shopfront_message_link_prompt: Please enter a URL to insert shopfront_closed_message: Shopfront Closed Message shopfront_closed_message_placeholder: > A message which provides a more detailed explanation about why your shop is From d7e706e6e7db6ba6b531aaac884be3abb6647eb7 Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 29 Apr 2019 13:39:52 +0100 Subject: [PATCH 5/5] Make text area translations run immeditaly on setup with the t function instead of sending the translation expression down to the textAngular code --- .../admin/enterprises/enterprises.js.coffee | 30 +++++++++---------- config/locales/en.yml | 22 +++++++------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee index b33220089a..bd721c14e4 100644 --- a/app/assets/javascripts/admin/enterprises/enterprises.js.coffee +++ b/app/assets/javascripts/admin/enterprises/enterprises.js.coffee @@ -1,15 +1,15 @@ -angular.module("admin.enterprises", [ - "admin.paymentMethods", - "admin.utils", - "admin.shippingMethods", - "admin.users", - "textAngular", - "admin.side_menu", - "admin.taxons", - 'admin.indexUtils', - 'admin.tagRules', - 'admin.dropdown', - 'ngSanitize'] +angular.module("admin.enterprises", [ + "admin.paymentMethods", + "admin.utils", + "admin.shippingMethods", + "admin.users", + "textAngular", + "admin.side_menu", + "admin.taxons", + 'admin.indexUtils', + 'admin.tagRules', + 'admin.dropdown', + 'ngSanitize'] ) # For more options: https://github.com/textAngular/textAngular/blob/master/src/textAngularSetup.js .config [ @@ -18,9 +18,9 @@ angular.module("admin.enterprises", [ '$delegate' (taTranslations) -> taTranslations.insertLink = { - tooltip: "{{'admin.enterprises.form.shop_preferences.shopfront_message_link_tooltip' | t}}", - dialogPrompt: "{{'admin.enterprises.form.shop_preferences.shopfront_message_link_prompt' | t}}" + tooltip: t('admin.enterprises.form.shop_preferences.shopfront_message_link_tooltip'), + dialogPrompt: t('admin.enterprises.form.shop_preferences.shopfront_message_link_prompt') } taTranslations ] -] +] diff --git a/config/locales/en.yml b/config/locales/en.yml index c6c4f287b0..d5b3f566aa 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -789,25 +789,25 @@ en: enable_subscriptions_tip: "Enable subscriptions functionality?" enable_subscriptions_false: "Disabled" enable_subscriptions_true: "Enabled" - shopfront_message: Shopfront Message + shopfront_message: "Shopfront Message" shopfront_message_placeholder: > An optional explanation for customers detailing how your shopfront works, to be displayed above the product list on your shop page. - shopfront_message_link_tooltip: Insert / edit link - shopfront_message_link_prompt: Please enter a URL to insert - shopfront_closed_message: Shopfront Closed Message + shopfront_message_link_tooltip: "Insert / edit link" + shopfront_message_link_prompt: "Please enter a URL to insert" + shopfront_closed_message: "Shopfront Closed Message" shopfront_closed_message_placeholder: > A message which provides a more detailed explanation about why your shop is closed and/or when customers can expect it to open again. This is displayed on your shop only when you have no active order cycles (ie. shop is closed). - shopfront_category_ordering: Shopfront Category Ordering - open_date: Open Date - close_date: Close Date + shopfront_category_ordering: "Shopfront Category Ordering" + open_date: "Open Date" + close_date: "Close Date" social: - twitter_placeholder: eg. @the_prof - instagram_placeholder: eg. the_prof - facebook_placeholder: eg. www.facebook.com/PageNameHere - linkedin_placeholder: eg. www.linkedin.com/in/YourNameHere + twitter_placeholder: "eg. @the_prof" + instagram_placeholder: "eg. the_prof" + facebook_placeholder: "eg. www.facebook.com/PageNameHere" + linkedin_placeholder: "eg. www.linkedin.com/in/YourNameHere" stripe_connect: connect_with_stripe: "Connect with Stripe" stripe_connect_intro: "To accept payments using credit card, you will need to connect your stripe account to the Open Food Network. Use the button to the right to get started."