Add new suggestion attribute to render custom text on tags

Add "display_text" to allow customize the text that we want render on tag.
For Goals we render "SDG1", "SDG2"..
For Targets we render the code "1.1", "1.A"...
This commit is contained in:
taitus
2021-01-18 12:19:18 +01:00
parent f463baf14a
commit c18ab66cc7
6 changed files with 27 additions and 1 deletions

View File

@@ -5,6 +5,19 @@
if ($(".sdg-related-list-selector").length) {
var amsify_suggestags = new AmsifySuggestags($(".sdg-related-list-selector .input"));
amsify_suggestags.getItem = function(value) {
var item_key = this.getItemKey(value);
return this.settings.suggestions[item_key];
};
amsify_suggestags.getTag = function(value) {
if (this.getItem(value) !== undefined) {
return this.getItem(value).display_text;
} else {
return value;
}
};
amsify_suggestags._settings({
suggestions: $(".sdg-related-list-selector .input").data("suggestions-list"),
whiteList: true,