Commit edc2e814 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1191: Create search result detail view

Task-Url: https://pm.winseda.de/issues/1191
parent 142140b9
......@@ -60,6 +60,10 @@ h5, .h5 {
.search-result-image-tmb {
height: 135px;
width: 135px;
}
.search-result-image-tmb,
.item-image {
background-repeat:no-repeat;
background-position: center center;
background-size: cover;
......@@ -133,6 +137,47 @@ h5, .h5 {
text-align: center;
vertical-align: middle;
}
/*!
* Individual item view
*/
#carousel-item-images {
margin: 0 auto;
background-color: #FFF;
padding: 5px;
border: 1px solid #DDD;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
/* Android ≤ 1.6, iOS 1-3.2, Safari 3-4 */
-webkit-border-radius: 5px;
/* Android 2.1+, Chrome, Firefox 4+, IE 9+, iOS 4+, Opera 10.50+, Safari 5+ */
border-radius: 5px;
/* useful if you don't want a bg color from leaking outside the border: */
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
#carousel-item-images .carousel-control.right,
#carousel-item-images .carousel-control.left {
color: #222;
text-shadow: 1px 1px 5px #FFF;
}
#carousel-item-images .carousel-indicators li {
background-color: rgba(34, 34, 34, 0.5);
/*border-color: rgba(34, 34, 34, 1);*/
}
#carousel-item-images .carousel-indicators li.active {
background-color: rgba(34, 34, 34, 0.9);
/*border-color: rgba(34, 34, 34, 1);*/
}
/*!
......
var resultItem;
$(document).ready(function() {
resultItem = new ResultItem();
});
$(window).resize(function() {
resultItem.resize();
});
var ResultItem = function(options) {
this.options = $.extend({
images : {
maxWidth : 400
}
}, options);
this.resize();
$('.venobox').venobox();
};
ResultItem.prototype.resize = function() {
var innerWidth = $("#item-images-container").width();
if (innerWidth > this.options.images.maxWidth) {
innerWidth = this.options.images.maxWidth;
}
var containerWidth = $("#item-images-container").width();
if (containerWidth > this.options.images.maxWidth+150) {
containerWidth = this.options.images.maxWidth+150;
}
$("#carousel-item-images").css("width", innerWidth + "px");
$(".item-image").css("height", innerWidth + "px");
$(".item-image").css("width", innerWidth + "px");
};
\ No newline at end of file
......@@ -554,6 +554,7 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
// TODO arrays, rest
content.push(["datasource", resultElements[i].collectionName]);
content.push(["resultId", encodeURIComponent(resultElements[i].id).replace(/[!'()]/g, escape).replace(/\*/g, "%2A")]);
content.push(["type", resultElements[i].datasetId]);
if (explain) {
content.push(["score", __translator.translate("~eu.dariah.de.minfba.search.view.result.resources.score") + ": " + resultElements[i].score]);
......@@ -561,13 +562,13 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
content.push(["score", ""]);
}
if (resultElements[i].original!==undefined && resultElements[i].original!==null) {
content.push(["original", resultElements[i].original]);
if (resultElements[i].contentHtml!==undefined && resultElements[i].contentHtml!==null) {
content.push(["original", resultElements[i].contentHtml]);
} else {
hideElements.push(".original-data-panel");
}
content.push(["snippet", resultElements[i].snippet]);
content.push(["snippet", resultElements[i].integrationHtml]);
if (resultElements[i].explanation != null) {
content.push(["explanation", resultElements[i].explanation]);
......@@ -575,30 +576,30 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
$(itemTemplate).find(".search-result-subpanel").addClass("hide");
}
if (resultElements[i].info !== undefined && resultElements[i].info != null &&
resultElements[i].info.Presentation !== undefined) {
if (resultElements[i].presentation !== undefined && resultElements[i].presentation != null &&
resultElements[i].presentation.Presentation !== undefined) {
if (resultElements[i].info.Presentation.Title !== undefined) {
content.push(["title", resultElements[i].info.Presentation.Title, 500]);
if (resultElements[i].presentation.Presentation.Title !== undefined) {
content.push(["title", resultElements[i].presentation.Presentation.Title, 500]);
} else {
content.push(["title", "<em>" + __translator.translate("~eu.dariah.de.minfba.search.view.result.no_title") + "</em>"]);
}
if (resultElements[i].info.Presentation.Link !== undefined) {
if(resultElements[i].info.Presentation.Link instanceof Array) {
if (resultElements[i].presentation.Presentation.Link !== undefined) {
if(resultElements[i].presentation.Presentation.Link instanceof Array) {
var link = "";
for (var j=0; j<resultElements[i].info.Presentation.Link.length; j++) {
if (resultElements[i].info.Presentation.Link[j]["~"]===undefined) {
link += this.createLink(resultElements[i].info.Presentation.Link[j].URL, resultElements[i].info.Presentation.Link[j].Type);
} else if (resultElements[i].info.Presentation.Link[j]["~"].startsWith("http")) {
link += this.createLink(resultElements[i].info.Presentation.Link[j]);
for (var j=0; j<resultElements[i].presentation.Presentation.Link.length; j++) {
if (resultElements[i].presentation.Presentation.Link[j]["~"]===undefined) {
link += this.createLink(resultElements[i].presentation.Presentation.Link[j].URL, resultElements[i].presentation.Presentation.Link[j].Type);
} else if (resultElements[i].presentation.Presentation.Link[j]["~"].startsWith("http")) {
link += this.createLink(resultElements[i].presentation.Presentation.Link[j]);
}
}
content.push(["link", {"~": link}]);
} else {
if (resultElements[i].info.Presentation.Link["~"]===undefined) {
content.push(["link", {"~": this.createLink(resultElements[i].info.Presentation.Link.URL, resultElements[i].info.Presentation.Link.Type)}])
} else if (resultElements[i].info.Presentation.Link["~"].startsWith("http")) {
content.push(["link", {"~": this.createLink(resultElements[i].info.Presentation.Link)}])
if (resultElements[i].presentation.Presentation.Link["~"]===undefined) {
content.push(["link", {"~": this.createLink(resultElements[i].presentation.Presentation.Link.URL, resultElements[i].presentation.Presentation.Link.Type)}])
} else if (resultElements[i].presentation.Presentation.Link["~"].startsWith("http")) {
content.push(["link", {"~": this.createLink(resultElements[i].presentation.Presentation.Link)}])
}
}
} else {
......@@ -608,8 +609,8 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
/*if (resultElements[i].info.Presentation.Images!==undefined && resultElements[i].info.Presentation.Images.Resource!==undefined) {
this.handleImages(resultElements[i].info.Presentation.Images.Resource, i);
/*if (resultElements[i].presentation.Presentation.Images!==undefined && resultElements[i].presentation.Presentation.Images.Resource!==undefined) {
this.handleImages(resultElements[i].presentation.Presentation.Images.Resource, i);
} else {
$("#search-results-image-carousel-" + i).remove();
......@@ -617,16 +618,16 @@ QueryHandler.prototype.processResponseResources = function(isShowMore, resultEle
$("#search-results-resources").append(this.renderResultItem(itemTemplate, content, hideElements));
if (resultElements[i].info.Presentation.Images!==undefined && resultElements[i].info.Presentation.Images.Resource!==undefined) {
this.handleImages(resultElements[i].collectionId, resultElements[i].endpointId, resultElements[i].datasetId, this.getValues(resultElements[i].info.Presentation.Images.Resource), i, false);
if (resultElements[i].presentation.Presentation.Images!==undefined && resultElements[i].presentation.Presentation.Images.Resource!==undefined) {
this.handleImages(resultElements[i].collectionId, resultElements[i].endpointId, resultElements[i].datasetId, this.getValues(resultElements[i].presentation.Presentation.Images.Resource), i, false);
} else {
if (resultElements[i].info.Presentation.Images!==undefined && resultElements[i].info.Presentation.Images.Placeholder!==undefined) {
this.handleImages(resultElements[i].collectionId, resultElements[i].endpointId, resultElements[i].datasetId, this.getValues(resultElements[i].info.Presentation.Images.Placeholder), i, true);
if (resultElements[i].presentation.Presentation.Images!==undefined && resultElements[i].presentation.Presentation.Images.Placeholder!==undefined) {
this.handleImages(resultElements[i].collectionId, resultElements[i].endpointId, resultElements[i].datasetId, this.getValues(resultElements[i].presentation.Presentation.Images.Placeholder), i, true);
}
}
if (resultElements[i].info.Presentation.Objects!==undefined) {
this.handleObjects(resultElements[i].info.Presentation.Objects, i);
if (resultElements[i].presentation.Presentation.Objects!==undefined) {
this.handleObjects(resultElements[i].presentation.Presentation.Objects, i);
}
} else {
content.push(["title", "<em>" + __translator.translate("~eu.dariah.de.minfba.search.view.result.no_title") + "</em>"]);
......
Supports Markdown
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