Commit e04eb17e 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 118dfdf9
#person-groups {
list-style-type: none;
margin-bottom: 0;
margin-top: 10px;
padding-left: 30px;
padding-right: 20px;
}
\ No newline at end of file
...@@ -86,6 +86,19 @@ var Util = function() { ...@@ -86,6 +86,19 @@ var Util = function() {
}; };
var __util = new Util(); var __util = new Util();
$(document).ready(function() {
__util.localizeBootbox($("html").prop("lang"));
});
Util.prototype.localizeBootbox = function(lang) {
if (bootbox!==undefined) {
bootbox.setDefaults({
locale: lang
});
}
};
Util.prototype.escapeHtml = function(string) { Util.prototype.escapeHtml = function(string) {
var _this = this; var _this = this;
return String(string).replace(/[&<>"'\/]/g, function(s) { return String(string).replace(/[&<>"'\/]/g, function(s) {
......
var elementGroups;
$(document).ready(function() {
elementGroups = new ElementGroups();
});
function ElementGroups() {
__translator.addTranslations(["~eu.dariah.de.minfba.cosmotool.view.person_group.remove"]);
__translator.getTranslations();
this.refreshElementGroups();
};
ElementGroups.prototype.editGroup = function(groupId) {
var _this = this;
var form_identifier = "edit-element-group";
this.form = null;
modalFormHandler = new ModalFormHandler({
formFullUrl: __util.composeUrl("elementCollections/" + groupId + "/forms/edit"),
method: "GET",
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.queryGroup = function(groupId) {
};
ElementGroups.prototype.refreshElementGroups = function() {
var _this = this;
$.ajax({
url: __util.composeUrl("elementCollections/list"),
type: "GET",
dataType: "json",
success: function(data) {
if (data!==undefined && data!==null && data.length>0) {
$("#person-groups").text("");
for (var i=0; i<data.length; i++) {
_this.displayGroupListItem(data[i]);
}
}
},
error: __util.processServerError
});
};
ElementGroups.prototype.deleteGroup = function(groupId) {
var _this = this;
bootbox.confirm(__translator.translate("~eu.dariah.de.minfba.cosmotool.view.person_group.remove"), function(result) {
if(result) {
$.ajax({
url: __util.composeUrl("elementCollections/" + groupId + "/remove"),
type: "GET",
dataType: "json",
success: function(data) {
_this.refreshElementGroups();
},
error: __util.processServerError
});
}
});
};
ElementGroups.prototype.displayGroupListItem = function(group) {
$("#person-groups").append( "<li>" +
"<span class='inline-button no-break-out' onclick='elementGroups.queryGroup(\"" + group.id + "\")'><i class='fa fa-users' aria-hidden='true'></i> " + group.name + "</span> " +
"<span class='pull-right'>" +
"<span class='inline-button' onclick='elementGroups.editGroup(\"" + group.id + "\")'><i class='fa fa-pencil' aria-hidden='true'></i></span> " +
"<span class='inline-button' onclick='elementGroups.deleteGroup(\"" + group.id + "\")'><i class='fa fa-trash fa-color-danger' aria-hidden='true'></i></span>" +
"</span>" +
"</li>");
};
\ No newline at end of file
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