|
@@ -1,60 +1,111 @@
|
|
<#import "parts/common.ftl" as common>
|
|
<#import "parts/common.ftl" as common>
|
|
-<#import "parts/login.ftl" as login>
|
|
|
|
|
|
|
|
<@common.page>
|
|
<@common.page>
|
|
- <h1>Sweater</h1>
|
|
|
|
- <nav>
|
|
|
|
- <a href="/user">Users</a>
|
|
|
|
- </nav>
|
|
|
|
- <@login.logout />
|
|
|
|
- <form method="post" enctype="multipart/form-data">
|
|
|
|
- <label for="message_text">Message text:</label>
|
|
|
|
- <input id="message_text" type="text" required name="text" />
|
|
|
|
- <label for="message_tag">Tag:</label>
|
|
|
|
- <input id="message_tag" type="text" name="tag" required />
|
|
|
|
- <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
|
|
|
|
- <input type="file" name="file" />
|
|
|
|
- <button type="submit">Send</button>
|
|
|
|
- </form>
|
|
|
|
- <h2>Messages</h2>
|
|
|
|
- <#if tag?has_content>
|
|
|
|
- <p>by tag <strong>${tag}</strong></p>
|
|
|
|
- </#if>
|
|
|
|
- <#if search?has_content>
|
|
|
|
- <p>that starts with <strong>${search}</strong></p>
|
|
|
|
- </#if>
|
|
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ <h2>Messages</h2>
|
|
|
|
+ <#if tag?has_content>
|
|
|
|
+ <p>by tag <strong>${tag}</strong></p>
|
|
|
|
+ </#if>
|
|
|
|
+ <#if search?has_content>
|
|
|
|
+ <p>that starts with <strong>${search}</strong></p>
|
|
|
|
+ </#if>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <form method="get" action="/feed">
|
|
|
|
- <label for="filter_tag">Tag:</label>
|
|
|
|
- <input type="text" id="filter_tag" placeholder="Tag" name="tag" value="${tag!}" />
|
|
|
|
- <button type="submit">Search</button>
|
|
|
|
- </form>
|
|
|
|
- <form method="get" action="/feed">
|
|
|
|
- <label for="search_tag">Search:</label>
|
|
|
|
- <input type="search" id="search_tag" placeholder="Text" value="${search!}" name="prefix" />
|
|
|
|
- <button type="submit">Search</button>
|
|
|
|
- </form>
|
|
|
|
- <ul>
|
|
|
|
- <#list messages as message>
|
|
|
|
- <li>
|
|
|
|
- <strong>${message.id}</strong>
|
|
|
|
- <p>${message.text}</p>
|
|
|
|
- <i>${message.tag}</i>
|
|
|
|
- <strong>${message.authorName}</strong>
|
|
|
|
- <#if message.filename??>
|
|
|
|
- <div>
|
|
|
|
- <img alt="Image" src="/img/${message.filename}" />
|
|
|
|
- </div>
|
|
|
|
- </#if>
|
|
|
|
|
|
+ <div class="d-inline-flex gap-1 mb-2">
|
|
|
|
+ <button
|
|
|
|
+ class="btn btn-primary"
|
|
|
|
+ type="button"
|
|
|
|
+ data-bs-toggle="collapse"
|
|
|
|
+ data-bs-target="#createMessage"
|
|
|
|
+ aria-expanded="false"
|
|
|
|
+ aria-controls="createMessage"
|
|
|
|
+ >
|
|
|
|
+ New sweat
|
|
|
|
+ </button>
|
|
|
|
+ <button
|
|
|
|
+ class="btn btn-secondary"
|
|
|
|
+ type="button"
|
|
|
|
+ data-bs-toggle="collapse"
|
|
|
|
+ data-bs-target="#searchForms"
|
|
|
|
+ aria-expanded="false"
|
|
|
|
+ aria-controls="searchForms"
|
|
|
|
+ >
|
|
|
|
+ Search
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
|
|
- <form action="/feed/delete" method="post">
|
|
|
|
- <input type="hidden" value="${message.id}" name="message" />
|
|
|
|
|
|
+ <div class="container mt-5 collapse" id="searchForms">
|
|
|
|
+ <div class="row justify-content-center">
|
|
|
|
+ <div class="col-md-6">
|
|
|
|
+ <form method="get" action="/feed">
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <label for="search_text">Search by Message Text</label>
|
|
|
|
+ <input type="search" id="search_text" class="form-control" placeholder="Enter message text" value="${search!}" name="prefix" />
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ <form method="get" action="/feed">
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <label for="filter_tag">Search by Tag</label>
|
|
|
|
+ <input type="text" class="form-control" id="filter_tag" name="tag" value="${tag!}" placeholder="Enter tag name">
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="container mt-5 collapse" id="createMessage">
|
|
|
|
+ <div class="row justify-content-center">
|
|
|
|
+ <div class="col-md-6">
|
|
|
|
+ <form method="post" enctype="multipart/form-data">
|
|
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
|
|
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
|
|
- <button type="submit">Remove</button>
|
|
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <label for="messageText">Message Text</label>
|
|
|
|
+ <input type="text" class="form-control" id="messageText" name="text" placeholder="Enter message text" required>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <label for="category">Category</label>
|
|
|
|
+ <input type="text" class="form-control" id="category" name="tag" placeholder="Enter category" required>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <label for="file">Attach File</label>
|
|
|
|
+ <input type="file" class="form-control" id="file" name="file">
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-group mb-3">
|
|
|
|
+ <button type="submit" class="btn btn-primary w-100">Sweat</button>
|
|
|
|
+ </div>
|
|
</form>
|
|
</form>
|
|
- </li>
|
|
|
|
- <#else>
|
|
|
|
- <li>Empty</li>
|
|
|
|
- </#list>
|
|
|
|
- </ul>
|
|
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="row">
|
|
|
|
+ <div class="col-12 col-sm-6">
|
|
|
|
+ <div class="vstack gap-3">
|
|
|
|
+ <#list messages as message>
|
|
|
|
+ <div class="card">
|
|
|
|
+ <#if message.filename??>
|
|
|
|
+ <img class="card-img-top" alt="Image" src="/img/${message.filename}" />
|
|
|
|
+ </#if>
|
|
|
|
+ <div class="card-body">
|
|
|
|
+ <h5 class="card-subtitle mb-2 text-body-secondary">${message.authorName}</h5>
|
|
|
|
+ <p class="card-text">${message.text}</p>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="card-footer">
|
|
|
|
+ <div class="d-flex justify-content-between align-items-center">
|
|
|
|
+ <div>${message.tag}</div>
|
|
|
|
+ <form action="/feed/delete" method="post">
|
|
|
|
+ <input type="hidden" value="${message.id}" name="message" />
|
|
|
|
+ <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
|
|
|
|
+ <button type="submit" class="btn btn-danger">Remove</button>
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <#else>
|
|
|
|
+ <div>Empty</div>
|
|
|
|
+ </#list>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
</@common.page>
|
|
</@common.page>
|