Mon, 04 Jan 2021 17:30:10 +0100
automatically select version/component when creating new issues under active filters
--- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Mon Jan 04 15:34:41 2021 +0100 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java Mon Jan 04 17:30:10 2021 +0100 @@ -549,8 +549,8 @@ } setAttributeFromParameter(req, "more"); - setAttributeFromParameter(req, "component"); - setAttributeFromParameter(req, "version"); + setAttributeFromParameter(req, "cid"); + setAttributeFromParameter(req, "vid"); final var issue = new Issue(-1, projectInfo.getProject(), null); issue.setProject(projectInfo.getProject());
--- a/src/main/java/de/uapcore/lightpit/viewmodel/ProjectView.java Mon Jan 04 15:34:41 2021 +0100 +++ b/src/main/java/de/uapcore/lightpit/viewmodel/ProjectView.java Mon Jan 04 17:30:10 2021 +0100 @@ -73,14 +73,6 @@ return projectInfo != null; } - public boolean isVersionFilterValid() { - return projectInfo != null && versionFilter != null; - } - - public boolean isComponentFilterValid() { - return projectInfo != null && componentFilter != null; - } - public boolean isEveryFilterValid() { return projectInfo != null && versionFilter != null && componentFilter != null; }
--- a/src/main/webapp/WEB-INF/jsp/issue-form.jsp Mon Jan 04 15:34:41 2021 +0100 +++ b/src/main/webapp/WEB-INF/jsp/issue-form.jsp Mon Jan 04 17:30:10 2021 +0100 @@ -87,6 +87,7 @@ <c:forEach var="component" items="${viewmodel.components}"> <option <c:if test="${not empty issue.component and component eq issue.component}">selected</c:if> + <c:if test="${empty issue.component and component.id eq cid}">selected</c:if> value="${component.id}"><c:out value="${component.name}"/></option> </c:forEach> </select>
--- a/src/main/webapp/WEB-INF/jsp/project-details.jsp Mon Jan 04 15:34:41 2021 +0100 +++ b/src/main/webapp/WEB-INF/jsp/project-details.jsp Mon Jan 04 17:30:10 2021 +0100 @@ -27,6 +27,7 @@ <%@page pageEncoding="UTF-8" import="de.uapcore.lightpit.viewmodel.ProjectView" %> <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> +<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <jsp:useBean id="viewmodel" type="de.uapcore.lightpit.viewmodel.ProjectDetailsView" scope="request" /> @@ -35,7 +36,17 @@ <%@include file="../jspf/project-header.jspf"%> <div id="tool-area"> - <a href="./projects/${project.node}/create-issue" class="button"><fmt:message key="button.issue.create"/></a> + <c:remove var="createIssueParams"/> + <c:if test="${viewmodel.versionFilter.id gt 0}"> + <c:set var="createIssueParams">&vid=${viewmodel.versionFilter.id}</c:set> + </c:if> + <c:if test="${viewmodel.componentFilter.id gt 0}"> + <c:set var="createIssueParams">${createIssueParams}&cid=${viewmodel.componentFilter.id}</c:set> + </c:if> + <c:if test="${not empty createIssueParams}"> + <c:set var="createIssueParams">?${fn:substringAfter(createIssueParams, "&")}</c:set> + </c:if> + <a href="./projects/${project.node}/create-issue${createIssueParams}" class="button"><fmt:message key="button.issue.create"/></a> <c:if test="${viewmodel.versionFilter.id gt 0}"> <a href="./projects/${project.node}/versions/${viewmodel.versionFilter.node}/edit" class="button"><fmt:message key="button.version.edit"/></a> </c:if>
--- a/src/main/webapp/WEB-INF/jspf/version-list.jspf Mon Jan 04 15:34:41 2021 +0100 +++ b/src/main/webapp/WEB-INF/jspf/version-list.jspf Mon Jan 04 17:30:10 2021 +0100 @@ -6,6 +6,7 @@ <c:forEach var="v" items="${data}"> <c:if test="${v eq vselitem}">selected</c:if> </c:forEach> + <c:if test="${vid eq vselitem.id}">selected</c:if> > <c:out value="${vselitem.name}" /> </option>