Skip to content
Snippets Groups Projects
Commit ce429544 authored by Thomas Schnaak's avatar Thomas Schnaak
Browse files

#64 feat: implemented closeProjectdescription

parent a16948a7
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,16 @@ public class ProjectDescription {
this.timestamp = timestamp;
this.open =true;
}
public ProjectDescription(String id, String name, String description, String project, ArrayList<Link> links, ArrayList<String> group, long timestamp, boolean open) {
this.id = id;
this.student = new StudentIdentifier(project,name);
this.descriptionHTML = convertMarkdownToHtml(description);
this.descriptionMD =description;
this.links = links;
this.group = group;
this.timestamp = timestamp;
this.open = open;
}
public void setDescription (String description){
this.descriptionMD = description;
......
......@@ -143,9 +143,9 @@ public class ProjectDescriptionDAOImpl implements ProjectDescriptionDAO {
String author = rs.getString("author");
String project = rs.getString("project");
String text = rs.getString("text");
String open = rs.getString("open");
boolean open = rs.getBoolean("open");
return new ProjectDescription(id,author,text,project,new ArrayList<>(),new ArrayList<>(),timestamp);
return new ProjectDescription(id,author,text,project,new ArrayList<>(),new ArrayList<>(),timestamp, open);
}
}
var student = getQueryVariable("token");
var project = getQueryVariable("projectId");
var description = 0;
$(document).ready(function() {
$.ajax({
url: "../rest/projectdescription/" + project + "/" + student
}).then(function(data) {
console.log("desc: " + data);
description = data.id;
if (!data.open){
$("#description-edit").remove();
}
$('.journal-description-text').append(data.descriptionHTML);
for(var link in data.links){
$('.journal-description-links').append('<button class="btn btn-default btn-xs" onclick=\'linkLoeschen("'+link+'")\'> <i class="fa fa-trash" aria-hidden="true" ></i></button><a href=\' + data.links[link] + \'>' + link + '</a> <br/>');
......@@ -124,7 +128,7 @@ function linkLoeschen(name) {
function closeJournal() {
//TODO reload when modal close
var journalID = $('#journalID-input').val();
console.log("schließe:=" + journalID);
console.log("schließe=" + journalID);
$.ajax({
type: "POST",
......@@ -139,4 +143,22 @@ function closeJournal() {
}
});
}
function closeDescription() {
console.log("schließe=" + description);
$.ajax({
type: "POST",
url: "../rest/projectdescription/close",
data: description,
contentType: "application/json; charset=utf-8",
crossDomain: true,
dataType: "text",
success: function (data, status, jqXHR) {
console.log("succ");
location.reload();
}
});
}
\ No newline at end of file
......@@ -43,7 +43,7 @@
<div class="journal-description-container">
<div class="journal-description-title">
</div>
<div class="journal-description-edit" align="right">
<div class="journal-description-edit" id="description-edit" align="right">
<a id="editDescriptionLink" class="btn btn-default btn-sm">
<i class="fa fa-pencil"></i> Bearbeiten</a>
<a class="btn btn-default btn-sm" data-toggle="modal" data-target="#closeDescriptionModal"><i class="fa fa-check-square" aria-hidden="true"></i>Abschlie&szlig;en</a>
......@@ -143,7 +143,7 @@
</div>
<div class="modal-footer">
<div class="btn-group">
<button type="button" class="btn btn-primary mr-auto" data-dismiss="modal">Ja</button>
<button type="button" class="btn btn-primary mr-auto" data-dismiss="modal" onclick="closeDescription()">Ja</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Nein</button>
</div>
......
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