feat: implement page/post duplication, add event layout, auto-extract featured images, and include HTML escaping for templates.
This commit is contained in:
@@ -67,16 +67,23 @@
|
||||
<td th:text="${page.displayOrder}"></td>
|
||||
<td th:text="${page.lastModifiedDate != null} ? ${#dates.format(page.lastModifiedDateAsDate, 'yyyy-MM-dd HH:mm')} : '-'"></td>
|
||||
<td>
|
||||
<a th:href="@{/manage/pages/{id}/edit(id=${page.id})}" class="btn btn-sm btn-info" title="Edit">
|
||||
<a th:href="@{/manage/pages/{id}/edit(id=${page.id})}" class="btn btn-sm btn-info mb-1" title="Edit">
|
||||
<i class="fas fa-edit"></i> Edit
|
||||
</a>
|
||||
<form th:action="@{/manage/pages/{id}/delete(id=${page.id})}" method="post" style="display:inline;"
|
||||
onsubmit="return confirm('Are you sure you want to delete this page?');">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
|
||||
<button type="submit" class="btn btn-sm btn-danger" title="Delete">
|
||||
<button type="submit" class="btn btn-sm btn-danger mb-1" title="Delete">
|
||||
<i class="fas fa-trash"></i> Delete
|
||||
</button>
|
||||
</form>
|
||||
<form th:action="@{/manage/pages/{id}/duplicate(id=${page.id})}" method="post" style="display:inline;"
|
||||
onsubmit="return confirm('Are you sure you want to duplicate this page?');">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
|
||||
<button type="submit" class="btn btn-sm btn-secondary mb-1" title="Duplicate">
|
||||
<i class="fas fa-copy"></i> Duplicate
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(pages)}">
|
||||
|
||||
@@ -267,6 +267,14 @@
|
||||
</select>
|
||||
<small class="form-text text-muted">Controls the visual appearance on the frontend.</small>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3" id="eventTimeGroup" style="display: none;">
|
||||
<label for="postEventTime" class="font-weight-bold text-danger">
|
||||
<i class="far fa-calendar-alt"></i> Event Time
|
||||
</label>
|
||||
<input type="datetime-local" class="form-control" id="postEventTime" th:field="*{eventTimeLocal}">
|
||||
<small class="form-text text-muted">Specify the date and time for this event.</small>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-between">
|
||||
<a th:href="@{/manage/posts}" class="btn btn-secondary btn-sm">
|
||||
@@ -469,6 +477,19 @@
|
||||
slugPreview.textContent = slug || 'auto-generated';
|
||||
}
|
||||
});
|
||||
|
||||
// --- Event Time Layout Toggle ---
|
||||
var layoutSelect = document.getElementById('postLayout');
|
||||
var eventTimeGroup = document.getElementById('eventTimeGroup');
|
||||
function toggleEventTime() {
|
||||
if (layoutSelect.value === 'EVENT') {
|
||||
eventTimeGroup.style.display = 'block';
|
||||
} else {
|
||||
eventTimeGroup.style.display = 'none';
|
||||
}
|
||||
}
|
||||
layoutSelect.addEventListener('change', toggleEventTime);
|
||||
toggleEventTime(); // Initial check
|
||||
});
|
||||
|
||||
// --- Tag click-to-add helper ---
|
||||
|
||||
@@ -130,10 +130,17 @@
|
||||
<form th:action="@{/manage/posts/{id}/delete(id=${post.id})}" method="post" style="display:inline;"
|
||||
onsubmit="return confirm('Are you sure you want to delete this post?');">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete">
|
||||
<button type="submit" class="btn btn-sm btn-outline-danger mr-1" title="Delete">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
<form th:action="@{/manage/posts/{id}/duplicate(id=${post.id})}" method="post" style="display:inline;"
|
||||
onsubmit="return confirm('Are you sure you want to duplicate this post?');">
|
||||
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}" />
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary" title="Duplicate">
|
||||
<i class="fas fa-copy"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr th:if="${#lists.isEmpty(posts)}">
|
||||
|
||||
Reference in New Issue
Block a user