More blog admin UI cleanup

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4043231
This commit is contained in:
skewed
2009-12-04 22:27:54 +00:00
parent 920175c7ee
commit 7210273340
10 changed files with 40 additions and 17 deletions

View File

@@ -493,6 +493,10 @@ a.ibutton.publish,
a.ibutton.publish:link, a.ibutton.publish:link,
a.ibutton.publish:visited { background-position:-100px -20px; } a.ibutton.publish:visited { background-position:-100px -20px; }
a.ibutton.publish:hover, a.ibutton.publish:active, a.ibutton.publish:focus { background-position:-100px 0; } a.ibutton.publish:hover, a.ibutton.publish:active, a.ibutton.publish:focus { background-position:-100px 0; }
a.ibutton.blog,
a.ibutton.blog:link,
a.ibutton.blog:visited { background-position:-120px -20px; }
a.ibutton.blog:hover, a.ibutton.blog:active, a.ibutton.blog:focus { background-position:-120px 0; }
/* todo: (heskew) needs attention */ /* todo: (heskew) needs attention */
@@ -566,6 +570,7 @@ ol.actions label {
#main .contentItems li:hover a.ibutton.add.page { background-position:-60px 0; } #main .contentItems li:hover a.ibutton.add.page { background-position:-60px 0; }
#main .contentItems li:hover a.ibutton.edit { background-position:-80px 0; } #main .contentItems li:hover a.ibutton.edit { background-position:-80px 0; }
#main .contentItems li:hover a.ibutton.publish { background-position:-100px 0; } #main .contentItems li:hover a.ibutton.publish { background-position:-100px 0; }
#main .contentItems li:hover a.ibutton.blog { background-position:-120px 0; }
/* Tables /* Tables
----------------------------------------------------------*/ ----------------------------------------------------------*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -4,12 +4,18 @@ using Orchard.Mvc.Html;
namespace Orchard.Blogs.Extensions { namespace Orchard.Blogs.Extensions {
public static class HtmlHelperExtensions { public static class HtmlHelperExtensions {
public static string Published(this HtmlHelper<BlogPost> htmlHelper) { public static string PublishedState(this HtmlHelper<BlogPost> htmlHelper) {
return htmlHelper.Published(htmlHelper.ViewData.Model); return htmlHelper.PublishedState(htmlHelper.ViewData.Model);
}
public static string PublishedState(this HtmlHelper htmlHelper, BlogPost blogPost) {
return htmlHelper.DateTime(blogPost.Published, "Draft");
} }
public static string Published(this HtmlHelper htmlHelper, BlogPost blogPost) { public static string PublishedWhen(this HtmlHelper<BlogPost> htmlHelper) {
return htmlHelper.DateTime(blogPost.Published, "as a Draft"); return htmlHelper.PublishedWhen(htmlHelper.ViewData.Model);
}
public static string PublishedWhen(this HtmlHelper htmlHelper, BlogPost blogPost) {
return htmlHelper.DateTimeRelative(blogPost.Published, "as a Draft");
} }
} }
} }

View File

@@ -4,12 +4,15 @@
<%@ Import Namespace="Orchard.Blogs.Models"%> <%@ Import Namespace="Orchard.Blogs.Models"%>
<h3><a href="<%=Url.BlogForAdmin(Model.Slug) %>"><%=Html.Encode(Model.Name) %></a></h3> <h3><a href="<%=Url.BlogForAdmin(Model.Slug) %>"><%=Html.Encode(Model.Name) %></a></h3>
<div class="meta"> <div class="meta">
<% var postCount = Model.PostCount; %><a href="<%=Url.BlogForAdmin(Model.Slug) %>"><%=string.Format("{0} post{1}", postCount, postCount == 1 ? "" : "s") %></a></div> <% var postCount = Model.PostCount; %><a href="<%=Url.BlogForAdmin(Model.Slug) %>"><%=string.Format("{0} post{1}", postCount, postCount == 1 ? "" : "s") %></a>
| <a href="#">?? comments</a>
</div>
<%--<p>[list of authors] [modify blog access]</p>--%> <%--<p>[list of authors] [modify blog access]</p>--%>
<p><%=Model.Description %></p> <p><%=Model.Description %></p>
<p class="actions"> <p class="actions">
<%-- todo: (heskew) make into a ul --%> <%-- todo: (heskew) make into a ul --%>
<span class="construct"> <span class="construct">
<a href="<%=Url.BlogEdit(Model.Slug) %>" class="ibutton blog" title="Manage Blog">Manage Blog</a>
<a href="<%=Url.BlogEdit(Model.Slug) %>" class="ibutton edit" title="Edit Blog">Edit Blog</a> <a href="<%=Url.BlogEdit(Model.Slug) %>" class="ibutton edit" title="Edit Blog">Edit Blog</a>
<a href="<%=Url.Blog(Model.Slug) %>" class="ibutton view" title="View Blog">View Blog</a> <a href="<%=Url.Blog(Model.Slug) %>" class="ibutton view" title="View Blog">View Blog</a>
<a href="<%=Url.BlogPostCreate(Model.Slug) %>" class="ibutton add page" title="New Post">New Post</a> <a href="<%=Url.BlogPostCreate(Model.Slug) %>" class="ibutton add page" title="New Post">New Post</a>

View File

@@ -11,7 +11,7 @@
<h1><%=Html.Encode(Model.Post.Title) %></h1> <h1><%=Html.Encode(Model.Post.Title) %></h1>
<div class="metadata"> <div class="metadata">
<%if (Model.Post.Creator != null) {%> <%if (Model.Post.Creator != null) {%>
<div class="posted">Posted by <%=Html.Encode(Model.Post.Creator.UserName)%> <%=Html.Published(Model.Post)%></div> <div class="posted">Posted by <%=Html.Encode(Model.Post.Creator.UserName)%> <%=Html.PublishedWhen(Model.Post)%></div>
<%}%> <%}%>
<div><a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Post.Slug) %>">(edit)</a></div> <div><a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Post.Slug) %>">(edit)</a></div>
</div> </div>

