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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user