mirror of
https://github.com/discourse/discourse.git
synced 2025-03-05 02:39:26 +00:00
UX: add confirmation when adding tag synonyms
The new confirmation modal explains that adding a tag as a synonym to another tag will change all topics to replace the synonyms with the base tag.
This commit is contained in:
parent
9e8ee90774
commit
b63d146128
@ -98,27 +98,37 @@ export default Component.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
addSynonyms() {
|
addSynonyms() {
|
||||||
ajax(`/tag/${this.tagInfo.name}/synonyms`, {
|
bootbox.confirm(
|
||||||
type: "POST",
|
I18n.t("tagging.add_synonyms_explanation", {
|
||||||
data: {
|
count: this.newSynonyms.length,
|
||||||
synonyms: this.newSynonyms
|
tag_name: this.tagInfo.name
|
||||||
|
}),
|
||||||
|
result => {
|
||||||
|
if (!result) return;
|
||||||
|
|
||||||
|
ajax(`/tag/${this.tagInfo.name}/synonyms`, {
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
synonyms: this.newSynonyms
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
if (response.success) {
|
||||||
|
this.set("newSynonyms", null);
|
||||||
|
this.loadTagInfo();
|
||||||
|
} else if (response.failed_tags) {
|
||||||
|
bootbox.alert(
|
||||||
|
I18n.t("tagging.add_synonyms_failed", {
|
||||||
|
tag_names: Object.keys(response.failed_tags).join(", ")
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
bootbox.alert(I18n.t("generic_error"));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
}
|
}
|
||||||
})
|
);
|
||||||
.then(result => {
|
|
||||||
if (result.success) {
|
|
||||||
this.set("newSynonyms", null);
|
|
||||||
this.loadTagInfo();
|
|
||||||
} else if (result.failed_tags) {
|
|
||||||
bootbox.alert(
|
|
||||||
I18n.t("tagging.add_synonyms_failed", {
|
|
||||||
tag_names: Object.keys(result.failed_tags).join(", ")
|
|
||||||
})
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
bootbox.alert(I18n.t("generic_error"));
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(popupAjaxError);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3107,6 +3107,9 @@ en:
|
|||||||
edit_synonyms: "Manage Synonyms"
|
edit_synonyms: "Manage Synonyms"
|
||||||
add_synonyms_label: "Add synonyms:"
|
add_synonyms_label: "Add synonyms:"
|
||||||
add_synonyms: "Add"
|
add_synonyms: "Add"
|
||||||
|
add_synonyms_explanation:
|
||||||
|
one: "Any place that currently uses this tag will be changed to use <b>%{tag_name}</b> instead. Are you sure you want to make this change?"
|
||||||
|
other: "Any place that currently uses these tags will be changed to use <b>%{tag_name}</b> instead. Are you sure you want to make this change?"
|
||||||
add_synonyms_failed: "The following tags couldn't be added as synonyms: <b>%{tag_names}</b>. Ensure they don't have synonyms and aren't synonyms of another tag."
|
add_synonyms_failed: "The following tags couldn't be added as synonyms: <b>%{tag_names}</b>. Ensure they don't have synonyms and aren't synonyms of another tag."
|
||||||
remove_synonym: "Remove Synonym"
|
remove_synonym: "Remove Synonym"
|
||||||
delete_synonym_confirm: 'Are you sure you want to delete the synonym "%{tag_name}"?'
|
delete_synonym_confirm: 'Are you sure you want to delete the synonym "%{tag_name}"?'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user