diff --git a/ietf/static/js/select2.js b/ietf/static/js/select2.js
index caf72e3dc..5b9590f09 100644
--- a/ietf/static/js/select2.js
+++ b/ietf/static/js/select2.js
@@ -19,6 +19,24 @@ function prettify_tz(x) {
return x.text.replaceAll("_", " ").replaceAll("/", " / ");
}
+function search_template_result(data) {
+ if (data.url == null) {
+ return data.text;
+ }
+ var $link = $("" + data.text + "");
+ $link.prop("href", data.url);
+ $link.on("mouseup", function (evt) {
+ // Do not propagate any events which have modifiers keys
+ // or if some other mouse button than 1 (left) was used.
+ if (evt.shiftKey || evt.ctrlKey || evt.metaKey || evt.altKey ||
+ evt.which != 1) {
+ evt.stopPropagation();
+ }
+ });
+
+ return $link;
+}
+
// Copyright The IETF Trust 2015-2021, All Rights Reserved
// JS for ietf.utils.fields.SearchableField subclasses
window.setupSelect2Field = function (e) {
@@ -37,7 +55,8 @@ window.setupSelect2Field = function (e) {
);
}
- template_modify = e.hasClass("tz-select") ? prettify_tz : undefined;
+ template_modify = e.hasClass("tz-select") ? prettify_tz :
+ (e.hasClass("search-select") ? search_template_result : undefined);
// focus the search field automatically
$(document)
diff --git a/ietf/templates/base.html b/ietf/templates/base.html
index 10e999112..1571ff500 100644
--- a/ietf/templates/base.html
+++ b/ietf/templates/base.html
@@ -69,7 +69,7 @@
{% endif %}