소스 검색

Add comment moderation in admin

master
nano 6 일 전
부모
커밋
14f4836216
1개의 변경된 파일88개의 추가작업 그리고 0개의 파일을 삭제
  1. +88
    -0
      app/views/Admin/comments.asp

+ 88
- 0
app/views/Admin/comments.asp 파일 보기

@@ -0,0 +1,88 @@
<div class="d-flex align-items-center justify-content-between mb-4">
<div>
<h1 class="h3 mb-1">Manage Comments</h1>
<p class="text-muted mb-0">Approve comments before they appear on posts.</p>
</div>
<a class="btn btn-outline-secondary" href="<%= AdminUrl() %>">&larr; Back to dashboard</a>
</div>

<% If comments.Count = 0 Then %>
<div class="alert alert-secondary">No comments yet.</div>
<% Else %>
<div class="table-responsive">
<table class="table table-hover align-middle">
<thead class="table-light">
<tr>
<th>Comment</th>
<th>Post</th>
<th>Status</th>
<th>Created</th>
<th class="text-end">Actions</th>
</tr>
</thead>
<tbody>
<%
Dim adminCommentIter, adminCommentItem, adminCommentPost, adminCommentPostTitle, adminCommentPostUrl
Set adminCommentIter = comments.Iterator()
Do While adminCommentIter.HasNext
Set adminCommentItem = adminCommentIter.GetNext()
adminCommentPostTitle = "Post #" & CStr(adminCommentItem.PostID)
adminCommentPostUrl = ""
Set adminCommentPost = Nothing

On Error Resume Next
Set adminCommentPost = PostsRepository().FindByID(adminCommentItem.PostID)
If Err.Number = 0 Then
adminCommentPostTitle = adminCommentPost.Title
adminCommentPostUrl = PostUrl(adminCommentPost.Slug)
End If
Err.Clear
On Error GoTo 0
%>
<tr>
<td style="min-width: 320px;">
<strong><%= H(adminCommentItem.AuthorName) %></strong>
<% If Len(Trim(CStr(adminCommentItem.AuthorEmail))) > 0 Then %>
<div class="small text-muted"><%= H(adminCommentItem.AuthorEmail) %></div>
<% End If %>
<div class="mt-2"><%= H(adminCommentItem.Body) %></div>
</td>
<td class="text-nowrap">
<% If Len(adminCommentPostUrl) > 0 Then %>
<a href="<%= adminCommentPostUrl %>"><%= H(adminCommentPostTitle) %></a>
<% Else %>
<%= H(adminCommentPostTitle) %>
<% End If %>
</td>
<td class="text-nowrap">
<% If adminCommentItem.IsApproved = 1 Then %>
<span class="badge bg-success">Approved</span>
<% Else %>
<span class="badge bg-secondary">Pending</span>
<% End If %>
</td>
<td class="small text-muted text-nowrap">
<%= H(FormatDateTime(adminCommentItem.CreatedDate, vbShortDate)) %>
</td>
<td class="text-end text-nowrap">
<% If adminCommentItem.IsApproved = 1 Then %>
<form class="d-inline" method="post" action="<%= AdminCommentUnapproveUrl(adminCommentItem.CommentID) %>">
<button class="btn btn-sm btn-outline-warning" type="submit">Unapprove</button>
</form>
<% Else %>
<form class="d-inline" method="post" action="<%= AdminCommentApproveUrl(adminCommentItem.CommentID) %>">
<button class="btn btn-sm btn-success" type="submit">Approve</button>
</form>
<% End If %>
<form class="d-inline" method="post" action="<%= AdminCommentDeleteUrl(adminCommentItem.CommentID) %>">
<button class="btn btn-sm btn-outline-danger" type="submit" onclick="return confirm('Delete this comment?')">Delete</button>
</form>
</td>
</tr>
<%
Loop
%>
</tbody>
</table>
</div>
<% End If %>

불러오는 중...
취소
저장

Powered by TurnKey Linux.