mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Updating the comment management UI.
- Rearranged the display and added action links. * haven't done anything with the item-specic comment view (Detail action) yet - it might not be necessary now especially since there is no path to it --HG-- branch : dev
This commit is contained in:
@@ -6,7 +6,6 @@ using System.Web.Mvc;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Orchard.Comments.Models;
|
using Orchard.Comments.Models;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Records;
|
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
@@ -64,7 +63,11 @@ namespace Orchard.Comments.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pagerShape = Shape.Pager(pager).TotalItemCount(comments.Count());
|
var pagerShape = Shape.Pager(pager).TotalItemCount(comments.Count());
|
||||||
var entries = comments.Slice(pager.GetStartIndex(), pager.PageSize).ToList().Select(comment => CreateCommentEntry(comment.Record));
|
var entries = comments
|
||||||
|
.OrderByDescending<CommentPartRecord, DateTime?>(cpr => cpr.CommentDateUtc)
|
||||||
|
.Slice(pager.GetStartIndex(), pager.PageSize)
|
||||||
|
.ToList()
|
||||||
|
.Select(comment => CreateCommentEntry(comment.Record));
|
||||||
|
|
||||||
var model = new CommentsIndexViewModel {
|
var model = new CommentsIndexViewModel {
|
||||||
Comments = entries.ToList(),
|
Comments = entries.ToList(),
|
||||||
@@ -98,12 +101,12 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.MarkCommentAsSpam(entry.Comment.Id);
|
_commentService.MarkCommentAsSpam(entry.Comment.Id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommentIndexBulkAction.Pend:
|
case CommentIndexBulkAction.Unapprove:
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
//TODO: Transaction
|
//TODO: Transaction
|
||||||
foreach (CommentEntry entry in checkedEntries) {
|
foreach (CommentEntry entry in checkedEntries) {
|
||||||
_commentService.PendComment(entry.Comment.Id);
|
_commentService.UnapproveComment(entry.Comment.Id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommentIndexBulkAction.Approve:
|
case CommentIndexBulkAction.Approve:
|
||||||
@@ -194,12 +197,12 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.MarkCommentAsSpam(entry.Comment.Id);
|
_commentService.MarkCommentAsSpam(entry.Comment.Id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommentDetailsBulkAction.Pend:
|
case CommentDetailsBulkAction.Unapprove:
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't moderate comment")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
foreach (CommentEntry entry in checkedEntries) {
|
foreach (CommentEntry entry in checkedEntries) {
|
||||||
_commentService.PendComment(entry.Comment.Id);
|
_commentService.UnapproveComment(entry.Comment.Id);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CommentDetailsBulkAction.Approve:
|
case CommentDetailsBulkAction.Approve:
|
||||||
@@ -308,6 +311,75 @@ namespace Orchard.Comments.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Approve(int id, string returnUrl) {
|
||||||
|
try {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't approve comment")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
int commentedOn = _commentService.GetComment(id).Record.CommentedOn;
|
||||||
|
_commentService.ApproveComment(id);
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Details", new { id = commentedOn });
|
||||||
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
|
Services.Notifier.Error(T("Approving comment failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult Unapprove(int id, string returnUrl) {
|
||||||
|
try {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't unapprove comment")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
int commentedOn = _commentService.GetComment(id).Record.CommentedOn;
|
||||||
|
_commentService.UnapproveComment(id);
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Details", new { id = commentedOn });
|
||||||
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
|
Services.Notifier.Error(T("Unapproving comment failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult MarkAsSpam(int id, string returnUrl) {
|
||||||
|
try {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't mark comment as spam")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
int commentedOn = _commentService.GetComment(id).Record.CommentedOn;
|
||||||
|
_commentService.MarkCommentAsSpam(id);
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Details", new { id = commentedOn });
|
||||||
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
|
Services.Notifier.Error(T("Marking comment as spam failed: " + exception.Message));
|
||||||
|
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||||
|
return Redirect(returnUrl);
|
||||||
|
}
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Delete(int id, string returnUrl) {
|
public ActionResult Delete(int id, string returnUrl) {
|
||||||
try {
|
try {
|
||||||
@@ -334,7 +406,7 @@ namespace Orchard.Comments.Controllers {
|
|||||||
private CommentEntry CreateCommentEntry(CommentPartRecord commentPart) {
|
private CommentEntry CreateCommentEntry(CommentPartRecord commentPart) {
|
||||||
return new CommentEntry {
|
return new CommentEntry {
|
||||||
Comment = commentPart,
|
Comment = commentPart,
|
||||||
CommentedOn = _commentService.GetDisplayForCommentedContent(commentPart.CommentedOn).DisplayText,
|
CommentedOn = _commentService.GetCommentedContent(commentPart.CommentedOn),
|
||||||
IsChecked = false,
|
IsChecked = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -110,6 +110,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
|
<Content Include="Styles\admin.css" />
|
||||||
<Content Include="Views\Admin\Details.cshtml" />
|
<Content Include="Views\Admin\Details.cshtml" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\Web.config" />
|
||||||
@@ -139,6 +140,7 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
@@ -65,6 +65,10 @@ namespace Orchard.Comments.Services {
|
|||||||
return _contentManager.GetItemMetadata(content);
|
return _contentManager.GetItemMetadata(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContentItem GetCommentedContent(int id) {
|
||||||
|
return _contentManager.Get(id);
|
||||||
|
}
|
||||||
|
|
||||||
public CommentPart CreateComment(CreateCommentContext context, bool moderateComments) {
|
public CommentPart CreateComment(CreateCommentContext context, bool moderateComments) {
|
||||||
var comment = _contentManager.Create<CommentPart>("Comment");
|
var comment = _contentManager.Create<CommentPart>("Comment");
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@ namespace Orchard.Comments.Services {
|
|||||||
commentPart.Record.Status = CommentStatus.Approved;
|
commentPart.Record.Status = CommentStatus.Approved;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PendComment(int commentId) {
|
public void UnapproveComment(int commentId) {
|
||||||
CommentPart commentPart = GetComment(commentId);
|
CommentPart commentPart = GetComment(commentId);
|
||||||
commentPart.Record.Status = CommentStatus.Pending;
|
commentPart.Record.Status = CommentStatus.Pending;
|
||||||
}
|
}
|
||||||
|
@@ -9,10 +9,11 @@ namespace Orchard.Comments.Services {
|
|||||||
IContentQuery<CommentPart, CommentPartRecord> GetCommentsForCommentedContent(int id, CommentStatus status);
|
IContentQuery<CommentPart, CommentPartRecord> GetCommentsForCommentedContent(int id, CommentStatus status);
|
||||||
CommentPart GetComment(int id);
|
CommentPart GetComment(int id);
|
||||||
ContentItemMetadata GetDisplayForCommentedContent(int id);
|
ContentItemMetadata GetDisplayForCommentedContent(int id);
|
||||||
|
ContentItem GetCommentedContent(int id);
|
||||||
CommentPart CreateComment(CreateCommentContext commentRecord, bool moderateComments);
|
CommentPart CreateComment(CreateCommentContext commentRecord, bool moderateComments);
|
||||||
void UpdateComment(int id, string name, string email, string siteName, string commentText, CommentStatus status);
|
void UpdateComment(int id, string name, string email, string siteName, string commentText, CommentStatus status);
|
||||||
void ApproveComment(int commentId);
|
void ApproveComment(int commentId);
|
||||||
void PendComment(int commentId);
|
void UnapproveComment(int commentId);
|
||||||
void MarkCommentAsSpam(int commentId);
|
void MarkCommentAsSpam(int commentId);
|
||||||
void DeleteComment(int commentId);
|
void DeleteComment(int commentId);
|
||||||
bool CommentsClosedForCommentedContent(int id);
|
bool CommentsClosedForCommentedContent(int id);
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
table.items .actions {
|
||||||
|
white-space:nowrap;
|
||||||
|
}
|
@@ -16,7 +16,7 @@ namespace Orchard.Comments.ViewModels {
|
|||||||
|
|
||||||
public enum CommentDetailsBulkAction {
|
public enum CommentDetailsBulkAction {
|
||||||
None,
|
None,
|
||||||
Pend,
|
Unapprove,
|
||||||
Approve,
|
Approve,
|
||||||
MarkAsSpam,
|
MarkAsSpam,
|
||||||
Delete,
|
Delete,
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Orchard.Comments.Models;
|
using Orchard.Comments.Models;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
|
|
||||||
namespace Orchard.Comments.ViewModels {
|
namespace Orchard.Comments.ViewModels {
|
||||||
public class CommentsIndexViewModel {
|
public class CommentsIndexViewModel {
|
||||||
@@ -10,7 +11,7 @@ namespace Orchard.Comments.ViewModels {
|
|||||||
|
|
||||||
public class CommentEntry {
|
public class CommentEntry {
|
||||||
public CommentPartRecord Comment { get; set; }
|
public CommentPartRecord Comment { get; set; }
|
||||||
public string CommentedOn { get; set; }
|
public ContentItem CommentedOn { get; set; }
|
||||||
public bool IsChecked { get; set; }
|
public bool IsChecked { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ namespace Orchard.Comments.ViewModels {
|
|||||||
|
|
||||||
public enum CommentIndexBulkAction {
|
public enum CommentIndexBulkAction {
|
||||||
None,
|
None,
|
||||||
Pend,
|
Unapprove,
|
||||||
Approve,
|
Approve,
|
||||||
MarkAsSpam,
|
MarkAsSpam,
|
||||||
Delete
|
Delete
|
||||||
|
@@ -1,7 +1,12 @@
|
|||||||
@model Orchard.Comments.ViewModels.CommentsIndexViewModel
|
@model Orchard.Comments.ViewModels.CommentsIndexViewModel
|
||||||
@using Orchard.Comments.Models;
|
@using Orchard.Comments.Models;
|
||||||
@using Orchard.Comments.ViewModels;
|
@using Orchard.Comments.ViewModels;
|
||||||
|
@using Orchard.Mvc.Html;
|
||||||
|
@using Orchard.Utility.Extensions;
|
||||||
|
@{
|
||||||
|
Style.Include("admin.css");
|
||||||
|
Script.Require("ShapesBase");
|
||||||
|
}
|
||||||
<h1>@Html.TitleForPage(T("Manage Comments").ToString())</h1>
|
<h1>@Html.TitleForPage(T("Manage Comments").ToString())</h1>
|
||||||
@using(Html.BeginFormAntiForgeryPost()) {
|
@using(Html.BeginFormAntiForgeryPost()) {
|
||||||
@Html.ValidationSummary()
|
@Html.ValidationSummary()
|
||||||
@@ -10,7 +15,7 @@
|
|||||||
<select id="publishActions" name="@Html.NameOf(m => m.Options.BulkAction)">
|
<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.None, T("Choose action...").ToString())
|
||||||
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Approve, T("Approve").ToString())
|
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Approve, T("Approve").ToString())
|
||||||
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Pend, T("Pend").ToString())
|
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Unapprove, T("Unapprove").ToString())
|
||||||
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.MarkAsSpam, T("Mark as Spam").ToString())
|
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.MarkAsSpam, T("Mark as Spam").ToString())
|
||||||
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Delete, T("Remove").ToString())
|
@Html.SelectOption(Model.Options.BulkAction, CommentIndexBulkAction.Delete, T("Remove").ToString())
|
||||||
</select>
|
</select>
|
||||||
@@ -35,7 +40,6 @@
|
|||||||
<col id="Col4" />
|
<col id="Col4" />
|
||||||
<col id="Col5" />
|
<col id="Col5" />
|
||||||
<col id="Col6" />
|
<col id="Col6" />
|
||||||
<col id="Col7" />
|
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -43,39 +47,38 @@
|
|||||||
<th scope="col">@T("Status")</th>
|
<th scope="col">@T("Status")</th>
|
||||||
<th scope="col">@T("Author")</th>
|
<th scope="col">@T("Author")</th>
|
||||||
<th scope="col">@T("Comment")</th>
|
<th scope="col">@T("Comment")</th>
|
||||||
<th scope="col">@T("Date")</th>
|
|
||||||
<th scope="col">@T("Commented On")</th>
|
<th scope="col">@T("Commented On")</th>
|
||||||
<th scope="col"></th>
|
<th scope="col">@T("Actions")</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@{var commentIndex = 0;}
|
@{var commentIndex = 0;}
|
||||||
@foreach (var commentEntry in Model.Comments) {
|
@foreach (var commentEntry in Model.Comments) {
|
||||||
<tr>
|
<tr itemscope="itemscope" itemid="@Model.Comments[commentIndex].Comment.Id" itemtype="http://orchardproject.net/data/Comment">
|
||||||
<td>
|
<td>
|
||||||
<input type="hidden" value="@Model.Comments[commentIndex].Comment.Id" name="@Html.NameOf(m => m.Comments[commentIndex].Comment.Id)"/>
|
<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)"/>
|
<input type="checkbox" value="true" name="@Html.NameOf(m => m.Comments[commentIndex].IsChecked)"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@if (commentEntry.Comment.Status == CommentStatus.Spam) { T("Spam"); }
|
@if (commentEntry.Comment.Status == CommentStatus.Spam) { @T("Spam") }
|
||||||
else if (commentEntry.Comment.Status == CommentStatus.Pending) { T("Pending"); }
|
else if (commentEntry.Comment.Status == CommentStatus.Pending) { @T("Pending") }
|
||||||
else { T("Approved"); }</td>
|
else { @T("Approved") }
|
||||||
|
</td>
|
||||||
<td>@commentEntry.Comment.UserName</td>
|
<td>@commentEntry.Comment.UserName</td>
|
||||||
<td>
|
<td>
|
||||||
|
@* would ideally have permalinks for individual comments *@
|
||||||
|
<p><a href="@Url.ItemDisplayUrl(commentEntry.CommentedOn)#comments"><time>@Html.DateTime(commentEntry.Comment.CommentDateUtc.GetValueOrDefault())</time></a></p>
|
||||||
@if (commentEntry.Comment.CommentText != null) {
|
@if (commentEntry.Comment.CommentText != null) {
|
||||||
var text = commentEntry.Comment.CommentText.Length > 23 ? commentEntry.Comment.CommentText.Substring(0, 24) : (commentEntry.Comment.CommentText + T(" ..."));
|
var ellipsized = Html.Ellipsize(commentEntry.Comment.CommentText, 500);
|
||||||
@text
|
var paragraphed = new HtmlString(ellipsized.ToHtmlString().Replace("\r\n", "</p><p>"));
|
||||||
|
<p>@paragraphed</p>
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@T("[Empty]")
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@Html.DateTime(commentEntry.Comment.CommentDateUtc.GetValueOrDefault())</td>
|
<td>@Html.ItemDisplayLink(commentEntry.CommentedOn)</td>
|
||||||
<td>@Html.ActionLink(commentEntry.CommentedOn, "Details", new { id = commentEntry.Comment.CommentedOn })</td>
|
|
||||||
<td>
|
<td>
|
||||||
<ul class="actions">
|
<div class="actions">
|
||||||
<li class="construct">
|
|
||||||
<a href="@Url.Action("Edit", new {commentEntry.Comment.Id})" title="@T("Edit")">@T("Edit")</a>
|
|
||||||
</li>
|
|
||||||
<li class="destruct"></li>
|
|
||||||
</ul>
|
|
||||||
</td>
|
|
||||||
@if (commentEntry.Comment.Status != CommentStatus.Spam) {
|
@if (commentEntry.Comment.Status != CommentStatus.Spam) {
|
||||||
<a href="@Url.Action("MarkAsSpam", new {commentEntry.Comment.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Spam")</a>@T(" | ")
|
<a href="@Url.Action("MarkAsSpam", new {commentEntry.Comment.Id, returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString()})" itemprop="RemoveUrl UnsafeUrl">@T("Spam")</a>@T(" | ")
|
||||||
}
|
}
|
||||||
|
@@ -689,6 +689,7 @@ table.items thead, table.items th {
|
|||||||
font-weight:700;
|
font-weight:700;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
|
white-space:nowrap;
|
||||||
}
|
}
|
||||||
/* todo: (heskew) hook back up */
|
/* todo: (heskew) hook back up */
|
||||||
table.items tr.hover {
|
table.items tr.hover {
|
||||||
@@ -703,6 +704,10 @@ table.items th, table.items td {
|
|||||||
padding:8px 12px;
|
padding:8px 12px;
|
||||||
vertical-align:middle;
|
vertical-align:middle;
|
||||||
}
|
}
|
||||||
|
table.items td
|
||||||
|
{
|
||||||
|
vertical-align:top;
|
||||||
|
}
|
||||||
/* todo: Find a better way to do this. These are a fix for buttons and label fonts becomming too large in a table.*/
|
/* todo: Find a better way to do this. These are a fix for buttons and label fonts becomming too large in a table.*/
|
||||||
table label {
|
table label {
|
||||||
font-size:1em;
|
font-size:1em;
|
||||||
@@ -711,7 +716,6 @@ table .button {
|
|||||||
font-size:1em;
|
font-size:1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Content item lists
|
/* Content item lists
|
||||||
----------------------------------------------------------*/
|
----------------------------------------------------------*/
|
||||||
.contentItems {
|
.contentItems {
|
||||||
|
@@ -48,6 +48,26 @@ namespace Orchard.Mvc.Html {
|
|||||||
metadata.EditorRouteValues.Merge(additionalRouteValues));
|
metadata.EditorRouteValues.Merge(additionalRouteValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ItemDisplayUrl(this UrlHelper urlHelper, IContent content) {
|
||||||
|
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||||
|
if (metadata.DisplayRouteValues == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return urlHelper.Action(
|
||||||
|
Convert.ToString(metadata.DisplayRouteValues["action"]),
|
||||||
|
metadata.DisplayRouteValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ItemEditUrl(this UrlHelper urlHelper, IContent content) {
|
||||||
|
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
|
||||||
|
if (metadata.DisplayRouteValues == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return urlHelper.Action(
|
||||||
|
Convert.ToString(metadata.EditorRouteValues["action"]),
|
||||||
|
metadata.EditorRouteValues);
|
||||||
|
}
|
||||||
|
|
||||||
private static string NonNullOrEmpty(params string[] values) {
|
private static string NonNullOrEmpty(params string[] values) {
|
||||||
foreach (var value in values) {
|
foreach (var value in values) {
|
||||||
if (!string.IsNullOrEmpty(value))
|
if (!string.IsNullOrEmpty(value))
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -9,7 +8,6 @@ using System.Web.Mvc.Html;
|
|||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.Collections;
|
using Orchard.Collections;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Services;
|
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
using Orchard.Utility;
|
using Orchard.Utility;
|
||||||
using Orchard.Utility.Extensions;
|
using Orchard.Utility.Extensions;
|
||||||
@@ -195,6 +193,18 @@ namespace Orchard.Mvc.Html {
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Ellipsize
|
||||||
|
|
||||||
|
public static IHtmlString Ellipsize(this HtmlHelper htmlHelper, string text, int characterCount) {
|
||||||
|
return new HtmlString(htmlHelper.Encode(text).Ellipsize(characterCount));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IHtmlString Ellipsize(this HtmlHelper htmlHelper, string text, int characterCount, string ellipsis) {
|
||||||
|
return new HtmlString(htmlHelper.Encode(text).Ellipsize(characterCount, ellipsis));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Excerpt
|
#region Excerpt
|
||||||
|
|
||||||
public static MvcHtmlString Excerpt(this HtmlHelper html, string markup, int length) {
|
public static MvcHtmlString Excerpt(this HtmlHelper html, string markup, int length) {
|
||||||
|
Reference in New Issue
Block a user