View File

@@ -4,5 +4,5 @@
<%@ Import Namespace="Orchard.Core.Common.Models"%> <%@ Import Namespace="Orchard.Core.Common.Models"%>
<%@ Import Namespace="Orchard.Blogs.Models"%> <%@ Import Namespace="Orchard.Blogs.Models"%>
<h3 class="title"><a href="<%=Url.BlogPost(Model.Blog.Slug, Model.As<RoutableAspect>().Slug) %>"><%=Html.Encode(Model.As<RoutableAspect>().Title) %></a></h3> <h3 class="title"><a href="<%=Url.BlogPost(Model.Blog.Slug, Model.As<RoutableAspect>().Slug) %>"><%=Html.Encode(Model.As<RoutableAspect>().Title) %></a></h3>
<div class="posted"><%=Html.Published() %></div> <div class="posted"><%=Html.PublishedWhen() %></div>
<div class="content"><%=Model.Body %></div> <div class="content"><%=Model.Body %></div>

View File

@@ -5,7 +5,8 @@
<%@ Import Namespace="Orchard.Blogs.Models"%> <%@ Import Namespace="Orchard.Blogs.Models"%>
<h3><a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Slug) %>"><%=Html.Encode(Model.Title) %></a></h3> <h3><a href="<%=Url.BlogPostEdit(Model.Blog.Slug, Model.Slug) %>"><%=Html.Encode(Model.Title) %></a></h3>
<div class="meta"> <div class="meta">
<%=Html.Published() %> <%=Html.PublishedState() %>
| <a href="#">?? comments</a>
</div> </div>
<div class="content"><%=Model.Body ?? "<p><em>there's no content for this blog post</em></p>" %></div> <div class="content"><%=Model.Body ?? "<p><em>there's no content for this blog post</em></p>" %></div>
<p class="actions"> <p class="actions">

View File

@@ -8,7 +8,7 @@
<p class="comment"> <p class="comment">
<%--TODO: (erikpo) Need to clean the name and url so nothing dangerous goes out--%> <%--TODO: (erikpo) Need to clean the name and url so nothing dangerous goes out--%>
<strong><%=Html.LinkOrDefault(comment.UserName, comment.SiteName, new { rel = "nofollow" })%></strong> <strong><%=Html.LinkOrDefault(comment.UserName, comment.SiteName, new { rel = "nofollow" })%></strong>
<span>said<br /><%=Html.Link(Html.DateTime(comment.CommentDate), "#")%></span> <span>said<br /><%=Html.Link(Html.DateTimeRelative(comment.CommentDate), "#")%></span>
</p> </p>
<div class="text"> <div class="text">
<p><%=comment.CommentText %></p> <p><%=comment.CommentText %></p>

View File

@@ -87,30 +87,38 @@ namespace Orchard.Mvc.Html {
#region Format Date/Time #region Format Date/Time
public static string DateTimeRelative(this HtmlHelper htmlHelper, DateTime? value, string defaultIfNull) {
return value.HasValue ? htmlHelper.DateTimeRelative(value.Value) : defaultIfNull;
}
//TODO: (erikpo) This method needs localized //TODO: (erikpo) This method needs localized
public static string DateTime(this HtmlHelper htmlHelper, DateTime value) public static string DateTimeRelative(this HtmlHelper htmlHelper, DateTime value) {
{
TimeSpan time = System.DateTime.UtcNow - value; TimeSpan time = System.DateTime.UtcNow - value;
if (time.TotalDays > 7) if (time.TotalDays > 7)
//TODO: (erikpo) This format should come from a site setting return "at " + htmlHelper.DateTime(value);
return "at " + value.ToString("MMM d yyyy h:mm tt");
if (time.TotalHours > 24) if (time.TotalHours > 24)
return string.Format("{0} day{1} ago", time.Days, time.Days == 1 ? "" : "s"); return string.Format("{0} day{1} ago", time.Days, time.Days == 1 ? "" : "s");
if (time.TotalMinutes > 60) if (time.TotalMinutes > 60)
return string.Format("{0} hour{1} ago", time.Hours, time.Hours == 1 ? "" : "s"); return string.Format("{0} hour{1} ago", time.Hours, time.Hours == 1 ? "" : "s");
if (time.TotalSeconds > 60) if (time.TotalSeconds > 60)
return string.Format("{0} minute{1} ago", time.Minutes, time.Minutes == 1 ? "" : "s"); return string.Format("{0} minute{1} ago", time.Minutes, time.Minutes == 1 ? "" : "s");
else if (time.TotalSeconds > 10) if (time.TotalSeconds > 10)
return string.Format("{0} second{1} ago", time.Seconds, time.Seconds == 1 ? "" : "s"); return string.Format("{0} second{1} ago", time.Seconds, time.Seconds == 1 ? "" : "s");
else
return "a moment ago"; return "a moment ago";
} }
public static string DateTime(this HtmlHelper htmlHelper, DateTime? value, string defaultIfNull) { public static string DateTime(this HtmlHelper htmlHelper, DateTime? value, string defaultIfNull)
{
return value.HasValue ? htmlHelper.DateTime(value.Value) : defaultIfNull; return value.HasValue ? htmlHelper.DateTime(value.Value) : defaultIfNull;
} }
//TODO: (erikpo) This format should come from a site setting
public static string DateTime(this HtmlHelper htmlHelper, DateTime value) {
return value.ToString("MMM d yyyy h:mm tt");
}
#endregion #endregion
#region Link #region Link