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

feat: Show user created submission parts on the project page

parent bda0ca96
No related branches found
No related tags found
No related merge requests found
$(document).ready(function(){
// fetch all submission part project representations from database
getSubmissionPartsByProjectId(getProjectIdFromUrl(), function (response) {
// iterate over response and display each element
for (let i = 0; i < response.length; i++) {
displaySubmission(response[i].user, response[i].category, response[i].fullSubmissionId);
}
// add click listener to feedback buttons
$('.annotationview').click(function () {
location.href="annotation-document.jsp?token="+getUserTokenFromUrl();
});
}, function () {
// display empty view
displayEmptyView()
});
/*
var memberTable = $('#myGroupMembers');
memberTable.hide();
......@@ -13,11 +31,65 @@ $(document).ready(function(){
location.href="viewfeedback.jsp?token="+getUserTokenFromUrl();
});
$('.annotationview').click(function () {
location.href="annotation-document.jsp?token="+getUserTokenFromUrl();
});
$('#btnUnstructuredUpload').click(function () {
location.href="unstructured-upload.jsp?token="+getUserTokenFromUrl() + "&projectId=" + getProjectIdFromUrl();
})
});
\ No newline at end of file
});
/**
* Display category of submission part in list
*
* @param user The user of the submission part
* @param category The category of the submission part
* @param fullSubmissionId The id of the full submission the submission part belongs to
*/
function displaySubmission(user, category, fullSubmissionId) {
// build link
$('#submissionUpload').append(
$('<li>')
.append($('<span>').append(category.toUpperCase() + " eingereicht"))
.append($('<a>').attr("class", "annotationview").attr("role", "button")
.append($('<label>').css("font-size", "10px")
.append($('<i>').attr("class", "far fa-comments").css("font-size", "15px"))
.append("feedback")
)
)
)
// add data to link
.data("fullSubmissionId", fullSubmissionId);
}
/**
* Display a not found message if there are no submission parts in the database (or on error)
*/
function displayEmptyView() {
// build link
$('#submissionUpload').append(
$('<li>')
.append($('<span>').append("keine Daten gefunden"))
);
}
/**
* GET: Get all representations of a submission part for a given project id
*
* @param projectId The id of the project
* @param responseHandler The response handler
* @param errorHandler The error handler
*/
function getSubmissionPartsByProjectId(projectId, responseHandler, errorHandler) {
var url = "../rest/submissions/project/" + projectId;
$.ajax({
url: url,
type: "GET",
dataType: "json",
success: function (response) {
// handle the response
responseHandler(response);
},
error: function () {
// handle the error
errorHandler();
}
})
}
\ No newline at end of file
......@@ -95,14 +95,7 @@
<img src="../assets/img/3.jpg">
<a href="#">student3@uni.de</a>
<hr>
<ul>
<li>
"Viva la Floristika" - Titel hochgeladen
<a class="annotationview" role="button">
<label style="font-size:10px;"><i class="far fa-comments"
style="font-size:15px;"></i>feedback</label>
</a>
</li>
<ul id="submissionUpload">
</ul>
</td>
......
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