Commit 64b4a07a authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1010: Sidebar for collection selection and element collection management

Task-Url: https://pm.winseda.de/issues/1010
parent e04eb17e
......@@ -4,4 +4,13 @@
margin-top: 10px;
padding-left: 30px;
padding-right: 20px;
}
.search-result-birth-death {
margin: 6px;
}
.search-result-death-date, .search-result-death-place,
.search-result-birth-date, .search-result-birth-place {
font-weight: bold;
}
\ No newline at end of file
......@@ -64,9 +64,9 @@ Basesearch.prototype.showSearchResultTags = function(taglist) {
Basesearch.prototype.showSearchResponseItem = function(result) {
var element = $("<div class='well well-sm search-result'>");
var symbols = $("<div class='search-result-symbols pull-right'>")
var symbols = $("<span class='search-result-symbols'>")
/* Buttons and Symbols */
if (result.score!==undefined && result.score!==null && result.score!==0) {
......@@ -82,20 +82,6 @@ Basesearch.prototype.showSearchResponseItem = function(result) {
symbols.append("&nbsp;<span class='glyphicon glyphicon-ok' title='Analyse erfolgt.'>");
}
element.append(symbols);
var title = "<h4 class='search-result-title'><a href='" + __util.composeUrl("person/" + (result.id.replace(/\./g, "/"))) + "' target='_blank'>";
/* Title */
if (result.titleDe!=null && result.titleDe!="") {
title += result.titleDe;
} else {
title += result.titleEn;
}
title += "&nbsp;<span class='glyphicon glyphicon-new-window' aria-hidden='true'></a>";
/* IDs, Links
var ids = "&nbsp;<small><a class='search-result-link-wikidata' href='http://www.wikidata.org/wiki/" + result.id + "' target='_blank'>Wikidata: " + result.id + "</a>";
if (result.gndId!=null && result.gndId.length>0) {
......@@ -104,61 +90,78 @@ Basesearch.prototype.showSearchResponseItem = function(result) {
ids += ("</small>");
title += ids;
*/
element.append(title);
/* Birth and death */
/* on no content: <p> serves as placeholder*/
var birthDeath = "&nbsp;<span class='search-result-birth-death'>";
var birth = "";
if (result.birthDate!=null) {
birthDeath += "<span class='search-result-birth-date'>* " +
birth = "geboren <span class='search-result-birth-date'>" +
result.birthDate +
"</span>";
if (result.birthPlace!=null) {
if (result.birthPlace.titleDe!=null && result.birthPlace.titleDe!="") {
birthDeath += "&nbsp;in <span class='search-result-birth-place'>" + result.birthPlace.titleDe + "</span>";
birth += "&nbsp;in <span class='search-result-birth-place'>" + result.birthPlace.titleDe + "</span>";
} else {
birthDeath += "&nbsp;in <span class='search-result-birth-place'>" + result.birthPlace.titleEn + "</span>";
birth += "&nbsp;in <span class='search-result-birth-place'>" + result.birthPlace.titleEn + "</span>";
}
}
}
// kreuz: &#0134;
var death = "";
if (result.deathDate!=null) {
birthDeath += "; <span class='search-result-death-date'>&#0134; " +
death = "; gestorben <span class='search-result-death-date'>" +
result.deathDate +
"</span>";
if (result.deathPlace!=null) {
if (result.deathPlace.titleDe!=null && result.deathPlace.titleDe!="") {
birthDeath += "&nbsp;in <span class='search-result-death-place'>" + result.deathPlace.titleDe + "</span>";
death += "&nbsp;in <span class='search-result-death-place'>" + result.deathPlace.titleDe + "</span>";
} else {
birthDeath += "&nbsp;in <span class='search-result-death-place'>" + result.deathPlace.titleEn + "</span>";
death += "&nbsp;in <span class='search-result-death-place'>" + result.deathPlace.titleEn + "</span>";
}
}
}
birthDeath += "</span>";
element.append(birthDeath);
/* Description */
var description = "";
if (result.description!=null && result.description!="") {
element.append("<span class='search-result-description'>" + result.description + "</span>");
description = "<p class='search-result-description'>" + result.description + "</p>";
}
/* Categories */
/*if (data.results[i].wikipediaCategories!=null && data.results[i].wikipediaCategories.length>0) {
var categories = $("<p class='search-result-categories'>Kategorien: ");
for (var j=0; j<data.results[i].wikipediaCategories.length; j++) {
categories.append(data.results[i].wikipediaCategories[j]);
if (j<data.results[i].wikipediaCategories.length-1) {
categories.append(", ");
}
}
element.append(categories);
/* Title */
var title;
if (result.titleDe!=null && result.titleDe!="") {
title = result.titleDe;
} else {
title = result.titleEn;
}
*/
var element =
"<div class='panel panel-search-result search-results-resource-item'>" +
"<div class='panel-heading'>" +
(!this.auth ? "" : (
"<div class='pull-right'>" +
"<button onclick='elementGroups.triggerAddToGroup(\"" + result.id + "\");' class='btn btn-default btn-xs'><i class='fa fa-plus' aria-hidden='true'></i></button> " +
"<button onclick='elementGroups.triggerRemoveFromGroup(\"" + result.id + "\");' class='btn btn-default btn-xs'><i class='fa fa-minus' aria-hidden='true'></i></button> " +
"</div>" )) +
"<h3 class='panel-title'><a href='" + __util.composeUrl("person/" + (result.id.replace(/\./g, "/"))) + "' target='_blank'><i class='fa fa-external-link' aria-hidden='true'></i> " + title + "</a>" +
$(symbols).html() +
"</h3>" +
"</div>" +
"<div class='panel-body'>" +
"<div class='panel-group search-result-subpanel'>" +
"<div class='search-result-birth-death'>" +
birth + death +
"</div>" +
"</div>" +
"</div>" +
"</div>";
$("#search-results").append(element);
}
......@@ -5,6 +5,8 @@ $(document).ready(function() {
function Cosmosearch() {
this.getTags();
this.auth = $("#uauth").val()=='true';
};
Cosmosearch.prototype = new Basesearch();
......
......@@ -7,6 +7,8 @@ function ElementGroups() {
__translator.addTranslations(["~eu.dariah.de.minfba.cosmotool.view.person_group.remove"]);
__translator.getTranslations();
this.auth = $("#uauth").val()=='true';
this.refreshElementGroups();
};
......@@ -31,6 +33,33 @@ ElementGroups.prototype.editGroup = function(groupId) {
modalFormHandler.show(form_identifier);
};
ElementGroups.prototype.triggerAddToGroup = function(itemId) {
var _this = this;
var form_identifier = "add-item";
this.form = null;
modalFormHandler = new ModalFormHandler({
formFullUrl: __util.composeUrl("elementCollections/forms/addItem"),
method: "GET",
data: { itemId : itemId },
contentType: "json",
identifier: form_identifier,
translations: [{placeholder: "~*servererror.head", key: "~de.dariah.genericsearch.view.async.servererror.head"},
{placeholder: "~*servererror.body", key: "~de.dariah.genericsearch.view.async.servererror.body"},
{placeholder: "~*validationerrors.head", key: "~eu.dariah.de.minfba.common.view.forms.validationerrors.head"},
{placeholder: "~*validationerrors.body", key: "~eu.dariah.de.minfba.common.view.forms.validationerrors.body"}],
completeCallback: function() {
_this.refreshElementGroups();
}
});
modalFormHandler.show(form_identifier);
};
ElementGroups.prototype.triggerRemoveFromGroup = function(itemId) {
};
ElementGroups.prototype.queryGroup = function(groupId) {
};
......@@ -40,7 +69,6 @@ ElementGroups.prototype.refreshElementGroups = function() {
$.ajax({
url: __util.composeUrl("elementCollections/list"),
type: "GET",
dataType: "json",
success: function(data) {
if (data!==undefined && data!==null && data.length>0) {
$("#person-groups").text("");
......@@ -60,7 +88,6 @@ ElementGroups.prototype.deleteGroup = function(groupId) {
$.ajax({
url: __util.composeUrl("elementCollections/" + groupId + "/remove"),
type: "GET",
dataType: "json",
success: function(data) {
_this.refreshElementGroups();
},
......
......@@ -5,6 +5,8 @@ $(document).ready(function() {
function Groupsearch() {
this.getTags();
this.auth = $("#uauth").val()=='true';
};
Groupsearch.prototype = new Basesearch();
......
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