Skip to content
Snippets Groups Projects
Commit b5730561 authored by tudtianus's avatar tudtianus
Browse files

fix: added grid layout to createJournal.html, moved markdown to html conversion to server

parent ae80be24
No related branches found
No related tags found
No related merge requests found
...@@ -147,6 +147,11 @@ ...@@ -147,6 +147,11 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.atlassian.commonmark</groupId>
<artifactId>commonmark</artifactId>
<version>0.11.0</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package unipotsdam.gf.modules.journal.service; package unipotsdam.gf.modules.journal.service;
import org.commonmark.renderer.html.HtmlRenderer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import unipotsdam.gf.modules.assessment.controller.StudentIdentifier; import unipotsdam.gf.modules.assessment.controller.StudentIdentifier;
import unipotsdam.gf.modules.journal.model.Journal; import unipotsdam.gf.modules.journal.model.Journal;
import unipotsdam.gf.modules.journal.model.JournalFilter; import unipotsdam.gf.modules.journal.model.JournalFilter;
import unipotsdam.gf.modules.journal.model.Visibility; import unipotsdam.gf.modules.journal.model.Visibility;
import org.commonmark.node.*;
import org.commonmark.parser.Parser;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
...@@ -83,7 +85,7 @@ public class DummyJournalService implements JournalService { ...@@ -83,7 +85,7 @@ public class DummyJournalService implements JournalService {
if (Long.valueOf(id) == -1){ if (Long.valueOf(id) == -1){
StudentIdentifier studentId = new StudentIdentifier(student,project); StudentIdentifier studentId = new StudentIdentifier(student,project);
journals.add(new Journal(this.id++, studentId, text , cal.getTimeInMillis(), stringToVisibility(visibility) , category)); journals.add(new Journal(this.id++, studentId, convertMarkdownToHtml(text) , cal.getTimeInMillis(), stringToVisibility(visibility) , category));
} else { } else {
for (Journal j : journals){ for (Journal j : journals){
...@@ -142,4 +144,16 @@ public class DummyJournalService implements JournalService { ...@@ -142,4 +144,16 @@ public class DummyJournalService implements JournalService {
return journals; return journals;
} }
/**
* Converts a markdown text to html
* @param markdown markdown text
* @return html text
*/
private String convertMarkdownToHtml (String markdown){
Parser parser = Parser.builder().build();
Node document = parser.parse("This is *Sparta*");
HtmlRenderer renderer = HtmlRenderer.builder().build();
return renderer.render(document);
}
} }
.jounral-form-container {
height:90vh;
display: grid;
grid-template-rows: 5% 90% 5%;
grid-template-columns: 40% 40% 20%;
}
.visibility{
grid-column-start:1;
grid-column-end:1;
grid-row-start:1;
grid-row-end:1;
}
.category{
grid-column-start:2;
grid-column-end:2;
grid-row-start:1;
grid-row-end:1;
}
.editor{
grid-column-start:1;
grid-column-end:3;
grid-row-start:2;
grid-row-end:2;
}
.save{
grid-column-start:1;
grid-column-end:1;
grid-row-start:3;
grid-row-end:3;
}
.back{
grid-column-start:2;
grid-column-end:2;
grid-row-start:3;
grid-row-end:3;
}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<script src="https://cdn.jsdelivr.net/npm/inscrybmde@1.11.3/dist/inscrybmde.min.js"></script>
<link rel="stylesheet" type="text/css" href="../assets/css/journal.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/inscrybmde@1.11.3/dist/inscrybmde.min.css">
</head>
<body> <body>
<form id="journalform" class="form-journal" method="POST" action="../rest/journal/save"> <h1> Tagebucheintrag erstellen </h1>
<input type="hidden" name="student" value="0"> <form id="journalform" class="form-journal" method="POST" action="../rest/journal/save">
<input type="hidden" name="project" value="0">
<input type="hidden" name="student" value="0">
<div> <input type="hidden" name="project" value="0">
<textarea name="text" form="journalform">
</textarea> <div class="jounral-form-container">
<div class = "visibility">
Sichtbarkeit:
<select name="visibility" form="journalform">
<option value="ALL"> Alle </option>
<option value="GROUP"> Gruppe </option>
<option value="DOZENT"> Dozent </option>
<option value="NONE"> Niemand </option>
</select>
</div> </div>
<div> <div class = "category">
<select name="visibility" form="journalform"> Kategorie:
<option value="ALL"> Alle </option> <select name="category" form="journalform">
<option value="GROUP"> Gruppe </option> <option value="A"> A </option>
<option value="DOZENT"> Dozent </option> <option value="B"> B </option>
<option value="NONE"> Niemand </option> </select>
</select>
</div> </div>
<div>
<select name="category" form="journalform">
<option value="A"> A </option> <div class ="editor">
<option value="B"> B </option> <textarea id = "editor" name="text" form="journalform" >
</select> </textarea>
</div>
<div class="save">
<input type="submit">
</div>
<div class="back">
<button> Zurück </button>
</div> </div>
<input type="submit"> </div>
</form> </form>
<script>
var editor = new InscrybMDE({
element: document.getElementById("editor"),
spellChecker: false,
forceSync: true,
});
</script>
</body> </body>
</html> </html>
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