|
- <div class="d-flex align-items-center justify-content-between mb-4">
- <div>
- <h1 class="h3 mb-1">Manage Posts</h1>
- <p class="text-muted mb-0">All posts — publish, edit, or delete.</p>
- </div>
- <a class="btn btn-primary" href="<%= PostNewUrl() %>">New Post</a>
- </div>
-
- <% If posts.Count = 0 Then %>
- <div class="alert alert-secondary">No posts yet. <a href="<%= PostNewUrl() %>">Create the first one.</a></div>
- <% Else %>
- <div class="table-responsive">
- <table class="table table-hover align-middle">
- <thead class="table-light">
- <tr>
- <th>Title</th>
- <th>Status</th>
- <th>Created</th>
- <th class="text-end">Actions</th>
- </tr>
- </thead>
- <tbody>
- <%
- Dim adminPostIter, adminPostItem
- Set adminPostIter = posts.Iterator()
- Do While adminPostIter.HasNext
- Set adminPostItem = adminPostIter.GetNext()
- %>
- <tr>
- <td>
- <strong><%= H(adminPostItem.Title) %></strong>
- <% If Len(Trim(CStr(adminPostItem.Summary))) > 0 Then %>
- <div class="small text-muted"><%= H(adminPostItem.Summary) %></div>
- <% End If %>
- </td>
- <td class="text-nowrap">
- <% If adminPostItem.IsPublished = 1 Then %>
- <span class="badge bg-success">Published</span>
- <% Else %>
- <span class="badge bg-secondary">Draft</span>
- <% End If %>
- </td>
- <td class="small text-muted text-nowrap">
- <%= H(FormatDateTime(adminPostItem.CreatedDate, vbShortDate)) %>
- </td>
- <td class="text-end text-nowrap">
- <a class="btn btn-sm btn-outline-secondary" href="<%= PostEditUrl(adminPostItem.PostID) %>">Edit</a>
- <form class="d-inline" method="post" action="<%= AdminPostAIUrl(adminPostItem.PostID) %>">
- <button class="btn btn-sm btn-outline-info" type="submit">AI Content</button>
- </form>
- <% If adminPostItem.IsPublished = 1 Then %>
- <form class="d-inline" method="post" action="<%= AdminPostUnpublishUrl(adminPostItem.PostID) %>">
- <button class="btn btn-sm btn-outline-warning" type="submit">Unpublish</button>
- </form>
- <% Else %>
- <form class="d-inline" method="post" action="<%= AdminPostPublishUrl(adminPostItem.PostID) %>">
- <button class="btn btn-sm btn-success" type="submit">Publish</button>
- </form>
- <% End If %>
- <form class="d-inline" method="post" action="<%= PostDeleteUrl(adminPostItem.PostID) %>">
- <button class="btn btn-sm btn-outline-danger" type="submit" onclick="return confirm('Delete this post?')">Delete</button>
- </form>
- </td>
- </tr>
- <%
- Loop
- %>
- </tbody>
- </table>
- </div>
- <% End If %>
|