forked from OrchardCMS/Orchard
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIndex.cshtml
More file actions
106 lines (103 loc) · 5.65 KB
/
Index.cshtml
File metadata and controls
106 lines (103 loc) · 5.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@model CommentsIndexViewModel
@using Orchard.Comments.Models
@using Orchard.Comments.ViewModels;
@using Orchard.Mvc.Html;
@using Orchard.Utility.Extensions
@{
Style.Require("Admin");
Script.Require("ShapesBase");
Layout.Title = T("Comments").ToString();
}
@using(Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
<select id="publishActions" name="@Html.NameOf(m => m.Options.BulkAction)">
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.None, T("Choose action...").ToString())
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Approve, T("Approve").ToString())
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Unapprove, T("Unapprove").ToString())
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Delete, T("Delete").ToString())
</select>
<button type="submit" name="submit.BulkEdit" value="@T("Apply")">@T("Apply")</button>
</fieldset>
<fieldset class="bulk-actions">
<label for="filterResults">@T("Filter:")</label>
<select id="filterResults" name="@Html.NameOf(m => m.Options.Filter)">
@Html.SelectOption(Model.Options.Filter, CommentIndexFilter.All, T("All Comments").ToString())
@Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Approved, T("Approved Comments").ToString())
@Html.SelectOption(Model.Options.Filter, CommentIndexFilter.Pending, T("Pending Comments").ToString())
</select>
<button type="submit" name="submit.Filter" value="@T("Apply")">@T("Apply")</button>
</fieldset>
<fieldset>
<table class="items" summary="@T("This is a table of the comments in your application")">
<colgroup>
<col id="Col1" />
<col id="Col2" />
<col id="Col3" />
<col id="Col4" />
<col id="Col5" />
<col id="Col6" />
</colgroup>
<thead>
<tr>
<th scope="col"><input type="checkbox" class="check-all"/></th>
<th scope="col">@T("Status")</th>
<th scope="col">@T("Author")</th>
<th scope="col">@T("Comment")</th>
<th scope="col">@T("Commented On")</th>
<th scope="col">@T("Actions")</th>
</tr>
</thead>
@{var commentIndex = 0;}
@foreach (var commentEntry in Model.Comments) {
var commentClass = "";
if (!HasText(commentEntry.Comment.UserName)) {
commentClass = "anonymous";
}
<tr itemscope="itemscope" itemid="@Model.Comments[commentIndex].Comment.Id" itemtype="http://orchardproject.net/data/Comment" class="@commentClass">
<td>
<input type="hidden" value="@Model.Comments[commentIndex].Comment.Id" name="@Html.NameOf(m => m.Comments[commentIndex].Comment.Id)"/>
<input type="checkbox" value="true" name="@Html.NameOf(m => m.Comments[commentIndex].IsChecked)"/>
</td>
<td>
@if (commentEntry.Comment.Status == CommentStatus.Pending) { @T("Pending") }
else { @T("Approved") }
</td>
<td>
<div>@commentEntry.Comment.Author</div>
@if (HasText(commentEntry.Comment.UserName) && commentEntry.Comment.Author != commentEntry.Comment.UserName) {
<div class="authenticated-commenter-id">@commentEntry.Comment.UserName</div>
}
</td>
<td>
@* would ideally have permalinks for individual comments *@
<p><a href="@Url.ItemDisplayUrl(commentEntry.CommentedOn)#comments"><time>@Display.DateTime(DateTimeUtc: commentEntry.Comment.CommentDateUtc.GetValueOrDefault())</time></a></p>
@if (commentEntry.Comment.CommentText != null) {
var ellipsized = Html.Ellipsize(commentEntry.Comment.CommentText, 500);
var paragraphed = new HtmlString(ellipsized.ToHtmlString().Replace("\r\n", "</p><p>"));
<p>@paragraphed</p>
}
else {
@T("[Empty]")
}
</td>
<td>@Html.ItemDisplayLink(commentEntry.CommentedOn)</td>
<td>
<div class="actions">
@if (commentEntry.Comment.Status != CommentStatus.Approved) {
<a href="@Url.Action("Approve", new {commentEntry.Comment.Id, returnUrl = Request.RawUrl})" itemprop="ApproveUrl UnsafeUrl">@T("Approve")</a>@T(" | ")
}
else {
<a href="@Url.Action("Unapprove", new {commentEntry.Comment.Id, returnUrl = Request.RawUrl})" itemprop="UnapproveUrl UnsafeUrl">@T("Unapprove")</a>@T(" | ")
}
<a href="@Url.Action("Edit", new {commentEntry.Comment.Id})" title="@T("Edit")">@T("Edit")</a>@T(" | ")
<a href="@Url.Action("Delete", new {commentEntry.Comment.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.RawUrl})" itemprop="RemoveUrl UnsafeUrl">@T("Delete")</a>
</div>
</td> </tr>
commentIndex = commentIndex + 1;
}
</table>
@Display(Model.Pager)
</fieldset>
}