Search JS: fixed node type display

This commit is contained in:
Sybren A. Stüvel 2018-01-10 17:22:54 +01:00
parent 55ccd39960
commit ca3d99c52c

View File

@ -163,8 +163,6 @@ $(document).ready(function() {
minLength: 0, minLength: 0,
templates: { templates: {
suggestion: function(hit) { suggestion: function(hit) {
var hitMedia = (hit.media ? ' · <span class="media">'+hit.media+'</span>' : '');
var hitFree = (hit.is_free ? '<div class="search-hit-ribbon"><span>free</span></div>' : ''); var hitFree = (hit.is_free ? '<div class="search-hit-ribbon"><span>free</span></div>' : '');
var hitPicture; var hitPicture;
@ -180,6 +178,9 @@ $(document).ready(function() {
.attr('title', hit.name) .attr('title', hit.name)
.text(hit.name); .text(hit.name);
const $nodeType = $('<span>').addClass('node_type').text(hit.node_type);
const hitMedia = (hit.media ? ' · ' + $('<span>').addClass('media').text(hit.media)[0].outerHTML : '');
return $('<a/>', { return $('<a/>', {
href: '/nodes/'+ hit.objectID + '/redir', href: '/nodes/'+ hit.objectID + '/redir',
class: "search-site-result", class: "search-site-result",
@ -193,10 +194,7 @@ $(document).ready(function() {
$searchHitName.html() + $searchHitName.html() +
'<div class="search-hit-meta">' + '<div class="search-hit-meta">' +
$span.html() + ' · ' + $span.html() + ' · ' +
$('<span>', { $nodeType.html() +
class: "node_type",
text: hit.node_type
}) +
hitMedia + hitMedia +
'</div>' + '</div>' +
'</div>' '</div>'