Skip to content
Snippets Groups Projects
Commit 3aa2136f authored by Sven Kästle's avatar Sven Kästle
Browse files

feat: restore category annotations on page load

parent ead2fdb4
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,22 @@ $(document).ready(function() {
// set text in div
$('#documentText').html(response.text);
// get submissions parts from database
getAllSubmissionParts(getSubmissionIdFromUrl(), function (response) {
// iterate over response
for (var i = 0; i < response.length; i++) {
// save current category and body
let category = response[i].category;
let body = response[i].body;
// iterate over body and handle every selection
for (var j = 0; j < body.length; j++) {
handleCategorySelection(category.toLowerCase(), body[j].startCharacter, body[j].endCharacter);
}
}
});
}, function () {
// jump to upload page on error
location.href="unstructured-upload.jsp?token="+getUserTokenFromUrl();
......@@ -17,9 +33,7 @@ $(document).ready(function() {
$('#btnSave').click(function () {
saveButtonHandler();
});
/**
* Context menu handler
*/
......
......@@ -96,9 +96,8 @@ function getSubmissionPart(id, responseHandler, errorHandler) {
*
* @param id The id of the full submission
* @param responseHandler The response handler
* @param errorHandler The error handler
*/
function getAllSubmissionParts(id, responseHandler, errorHandler) {
function getAllSubmissionParts(id, responseHandler) {
var url = "../rest/submissions/full/" + id + "/parts";
$.ajax({
url: url,
......@@ -107,10 +106,6 @@ function getAllSubmissionParts(id, responseHandler, errorHandler) {
success: function (response) {
// handle the response
responseHandler(response);
},
error: function () {
// handle the error
errorHandler();
}
})
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment