From 4ba954a3cf29e422f4ae4b86b14b1d20d4a54666 Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 21 Aug 2022 16:55:09 +0200 Subject: [PATCH] Add (un)subscribing to vocabulary --- app/javascript/retrospring/features/answerbox/subscribe.ts | 2 +- app/views/actions/_answer.haml | 4 ++-- config/locales/views.en.yml | 2 -- config/locales/voc.en.yml | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/javascript/retrospring/features/answerbox/subscribe.ts b/app/javascript/retrospring/features/answerbox/subscribe.ts index 90abea26..0229cc9a 100644 --- a/app/javascript/retrospring/features/answerbox/subscribe.ts +++ b/app/javascript/retrospring/features/answerbox/subscribe.ts @@ -29,7 +29,7 @@ export function answerboxSubscribeHandler(event: Event): void { success: (data) => { if (data.success) { button.dataset.torpedo = ["yes", "no"][torpedo]; - button.children[0].nextSibling.textContent = ' ' + (torpedo ? I18n.translate('views.actions.unsubscribe') : I18n.translate('views.actions.subscribe')); + button.children[0].nextSibling.textContent = ' ' + (torpedo ? I18n.translate('voc.unsubscribe') : I18n.translate('voc.subscribe')); showNotification(I18n.translate(`frontend.subscription.${torpedo ? 'subscribe' : 'unsubscribe'}`)); } else { showErrorNotification(I18n.translate(`frontend.subscription.fail.${torpedo ? 'subscribe' : 'unsubscribe'}`)); diff --git a/app/views/actions/_answer.haml b/app/views/actions/_answer.haml index aea15c9b..eceb6bd0 100644 --- a/app/views/actions/_answer.haml +++ b/app/views/actions/_answer.haml @@ -3,11 +3,11 @@ -# fun joke should subscribe? %a.dropdown-item{ href: "#", data: { a_id: answer.id, action: "ab-submarine", torpedo: "no" } } %i.fa.fa-fw.fa-anchor - = t(".unsubscribe") + = t("voc.unsubscribe") - else %a.dropdown-item{ href: "#", data: { a_id: answer.id, action: "ab-submarine", torpedo: "yes" } } %i.fa.fa-fw.fa-anchor - = t(".subscribe") + = t("voc.subscribe") - if privileged? answer.user %a.dropdown-item.text-danger{ href: "#", data: { a_id: answer.id, action: "ab-destroy" } } %i.fa.fa-fw.fa-trash-o diff --git a/config/locales/views.en.yml b/config/locales/views.en.yml index 652916c1..aef0e4ed 100644 --- a/config/locales/views.en.yml +++ b/config/locales/views.en.yml @@ -71,8 +71,6 @@ en: otp_attempt: "Please enter the code from your authenticator app" actions: answer: - subscribe: "Subscribe" - unsubscribe: "Unsubscribe" return: "Return to Inbox" comment: view_smiles: "View comment smiles" diff --git a/config/locales/voc.en.yml b/config/locales/voc.en.yml index 020da213..b44108de 100644 --- a/config/locales/voc.en.yml +++ b/config/locales/voc.en.yml @@ -14,6 +14,8 @@ en: logout: "Sign out" save: "Save changes" show_anonymous_questions: "Show all questions from this user" + subscribe: "Subscribe" + unsubscribe: "Unsubscribe" register: "Sign up" report: "Report" terms: "Terms of Service"