Skip to content

Commit

Permalink
Merge pull request #2540 from sul-dlss/locale-searchahead
Browse files Browse the repository at this point in the history
update typeahead separator for locales
  • Loading branch information
taylor-steve authored Sep 10, 2024
2 parents 088ca83 + c0533a9 commit ed2e767
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/assets/javascripts/exhibit_search_typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
var container = el.parents('.exhibit-search-typeahead');
_this.typeaheadElement = el;
_this.form = el.parents('form');
_this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + '?q=%QUERY';
const separator = el.data().typeaheadRemoteUrl.includes('?') ? '&' : '?';
_this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + `${separator}q=%QUERY`;
_this.preventFormSubmitOnTypeahead();

// Cleanup typeahead if it alread exists (e.g. back-button cache)
Expand Down
3 changes: 2 additions & 1 deletion app/assets/javascripts/index_status_typeahead.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
init: function (el) {
var _this = this;
_this.itemStatusRemoteUrl = el.data().typeaheadRemoteUrl;
_this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + '?q=%QUERY';
const separator = el.data().typeaheadRemoteUrl.includes('?') ? '&' : '?';
_this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + `${separator}q=%QUERY`;
el.typeahead(_this.typeaheadOptions, _this.typeaheadSources());

el.bind('typeahead:selected', function(e, suggestion) {
Expand Down

0 comments on commit ed2e767

Please sign in to comment.