From 09d254b36932382d6b1d744d09d233e5cd96fee5 Mon Sep 17 00:00:00 2001 From: janzenisaac <50783505+janzenisaac@users.noreply.github.com> Date: Fri, 19 Nov 2021 11:55:14 -0600 Subject: [PATCH] FIX: Update aria-labels on mobile / dropdown (#254) - Update aria labels on mobile and for re-assign dropdown - Fixes: https://dev.discourse.org/t/quicker-assign-to-self-when-group-is-assigned/54647/33?u=isaacjanzen --- .../initializers/extend-for-assigns.js.es6 | 21 ++++++++++++------- config/locales/client.en.yml | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 index 76e6c48..f117c5b 100644 --- a/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 +++ b/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6 @@ -129,7 +129,12 @@ function registerTopicFooterButtons(api) { const content = [ { id: "unassign", - name: htmlSafe( + name: I18n.t("discourse_assign.unassign.help", { + username: + this.topic.assigned_to_user?.username || + this.topic.assigned_to_group?.name, + }), + label: htmlSafe( `${iconHTML("user-times")} ${I18n.t( "discourse_assign.unassign.title" )}` @@ -143,7 +148,8 @@ function registerTopicFooterButtons(api) { ) { content.push({ id: "reassign-self", - name: htmlSafe( + name: I18n.t("discourse_assign.reassign.to_self_help"), + label: htmlSafe( `${iconHTML("user-plus")} ${I18n.t( "discourse_assign.reassign.to_self" )}` @@ -152,7 +158,8 @@ function registerTopicFooterButtons(api) { } content.push({ id: "reassign", - name: htmlSafe( + name: I18n.t("discourse_assign.reassign.help"), + label: htmlSafe( `${iconHTML("group-plus")} ${I18n.t( "discourse_assign.reassign.title_w_ellipsis" )}` @@ -311,10 +318,10 @@ function registerTopicFooterButtons(api) { return "user-plus"; }, translatedTitle() { - return defaultTitle(this); + return I18n.t("discourse_assign.reassign.to_self_help"); }, translatedAriaLabel() { - return defaultTitle(this); + return I18n.t("discourse_assign.reassign.to_self_help"); }, translatedLabel() { const label = I18n.t("discourse_assign.reassign.to_self"); @@ -361,10 +368,10 @@ function registerTopicFooterButtons(api) { return "group-plus"; }, translatedTitle() { - return defaultTitle(this); + return I18n.t("discourse_assign.reassign.help"); }, translatedAriaLabel() { - return defaultTitle(this); + return I18n.t("discourse_assign.reassign.help"); }, translatedLabel() { const label = I18n.t("discourse_assign.reassign.title_w_ellipsis"); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 543e07f..118f6fc 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -43,6 +43,7 @@ en: title: "Re-assign" title_w_ellipsis: "Re-assign to..." to_self: "Re-assign to me" + to_self_help: "Re-assign Topic to me" help: "Re-assign Topic to a different user" reassign_modal: title: "Re-assign Topic"