From 789a354570a21ee4ddc8df13df5a948c9160aea9 Mon Sep 17 00:00:00 2001 From: Maja Komel Date: Fri, 6 Oct 2017 12:13:37 +0200 Subject: [PATCH 1/4] UX: Delete Tag Warning Improvement --- .../javascripts/discourse/controllers/tags-show.js.es6 | 3 ++- config/locales/client.en.yml | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index 1e8e0c2fa0b..3cb203b9349 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -115,7 +115,8 @@ export default Ember.Controller.extend(BulkTopicSelection, { deleteTag() { const self = this; - bootbox.confirm(I18n.t("tagging.delete_confirm"), function(result) { + const topicsLength = this.get('list.topic_list.topics.length'); + bootbox.confirm(I18n.t("tagging.delete_confirm", {count: topicsLength}), function(result) { if (!result) { return; } self.get("tag").destroyRecord().then(function() { diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 528cfea5f3c..be0751c5d74 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2454,7 +2454,10 @@ en: tags: "Tags" choose_for_topic: "choose optional tags for this topic" delete_tag: "Delete Tag" - delete_confirm: "Are you sure you want to delete that tag?" + delete_confirm: + one: "Are you sure you want to delete this tag and remove it from 1 topic it is assigned to?" + other: "Are you sure you want to delete this tag and remove it from {{count}} topics it is assigned to?" + zero: "Are you sure you want to delete this tag?" rename_tag: "Rename Tag" rename_instructions: "Choose a new name for the tag:" sort_by: "Sort by:" From 13cc0fd665696e9d0fcdd00300b422465418cf14 Mon Sep 17 00:00:00 2001 From: Maja Komel Date: Fri, 6 Oct 2017 15:35:15 +0200 Subject: [PATCH 2/4] replace zero key with no_topics --- app/assets/javascripts/discourse/controllers/tags-show.js.es6 | 3 ++- config/locales/client.en.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index 3cb203b9349..e7f607174ec 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -116,7 +116,8 @@ export default Ember.Controller.extend(BulkTopicSelection, { deleteTag() { const self = this; const topicsLength = this.get('list.topic_list.topics.length'); - bootbox.confirm(I18n.t("tagging.delete_confirm", {count: topicsLength}), function(result) { + const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm.no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength}) + bootbox.confirm(confirmText, function(result) { if (!result) { return; } self.get("tag").destroyRecord().then(function() { diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index be0751c5d74..02078982668 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2457,7 +2457,7 @@ en: delete_confirm: one: "Are you sure you want to delete this tag and remove it from 1 topic it is assigned to?" other: "Are you sure you want to delete this tag and remove it from {{count}} topics it is assigned to?" - zero: "Are you sure you want to delete this tag?" + no_topics: "Are you sure you want to delete this tag?" rename_tag: "Rename Tag" rename_instructions: "Choose a new name for the tag:" sort_by: "Sort by:" From 3c1e005feafa5aeeb1571fcc0ef110ff2b6932df Mon Sep 17 00:00:00 2001 From: Maja Komel Date: Fri, 6 Oct 2017 15:42:53 +0200 Subject: [PATCH 3/4] missing semicolon --- app/assets/javascripts/discourse/controllers/tags-show.js.es6 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index e7f607174ec..001ff3dd05a 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -116,7 +116,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { deleteTag() { const self = this; const topicsLength = this.get('list.topic_list.topics.length'); - const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm.no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength}) + const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm.no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength}); bootbox.confirm(confirmText, function(result) { if (!result) { return; } From 5780596c507ad7b905d95a81d9d44fe388f40d76 Mon Sep 17 00:00:00 2001 From: Maja Komel Date: Fri, 6 Oct 2017 16:29:29 +0200 Subject: [PATCH 4/4] use delete_confirm_no_topics instead of nested no_topics --- app/assets/javascripts/discourse/controllers/tags-show.js.es6 | 2 +- config/locales/client.en.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 index 001ff3dd05a..467750926f0 100644 --- a/app/assets/javascripts/discourse/controllers/tags-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tags-show.js.es6 @@ -116,7 +116,7 @@ export default Ember.Controller.extend(BulkTopicSelection, { deleteTag() { const self = this; const topicsLength = this.get('list.topic_list.topics.length'); - const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm.no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength}); + const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm_no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength}); bootbox.confirm(confirmText, function(result) { if (!result) { return; } diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 02078982668..83e08cd1408 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2457,7 +2457,7 @@ en: delete_confirm: one: "Are you sure you want to delete this tag and remove it from 1 topic it is assigned to?" other: "Are you sure you want to delete this tag and remove it from {{count}} topics it is assigned to?" - no_topics: "Are you sure you want to delete this tag?" + delete_confirm_no_topics: "Are you sure you want to delete this tag?" rename_tag: "Rename Tag" rename_instructions: "Choose a new name for the tag:" sort_by: "Sort by:"