dschadow/ApplicationIntrusionDetection

View on GitHub
duke-encounters/src/main/resources/templates/encounters.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="partials :: head"></head>
<body>

<div class="container" id="main">
    <nav class="navbar-inverse navbar-default navbar-fixed-top">
        <div class="container">
            <div th:replace="partials :: navbar-header"></div>

            <div class="collapse navbar-collapse" id="mainNavigation">
                <ul class="nav navbar-nav">
                    <li class="active"><a th:href="@{/encounters}">Encounters</a></li>
                    <li><a th:href="@{/search}">Search</a></li>
                </ul>

                <form th:replace="partials :: navbar-search-form"></form>

                <ul th:replace="partials :: navbar-menu"></ul>
            </div>
        </div>
    </nav>

    <div class="row" id="welcome">
        <div class="col-12">
            <h1>Encounters</h1>

            <p class="lead" th:if="${#httpServletRequest.remoteUser}">Encounter not listed yet? <a
                    th:href="@{/encounter/create}">Create</a> a new one.</p>

            <p class="lead" th:if="${#httpServletRequest.remoteUser == null}">Event and confirmation details are only
                visible after <a th:href="@{/login}">login</a>.</p>
        </div>
    </div>

    <div class="row" id="operationResults">
        <div class="col-12">
            <p th:if="${encounterFailure}" class="alert alert-danger">The requested encounter does not exist</p>
        </div>
    </div>

    <div class="row" id="encounters">
        <div class="col-12">
            <p class="lead" th:if="${searchFilter != null}">Your search for <strong th:text="${searchFilter}"></strong>
                returned the following results:</p>

            <div class="row">
                <div class="col-md-12">
                    <table class="table">
                        <thead>
                        <tr>
                            <th>Event</th>
                            <th>Location</th>
                            <th>Date</th>
                            <th>Confirmed by</th>
                            <th>Likelihood</th>
                            <th th:if="${confirmable}">Confirm</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="encounter : ${encounters}">
                            <td th:if="${#httpServletRequest.remoteUser}"><a th:href="@{|/encounter/${encounter.id}|}"
                                                                             th:text="${encounter.event}"></a></td>
                            <td th:if="${#httpServletRequest.remoteUser == null}" th:text="${encounter.event}"></td>
                            <td th:text="${encounter.location} + ' ('+ ${encounter.country} + ')'"></td>
                            <td th:text="${#calendars.format(encounter.date,'MM/dd/yyyy')}"></td>
                            <td>
                        <span th:each="confirmation,iterStat : ${encounter.confirmations}">
                            <span th:text="${confirmation.user.firstname} + ' ' + ${confirmation.user.lastname}"></span>
                            <span th:text="${!iterStat.last}? '|'"></span>
                        </span>
                            </td>
                            <td th:text="${encounter.likelihood}"></td>
                            <td th:if="${confirmable}">
                                <form th:action="@{/confirmation/add}" method="post">
                                    <input type="hidden" th:value="${encounter.id}" th:name="encounterId"/>
                                    <button type="submit" class="btn btn-default btn-sm" aria-label="Confirm Encounter">
                                        <span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span>
                                    </button>
                                </form>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<footer th:include="partials :: footer"></footer>

<div th:replace="partials :: scripts"></div>
</body>
</html>