Skip to content

Commit

Permalink
Merge pull request #1354 from NatLibFi/issue1345-fix-global-search
Browse files Browse the repository at this point in the history
Fix header bar search form
  • Loading branch information
joelit authored Sep 13, 2022
2 parents 17162a2 + e8715d1 commit 63ebd6e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ $(function() { // DOCUMENT READY
createCookie('SKOSMOS_SEARCH_LANG', qlang, 365);
}

$('.lang-button').on('click', function() {
$('a.dropdown-item').on('click', function() {
qlang = $(this)[0].attributes.hreflang ? $(this)[0].attributes.hreflang.value : 'anything';
$('#lang-dropdown-toggle').html($(this).html() + ' <span class="caret"></span>');
$('#lang-input').val(qlang);
Expand Down Expand Up @@ -942,7 +942,7 @@ $(function() { // DOCUMENT READY
// activating the custom autocomplete
function updateVocabParam() {
vocabSelectionString = '';
var $vocabs = $('li > a.active input');
var $vocabs = $('button.active input');
$.each($vocabs,
function(index, ob) {
if (ob.value === 'multiselect-all') {
Expand Down Expand Up @@ -1008,6 +1008,10 @@ $(function() { // DOCUMENT READY
}
updateVocabParam();
},
onSelectAll: function() {
selectedVocabs = [];
updateVocabParam();
},
maxHeight: 300
});

Expand Down
2 changes: 1 addition & 1 deletion resource/js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function createCookie(name,value,days) {
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toGMTString();
}
document.cookie = name + "=" + value + expires + "; path=/";
document.cookie = name + "=" + value + expires + "; path=/; SameSite=Lax";
}

function readCookie(name) {
Expand Down
4 changes: 2 additions & 2 deletions view/headerbar.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
?clang={{langcode}}
{%- set paramSeparator = '&' -%}
{%- endif %}
{%- if term %}{{ paramSeparator }}q={{ term }}{% set paramSeparor = '&' %}{% endif -%}
{%- if vocabs %}{{ paramSepartor }}vocabs={{ vocabs }}{% endif -%}
{%- if term %}{{ paramSeparator }}q={{ term }}{% set paramSeparator = '&' %}{% endif -%}
{%- if vocabs %}{{ paramSeparator }}vocabs={{ vocabs }}{% endif -%}
" class="lang-button" hreflang="{{ langcode }}">{{ langcode | lang_name(request.lang) }}</a></li>
{% endfor %}
{% endif %}
Expand Down

0 comments on commit 63ebd6e

Please sign in to comment.