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

1289: Finalize initial version of item view

Task-Url: https://pm.winseda.de/issues/1289
parent 64d20b26
......@@ -17,12 +17,13 @@ var ResultItem = function(options) {
this.modelId = $("#modelId").val();
this.itemId = $("#itemId").val();
this.loadedData = [];
$('.venobox').venobox();
};
ResultItem.prototype.resize = function() {
var innerWidth = $("#item-images-container").width();
var innerWidth = $("#item-images").width();
if (innerWidth > this.options.images.maxWidth) {
innerWidth = this.options.images.maxWidth;
}
......@@ -36,6 +37,8 @@ ResultItem.prototype.resize = function() {
$("#carousel-item-images").css("width", innerWidth + "px");
$(".item-image").css("height", innerWidth + "px");
$(".item-image").css("width", innerWidth + "px");
$(".collection-image span").css("font-size", Math.floor($(".collection-image").width()*0.07));
};
ResultItem.prototype.loadOriginalData = function(button) {
......@@ -46,18 +49,30 @@ ResultItem.prototype.loadIntegratedData = function(button) {
this.loadData("integrations", "#item-detail-integrated-container", "#item-detail-integrated", button);
};
ResultItem.prototype.loadData = function(dataType, containerSelector, contentSelector, button) {
$.ajax({
url: __util.getBaseUrl() + "item/" + this.modelId + "/" + this.itemId + "/data?type=" + dataType,
type: "GET",
dataType: "html",
success: function(data, textStatus, jqXHR ) {
$(button).hide();
$(containerSelector).addClass("show");
$(contentSelector).html(data);
},
error: __util.processServerError
});
ResultItem.prototype.loadData = function(dataType, containerSelector, contentSelector, button) {
var indicator = $(button).find(".fas");
if ($(containerSelector).hasClass("show")) {
$(containerSelector).removeClass("show");
$(indicator).addClass("fa-chevron-circle-down").removeClass("fa-chevron-circle-up");
} else if (this.loadedData.includes(dataType)) {
$(containerSelector).addClass("show");
$(indicator).addClass("fa-chevron-circle-up").removeClass("fa-chevron-circle-down");
} else {
var _this = this;
$(indicator).addClass("fa-spinner fa-spin").removeClass("fa-chevron-circle-down");
$.ajax({
url: __util.getBaseUrl() + "item/" + this.modelId + "/" + this.itemId + "/data?type=" + dataType,
type: "GET",
dataType: "html",
success: function(data, textStatus, jqXHR ) {
$(containerSelector).addClass("show");
$(contentSelector).html(data);
_this.loadedData.push(dataType);
$(indicator).addClass("fa-chevron-circle-up").removeClass("fa-spinner fa-spin");
},
error: __util.processServerError
});
}
};
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