Skip to content

Commit

Permalink
Merge branch 'hotfix/0.4.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Alm Liljevall committed Mar 27, 2017
2 parents be9f4a0 + 31148ab commit babd89b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
8 changes: 5 additions & 3 deletions viewer/static/js/es6/utils/search.es6
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ export function doSearch() {
const searchField = document.querySelector('#searchQsmart');
for (const node of searchField.childNodes) {
if (node.className.split(' ').indexOf('searchtag') > -1) {
const tag = node.innerHTML.split(':');
const tag = node.innerText.split(':');
if (validTags.indexOf(tag[0].toLowerCase()) > -1) {
tagObject[tag[0]] = tag[1];
} else {
queryText.push(tag[1]);
}
} else if (node.innerHTML !== '') {
queryText.push(`${node.innerHTML}`);
} else if (node.innerText !== '') {
queryText.push(`${node.innerText}`);
}
}
tagObject.q = queryText.join(' ');
Expand Down Expand Up @@ -139,6 +139,7 @@ export function searchFieldBehaviour(e, state, searchField) {
} else {
nextPhrase.focus();
}
return false;
} else if (e.keyCode === 8 && // Backspace
!tagEditing &&
currentPhrase.innerHTML === '' &&
Expand All @@ -153,6 +154,7 @@ export function searchFieldBehaviour(e, state, searchField) {
const oldPhrase = searchField.children[state.counter];
searchField.removeChild(oldPhrase);
previousPhrase.focus();
return false;
}
}

Expand Down
17 changes: 16 additions & 1 deletion viewer/templates/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,22 @@
% elif observation.object.prefLabelByLang and observation.object.prefLabelByLang.sv
<li>
<a href="${observation.view['@id']}" title="${observation.object.prefLabelByLang.sv}">
${observation.object.prefLabelByLang.sv | truncate(30, true) }
% if isinstance(observation.object.prefLabelByLang.sv, list)
${observation.object.prefLabelByLang.sv | join(', ') | truncate(30, true) }
% else
${observation.object.prefLabelByLang.sv | truncate(30, true) }
% endif
</a>
<span class="quantity">(${observation.totalItems})</span>
</li>
% elif observation.object.labelByLang and observation.object.labelByLang.sv
<li>
<a href="${observation.view['@id']}" title="${observation.object.labelByLang.sv}">
% if isinstance(observation.object.labelByLang.sv, list)
${observation.object.labelByLang.sv | join(', ') | truncate(30, true) }
% else
${observation.object.labelByLang.sv | truncate(30, true) }
% endif
</a>
<span class="quantity">(${observation.totalItems})</span>
</li>
Expand Down

0 comments on commit babd89b

Please sign in to comment.