#153 adds comment box to issues form

Mon, 09 Aug 2021 16:22:56 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 09 Aug 2021 16:22:56 +0200
changeset 214
69647ddb57f2
parent 213
5b55a5318a83
child 215
028792eda9b7

#153 adds comment box to issues form

src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt file | annotate | diff | comparison | revisions
src/main/resources/localization/strings.properties file | annotate | diff | comparison | revisions
src/main/resources/localization/strings_de.properties file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-form.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-view.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jspf/version-list.jspf file | annotate | diff | comparison | revisions
--- a/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/kotlin/de/uapcore/lightpit/servlet/ProjectServlet.kt	Mon Aug 09 16:22:56 2021 +0200
@@ -557,6 +557,13 @@
                 dao.insertIssue(issue)
             } else {
                 dao.updateIssue(issue)
+                val newComment = http.param("comment")
+                if (!newComment.isNullOrBlank()) {
+                    dao.insertComment(IssueComment(-1, issue.id).apply {
+                        author = http.remoteUser?.let { dao.findUserByName(it) }
+                        comment = newComment
+                    })
+                }
                 issue.id
             }
 
--- a/src/main/resources/localization/strings.properties	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/resources/localization/strings.properties	Mon Aug 09 16:22:56 2021 +0200
@@ -71,6 +71,7 @@
 issue.category.Task=Task
 issue.category.Test=Test
 issue.category=Category
+issue.comment=Comment
 issue.comments.anonauthor=Anonymous Author
 issue.comments.lastupdate=Last edited:
 issue.comments.updateCount=total edits
--- a/src/main/resources/localization/strings_de.properties	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/resources/localization/strings_de.properties	Mon Aug 09 16:22:56 2021 +0200
@@ -70,6 +70,7 @@
 issue.category.Task=Aufgabe
 issue.category.Test=Test
 issue.category=Kategorie
+issue.comment=Kommentar
 issue.comments.anonauthor=Anonymer Autor
 issue.comments.lastupdate=Zuletzt bearbeitet:
 issue.comments.updateCount=mal bearbeitet
--- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Mon Aug 09 16:22:56 2021 +0200
@@ -52,9 +52,9 @@
         </tr>
         </c:if>
         <tr>
-            <th><fmt:message key="component"/></th>
+            <th><label for="issue-component"><fmt:message key="component"/></label></th>
             <td>
-                <select name="component">
+                <select id="issue-component" name="component">
                     <option value="-1"><fmt:message key="placeholder.null-component"/></option>
                     <c:forEach var="comp" items="${viewmodel.components}">
                         <option
@@ -65,9 +65,9 @@
             </td>
         </tr>
         <tr>
-            <th><fmt:message key="issue.category"/></th>
+            <th><label for="issue-category"><fmt:message key="issue.category"/></label></th>
             <td>
-                <select name="category">
+                <select id="issue-category" name="category">
                     <c:forEach var="category" items="${viewmodel.issueCategory}">
                         <option
                                 <c:if test="${category eq issue.category}">selected</c:if>
@@ -79,9 +79,9 @@
             </td>
         </tr>
         <tr>
-            <th><fmt:message key="issue.status"/></th>
+            <th><label for="issue-status"><fmt:message key="issue.status"/></label></th>
             <td>
-                <select name="status">
+                <select id="issue-status" name="status">
                     <c:forEach var="status" items="${viewmodel.issueStatus}">
                         <option
                                 <c:if test="${status eq issue.status}">selected</c:if>
@@ -93,19 +93,19 @@
             </td>
         </tr>
         <tr>
-            <th><fmt:message key="issue.subject"/></th>
-            <td><input name="subject" type="text" maxlength="200" required value="<c:out value="${issue.subject}"/>" /></td>
+            <th><label for="issue-subject"><fmt:message key="issue.subject"/></label></th>
+            <td><input id="issue-subject" name="subject" type="text" maxlength="200" required value="<c:out value="${issue.subject}"/>" /></td>
         </tr>
         <tr>
-            <th class="vtop"><fmt:message key="issue.description"/></th>
+            <th class="vtop"><label for="issue-description"><fmt:message key="issue.description"/></label></th>
             <td>
-                <textarea name="description" rows="10"><c:out value="${issue.description}"/></textarea>
+                <textarea id="issue-description" name="description" rows="10"><c:out value="${issue.description}"/></textarea>
             </td>
         </tr>
         <tr>
-            <th><fmt:message key="issue.assignee"/></th>
+            <th><label for="issue-assignee"><fmt:message key="issue.assignee"/></label></th>
             <td>
-                <select name="assignee">
+                <select id="issue-assignee" name="assignee">
                     <option value="-2" title="<fmt:message key="placeholder.auto-assignee.tooltip"/>"><fmt:message key="placeholder.auto-assignee"/></option>
                     <option value="-1"
                             <c:if test="${issue.id ge 0 and empty issue.assignee}">selected</c:if>
@@ -120,7 +120,7 @@
         </tr>
         <c:if test="${issue.project.id ge 0}">
         <tr>
-            <th class="vtop"><fmt:message key="issue.affected-versions"/></th>
+            <th class="vtop"><label for="issue-affected"><fmt:message key="issue.affected-versions"/></label></th>
             <td>
                 <c:set var="fieldname" value="affected"/>
                 <c:set var="selectionList" value="${viewmodel.versionsRecent}"/>
@@ -129,7 +129,7 @@
             </td>
         </tr>
         <tr>
-            <th class="vtop"><fmt:message key="issue.resolved-versions"/></th>
+            <th class="vtop"><label for="issue-resolved"><fmt:message key="issue.resolved-versions"/></label></th>
             <td>
                 <c:set var="fieldname" value="resolved"/>
                 <c:set var="selectionList" value="${viewmodel.versionsUpcoming}"/>
@@ -139,9 +139,15 @@
         </tr>
         </c:if>
         <tr>
-            <th><fmt:message key="issue.eta"/></th>
-            <td><input name="eta" type="date" value="<fmt:formatDate value="${issue.eta}" pattern="YYYY-MM-dd" />" /> </td>
+            <th><label for="issue-eta"><fmt:message key="issue.eta"/></label></th>
+            <td><input id="issue-eta" name="eta" type="date" value="<fmt:formatDate value="${issue.eta}" pattern="YYYY-MM-dd" />" /> </td>
         </tr>
+        <c:if test="${issue.id ge 0}">
+        <tr>
+            <th class="vtop"><label for="issue-comment"><fmt:message key="issue.comment"/></label> </th>
+            <td><textarea id="issue-comment" rows="3" name="comment"></textarea></td>
+        </tr>
+        </c:if>
         </tbody>
         <tfoot>
         <tr>
--- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Mon Aug 09 16:22:56 2021 +0200
@@ -158,7 +158,7 @@
     <table class="formtable fullwidth">
         <tbody>
             <tr>
-                <td><textarea rows="5" name="comment" required></textarea></td>
+                <td><textarea rows="3" name="comment" required></textarea></td>
             </tr>
         </tbody>
         <tfoot>
--- a/src/main/webapp/WEB-INF/jspf/version-list.jspf	Mon Aug 09 15:50:37 2021 +0200
+++ b/src/main/webapp/WEB-INF/jspf/version-list.jspf	Mon Aug 09 16:22:56 2021 +0200
@@ -1,6 +1,6 @@
 <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
 
-<select name="${fieldname}" multiple>
+<select id="issue-${fieldname}" name="${fieldname}" multiple>
     <c:forEach var="vselitem" items="${selectionList}">
         <option value="${vselitem.id}"
                 <c:forEach var="v" items="${data}">

mercurial