Fri, 18 Dec 2020 16:16:54 +0100
Add mailto link to the display name above comments - fixes #112
universe@86 | 1 | package de.uapcore.lightpit.viewmodel; |
universe@86 | 2 | |
universe@162 | 3 | import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension; |
universe@162 | 4 | import com.vladsch.flexmark.ext.tables.TablesExtension; |
universe@162 | 5 | import com.vladsch.flexmark.html.HtmlRenderer; |
universe@162 | 6 | import com.vladsch.flexmark.parser.Parser; |
universe@162 | 7 | import com.vladsch.flexmark.util.data.MutableDataSet; |
universe@146 | 8 | import de.uapcore.lightpit.entities.Issue; |
universe@146 | 9 | import de.uapcore.lightpit.entities.IssueComment; |
universe@86 | 10 | |
universe@162 | 11 | import java.util.Arrays; |
universe@146 | 12 | import java.util.List; |
universe@86 | 13 | |
universe@146 | 14 | public class IssueDetailView extends ProjectView { |
universe@99 | 15 | private Issue issue; |
universe@86 | 16 | |
universe@124 | 17 | private List<IssueComment> comments; |
universe@86 | 18 | |
universe@99 | 19 | public void setIssue(Issue issue) { |
universe@86 | 20 | this.issue = issue; |
universe@86 | 21 | } |
universe@86 | 22 | |
universe@86 | 23 | public Issue getIssue() { |
universe@86 | 24 | return issue; |
universe@86 | 25 | } |
universe@86 | 26 | |
universe@124 | 27 | public List<IssueComment> getComments() { |
universe@124 | 28 | return comments; |
universe@124 | 29 | } |
universe@124 | 30 | |
universe@124 | 31 | public void setComments(List<IssueComment> comments) { |
universe@124 | 32 | this.comments = comments; |
universe@124 | 33 | } |
universe@162 | 34 | |
universe@162 | 35 | public void processMarkdown() { |
universe@162 | 36 | final var options = new MutableDataSet() |
universe@162 | 37 | .set(Parser.EXTENSIONS, Arrays.asList(TablesExtension.create(), StrikethroughExtension.create())) |
universe@162 | 38 | .toImmutable(); |
universe@162 | 39 | final var parser = Parser.builder(options).build(); |
universe@162 | 40 | final var renderer = HtmlRenderer.builder(options).build(); |
universe@162 | 41 | |
universe@162 | 42 | issue.setDescription(renderer.render(parser.parse(issue.getDescription()))); |
universe@162 | 43 | for (var comment : comments) { |
universe@162 | 44 | comment.setComment(renderer.render(parser.parse(comment.getComment()))); |
universe@162 | 45 | } |
universe@162 | 46 | } |
universe@86 | 47 | } |