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

Mon, 02 Aug 2021 17:04:17 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 02 Aug 2021 17:04:17 +0200
changeset 207
479dd7993ef9
parent 184
e8eecee6aadf
child 212
c50da26a6d31
permissions
-rw-r--r--

#22 adds possibility to edit own comments

<%--
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" %>

<jsp:useBean id="viewmodel" type="de.uapcore.lightpit.viewmodel.IssueDetailView" scope="request"/>

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

<c:set var="issuesHref" scope="page" value="./projects/${project.node}/issues/${empty version ? '-' : version.node }/${empty component ? '-' : component.node}/"/>

<table class="formtable fullwidth">
    <colgroup>
        <col>
        <col style="width: 100%">
    </colgroup>
    <tbody>
    <c:if test="${viewmodel.issue.id ge 0}">
    <tr>
        <th><fmt:message key="issue.id"/></th>
        <td>${issue.id}</td>
    </tr>
    </c:if>
    <tr>
        <th><fmt:message key="project"/></th>
        <td>
            <c:out value="${issue.project.name}" />
        </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>
    </tr>
    <tr>
        <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="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}" style="width: auto">
                <fmt:message key="issue.category.${issue.category}" />
            </div>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.status"/></th>
        <td>
            <div class="issue-tag phase-${issue.status.phase.number}" style="width: auto">
                <fmt:message key="issue.status.${issue.status}" />
            </div>
        </td>
    </tr>
    <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:out value="${issue.assignee.displayname}"/>
            </c:if>
            <c:if test="${empty issue.assignee}">
                <fmt:message key="placeholder.null-assignee" />
            </c:if>
        </td>
    </tr>
    <tr>
        <th class="vtop"><fmt:message key="issue.affected-versions"/></th>
        <td>
            <c:forEach var="version" items="${issue.affectedVersions}">
                <c:out value="${version.name}"/>
            </c:forEach>
        </td>
    </tr>
    <tr>
        <th class="vtop"><fmt:message key="issue.resolved-versions"/></th>
        <td>
            <c:forEach var="version" items="${issue.resolvedVersions}">
                <c:out value="${version.name}"/>
            </c:forEach>
        </td>
    </tr>
    <tr>
        <th><fmt:message key="issue.eta"/></th>
        <td><fmt:formatDate value="${issue.eta}" /></td>
    </tr>
    </tbody>
    <tfoot>
    <tr>
        <td colspan="2">
            <a href="${issuesHref}" class="button">
                <fmt:message key="button.cancel"/>
            </a>
            <a href="${issuesHref}${issue.id}/edit" class="button submit">
                <fmt:message key="button.issue.edit"/>
            </a>
        </td>
    </tr>
    </tfoot>
</table>

<hr class="comments-separator"/>
<h2><fmt:message key="issue.comments"/></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="5" 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