src/main/webapp/WEB-INF/jsp/issue-form.jsp

changeset 86
0a658e53177c
parent 85
3d16ad54b3dc
child 88
1438e5a22c55
--- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Sat May 30 18:12:38 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp	Mon Jun 01 14:46:58 2020 +0200
@@ -28,12 +28,9 @@
 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
-<jsp:useBean id="projects" type="java.util.List<de.uapcore.lightpit.entities.Project>" scope="request" />
-<jsp:useBean id="versions" type="java.util.List<de.uapcore.lightpit.entities.Version>" scope="request" />
-<jsp:useBean id="issue" type="de.uapcore.lightpit.entities.Issue" scope="request"/>
-<jsp:useBean id="issueStatusEnum" type="de.uapcore.lightpit.entities.IssueStatus[]" scope="request"/>
-<jsp:useBean id="issueCategoryEnum" type="de.uapcore.lightpit.entities.IssueCategory[]" scope="request"/>
-<jsp:useBean id="users" type="java.util.List<de.uapcore.lightpit.entities.User>" scope="request"/>
+<jsp:useBean id="viewmodel" type="de.uapcore.lightpit.viewmodel.IssueEditView" scope="request"/>
+<c:set var="issue" scope="page" value="${viewmodel.issue}" />
+<c:set var="versions" value="${viewmodel.versions}" />
 
 <form action="./projects/issues/commit" method="post">
     <table class="formtable">
@@ -45,26 +42,28 @@
         <tr>
             <th><fmt:message key="issue.project"/></th>
             <td>
-                <c:if test="${issue.project.id ge 0}">
-                    <c:out value="${issue.project.name}" />
-                    <input type="hidden" name="pid" value="${issue.project.id}" />
-                </c:if>
-                <c:if test="${empty issue.project or issue.project.id lt 0}">
-                <select name="pid" required>
-                    <c:forEach var="project" items="${projects}">
-                        <option value="${project.id}">
-                            <c:out value="${project.name}" />
-                        </option>
-                    </c:forEach>
-                </select>
-                </c:if>
+                <c:choose>
+                    <c:when test="${not empty issue.project}">
+                        <c:out value="${issue.project.name}" />
+                        <input type="hidden" name="pid" value="${issue.project.id}" />
+                    </c:when>
+                    <c:otherwise>
+                        <select name="pid" required>
+                            <c:forEach var="project" items="${viewmodel.projects}">
+                                <option value="${project.id}">
+                                    <c:out value="${project.name}" />
+                                </option>
+                            </c:forEach>
+                        </select>
+                    </c:otherwise>
+                </c:choose>
             </td>
         </tr>
         <tr>
             <th><fmt:message key="issue.category"/></th>
             <td>
                 <select name="category">
-                    <c:forEach var="category" items="${issueCategoryEnum}">
+                    <c:forEach var="category" items="${viewmodel.issueCategory}">
                         <option
                                 <c:if test="${category eq issue.category}">selected</c:if>
                                 value="${category}">
@@ -78,7 +77,7 @@
             <th><fmt:message key="issue.status"/></th>
             <td>
                 <select name="status">
-                    <c:forEach var="status" items="${issueStatusEnum}">
+                    <c:forEach var="status" items="${viewmodel.issueStatus}">
                         <option
                                 <c:if test="${status eq issue.status}">selected</c:if>
                                 value="${status}">
@@ -95,7 +94,7 @@
         <tr>
             <th class="vtop"><fmt:message key="issue.description"/></th>
             <td>
-                <textarea name="description"><c:out value="${issue.description}"/></textarea>
+                <textarea name="description" rows="10"><c:out value="${issue.description}"/></textarea>
             </td>
         </tr>
         <tr>
@@ -103,7 +102,7 @@
             <td>
                 <select name="assignee">
                     <option value="-1"><fmt:message key="placeholder.null-assignee"/></option>
-                    <c:forEach var="user" items="${users}">
+                    <c:forEach var="user" items="${viewmodel.users}">
                         <option
                                 <c:if test="${not empty issue.assignee and user eq issue.assignee}">selected</c:if>
                                 value="${user.id}"><c:out value="${user.displayname}"/></option>
@@ -155,7 +154,7 @@
             <td colspan="2">
                 <input type="hidden" name="id" value="${issue.id}"/>
                 <c:choose>
-                    <c:when test="${not empty issue.project and issue.project.id ge 0}">
+                    <c:when test="${not empty issue.project}">
                         <c:set var="cancelUrl">./projects/issues/?pid=${issue.project.id}</c:set>
                     </c:when>
                     <c:otherwise>

mercurial