Commit 1051e15a authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

984: Fix search result lookup for title, links and images

Task-Url: https://pm.winseda.de/issues/984
parent 5bcfa407
......@@ -375,7 +375,7 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
}
// TODO This is MWW specific
if (resultElements[i].info !== undefined && resultElements[i].info != null &&
/*if (resultElements[i].info !== undefined && resultElements[i].info != null &&
resultElements[i].info.Mmm !== undefined) {
if (resultElements[i].info.Mmm.Descriptionset.Description.Title !== undefined) {
......@@ -400,8 +400,8 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
} else {
content.push(["link", ""]);
}
}
/*if (resultElements[i].info !== undefined && resultElements[i].info != null &&
} */
if (resultElements[i].info !== undefined && resultElements[i].info != null &&
resultElements[i].info.Resource !== undefined) {
if (resultElements[i].info.Resource.Title !== undefined) {
......@@ -414,19 +414,19 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
var link = "";
for (var j=0; j<resultElements[i].info.Resource.Link.length; j++) {
if (resultElements[i].info.Resource.Link[j]["~"].startsWith("http")) {
link += "<a href='" + resultElements[i].info.Resource.Link[j]["~"] + "' target='_blank'>" + resultElements[i].info.Resource.Link[j]["~"] + "</a><br />";
link += this.createLink(resultElements[i].info.Resource.Link[j]["~"]);
}
}
content.push(["link", {"~": link}]);
} else {
if (resultElements[i].info.Resource.Link["~"].startsWith("http")) {
content.push(["link", {"~": "<a href='" + resultElements[i].info.Resource.Link["~"] + "' target='_blank'>" + resultElements[i].info.Resource.Link["~"] + "</a><br />"}])
content.push(["link", {"~": this.createLink(resultElements[i].info.Resource.Link["~"])}])
}
}
} else {
content.push(["link", ""]);
}
} */else {
} else {
content.push(["title", "<em>" + __translator.translate("~eu.dariah.de.minfba.search.view.result.no_title") + "</em>"]);
content.push(["link", ""]);
}
......@@ -446,6 +446,13 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
};
QueryHandler.prototype.createLink = function(link) {
return "<a href='" + link + "' target='_blank'><i class='fa fa-external-link' aria-hidden='true'></i> " + (link.length > 100 ? link.substring(0, 100) + "..." : link) + "</a><br />";
};
QueryHandler.prototype.handleImages = function(images, index) {
var _this = this;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment