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

Mon, 05 Aug 2024 19:44:16 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 05 Aug 2024 19:44:16 +0200
changeset 314
8a8b1c5d168b
parent 311
bf67e0ff7131
child 329
fa7696bafe0d
permissions
-rw-r--r--

more filters are now automatically shown when one is in use

fixes #406

<%--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright 2021 Mike Becker. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--%>
<%@page pageEncoding="UTF-8" %>
<%@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.IssueDetailView" scope="request"/>

<c:set var="project" scope="page" value="${viewmodel.issue.project}"/>
<c:set var="issue" scope="page" value="${viewmodel.issue}" />

<c:set var="issuesHref" value="./issues/"/>
<c:if test="${not empty viewmodel.pathInfos}">
    <c:set var="issuesHref" value="./${viewmodel.pathInfos.issuesHref}"/>
</c:if>

<table class="issue-view fullwidth">
    <colgroup>
        <col>
        <col style="width: 50%">
        <col>
        <col style="width: 50%">
    </colgroup>
    <tbody>
    <tr>
        <th><fmt:message key="issue.id"/></th>
        <td>${issue.id}</td>
        <td colspan="2"></td>
    </tr>
    <tr>
        <th><fmt:message key="issue.created"/></th>
        <td>
            <c:set var="dateValue" value="${issue.created}"/>
            <%@include file="../jspf/date-with-tooltip.jspf"%>
        </td>
        <th><fmt:message key="issue.updated"/></th>
        <td>
            <c:set var="dateValue" value="${issue.updated}"/>
            <%@include file="../jspf/date-with-tooltip.jspf"%>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="project"/></th>
        <td>
            <c:out value="${issue.project.name}" />
        </td>
        <th><fmt:message key="component"/></th>
        <td>
            <c:if test="${not empty issue.component}">
                <c:out value="${issue.component.name}"/>
            </c:if>
            <c:if test="${empty issue.component}">
                <fmt:message key="placeholder.null-component"/>
            </c:if>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.category"/></th>
        <td>
            <div class="issue-tag ${issue.category}">
                <fmt:message key="issue.category.${issue.category}" />
            </div>
        </td>
        <th><fmt:message key="issue.status"/></th>
        <td>
            <div class="issue-tag phase-${issue.status.phase.number}">
                <fmt:message key="issue.status.${issue.status}" />
            </div>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.resolved-versions"/></th>
        <td>
            <c:out value="${issue.resolved.name}"/>
        </td>
        <th><fmt:message key="issue.affected-versions"/></th>
        <td>
            <c:out value="${issue.affected.name}"/>
        </td>
    </tr>
    </tbody>
</table>
<table class="issue-view fullwidth">
    <colgroup>
        <col>
        <col style="width: 100%">
    </colgroup>
    <tbody>
    <tr>
        <th><fmt:message key="issue.subject"/></th>
        <td><c:out value="${issue.subject}"/></td>
    </tr>
    <tr>
        <th class="vtop"><fmt:message key="issue.description"/></th>
        <td>
            <div class="markdown-styled">
            ${issue.description}
            </div>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.assignee"/></th>
        <td>
            <c:if test="${not empty issue.assignee}">
                <c:if test="${not empty issue.assignee.mail}">
                <a href="mailto:<c:out value="${issue.assignee.mail}"/>">
                    <c:out value="${issue.assignee.displayname}"/>
                </a>
                </c:if>
                <c:if test="${empty issue.assignee.mail}">
                <c:out value="${issue.assignee.displayname}"/>
                </c:if>
            </c:if>
            <c:if test="${empty issue.assignee}">
                <fmt:message key="placeholder.null-assignee" />
            </c:if>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.eta"/></th>
        <td><fmt:formatDate value="${issue.eta}" /></td>
    </tr>
    </tbody>
</table>
<div class="hright">
    <a href="${issuesHref}" class="button">
        <fmt:message key="button.back"/>
    </a>
    <a href="${issuesHref}${issue.id}/edit" class="button submit">
        <fmt:message key="button.issue.edit"/>
    </a>
</div>

<hr class="issue-view-separator"/>

<c:if test="${not empty viewmodel.commitLinks}">
    <h2><fmt:message key="issue.commits" /></h2>
    <table class="issue-view fullwidth">
        <colgroup>
            <col>
            <col class="fullwidth">
        </colgroup>
        <thead>
        <tr>
            <th><fmt:message key="issue.commits.hash"/></th>
            <th><fmt:message key="issue.commits.message"/></th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="commitLink" items="${viewmodel.commitLinks}">
        <tr>
            <td><a href="${commitLink.url}" target="_blank">${commitLink.hash}</a></td>
            <td><c:out value="${commitLink.message}"/> </td>
        </tr>
        </c:forEach>
        </tbody>
    </table>
</c:if>

<h2>
    <fmt:message key="issue.relations"/>
</h2>
<form id="relation-form" action="${issuesHref}${issue.id}/relation" method="post">
<c:if test="${not empty viewmodel.relationError}">
    <div class="error-box">
        <fmt:message key="${viewmodel.relationError}"/>
    </div>
</c:if>
<table class="issue-view relation-editor fullwidth">
    <colgroup>
        <col>
        <col>
        <col class="fullwidth">
    </colgroup>
    <thead>
    <tr>
        <th></th>
        <th><fmt:message key="issue.relations.type"/></th>
        <th><fmt:message key="issue.relations.issue"/></th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td>
            <button type="submit"><fmt:message key="button.add"/></button>
        </td>
        <td>
            <select name="type">
                <c:forEach var="type" items="${viewmodel.relationTypes}">
                    <option value="${type}"><fmt:message key="issue.relations.type.${type}"/></option>
                    <c:if test="${not type.bidi}">
                    <option value="!${type}"><fmt:message key="issue.relations.type.${type}.rev"/></option>
                    </c:if>
                </c:forEach>
            </select>
        </td>
        <td>
            <input name="issue" list="linkable-issues" autocomplete="off">
            <datalist id="linkable-issues">
                <c:forEach var="linkableIssue" items="${viewmodel.linkableIssues}">
                    <option value="#${linkableIssue.id} - <c:out value="${linkableIssue.subject}"/> (<fmt:message key="issue.category.${linkableIssue.category}" />)"></option>
                </c:forEach>
            </datalist>
        </td>
    </tr>
    <c:forEach var="relation" items="${viewmodel.currentRelations}">
        <tr>
            <td>
                <a href="${issuesHref}${issue.id}/removeRelation?to=${relation.to.id}&type=${relation.type}&reverse=${relation.reverse}" class="button submit">
                    <fmt:message key="button.remove"/>
                </a>
            </td>
            <td><fmt:message key="issue.relations.type.${relation.type}${relation.reverse?'.rev':''}"/></td>
            <td>
                <a href="${issuesHref}${relation.to.id}">
                    #${relation.to.id} - <c:out value="${relation.to.subject}"/>
                </a>
                <div style="display: inline-block; width: .25em"></div>
                <div class="issue-tag ${relation.to.category}">
                    <fmt:message key="issue.category.${relation.to.category}" />
                </div>
                <div class="issue-tag phase-${relation.to.status.phase.number}">
                    <fmt:message key="issue.status.${relation.to.status}" />
                </div>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</form>

<hr class="issue-view-separator"/>
<h2>
    <fmt:message key="issue.comments"/>
    <c:if test="${not empty viewmodel.comments}">
        (${fn:length(viewmodel.comments)})
    </c:if>
</h2>
<c:if test="${viewmodel.issue.id ge 0}">
<form id="comment-form" action="${issuesHref}${issue.id}/comment" method="post">
    <table class="formtable fullwidth">
        <tbody>
            <tr>
                <td><textarea rows="3" name="comment" required></textarea></td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td>
                    <button type="submit"><fmt:message key="button.comment"/></button>
                </td>
            </tr>
        </tfoot>
    </table>
</form>
    <c:forEach var="comment" items="${viewmodel.comments}">
        <div class="comment">
            <div class="comment-author">
                <c:if test="${not empty comment.author}">
                    <c:if test="${not empty comment.author.mail}">
                        <a class="comment-author-name" href="mailto:${comment.author.mail}">
                    </c:if>
                    <c:out value="${comment.author.displayname}"/>
                    <c:if test="${not empty comment.author.mail}">
                        </a>
                    </c:if>
                    <c:if test="${comment.author.username eq pageContext.request.remoteUser}">
                        <a class="comment-edit-icon" onclick="showCommentEditor(${comment.id})">&#x270e;</a>
                    </c:if>
                </c:if>
                <c:if test="${empty comment.author}">
                    <fmt:message key="issue.comments.anonauthor"/>
                </c:if>
            </div>
            <div class="smalltext">
                <fmt:formatDate type="BOTH" value="${comment.created}" />
                <c:if test="${comment.updateCount gt 0}">
                <span class="comment-edit-info">
                    (<fmt:message key="issue.comments.lastupdate"/> <fmt:formatDate type="BOTH" value="${comment.updated}" />, ${comment.updateCount} <fmt:message key="issue.comments.updateCount"/>)
                </span>
                </c:if>
            </div>
            <div id="comment-view-${comment.id}" class="medskip markdown-styled">
                ${comment.commentFormatted}
            </div>
            <div id="comment-editor-${comment.id}" style="display: none">
                <form id="comment-form-${comment.id}" action="${issuesHref}${issue.id}/comment" method="post">
                    <input type="hidden" name="commentid" value="${comment.id}">
                    <table class="formtable fullwidth">
                        <tbody>
                        <tr>
                            <td>
                                <textarea rows="5" name="comment" required><c:out value="${comment.comment}"/></textarea>
                            </td>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr>
                            <td>
                                <button type="submit"><fmt:message key="button.comment.edit"/></button>
                            </td>
                        </tr>
                        </tfoot>
                    </table>
                </form>
            </div>
        </div>
    </c:forEach>
</c:if>

mercurial