UI cleanup pass (progress - some of Orchard.Comments)

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045097
This commit is contained in:
skewed
2010-01-07 08:48:31 +00:00
parent b7fb6a2924
commit fab0f1bede
9 changed files with 98 additions and 88 deletions

View File

@@ -8,7 +8,5 @@ if (Model.Blogs.Count() > 0) { %>
<%=Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayForItem(b).ToHtmlString(), "blogs contentItems") %> <%=Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayForItem(b).ToHtmlString(), "blogs contentItems") %>
<div class="actions"><a class="add button" href="<%=Url.BlogCreate() %>"><%=_Encoded("New Blog") %></a></div><% <div class="actions"><a class="add button" href="<%=Url.BlogCreate() %>"><%=_Encoded("New Blog") %></a></div><%
} else { %> } else { %>
<%-- todo: (heskew) come back to this --%> <div class="info message"><%=T("There are no blogs for you to see. Want to <a href=\"{0}\">add one</a>?", Url.BlogCreate()).ToString()%></div><%
<div class="info message"><%--<%=string.Format(_Encoded("There are no blogs for you to see. Want to {0}?").ToString(), Html.Link(_Encoded("add one").ToString(), Url.BlogCreate())) %>--%>
<%=string.Format("There are no blogs for you to see. Want to {0}?", Html.Link(_Encoded("add one").ToString(), Url.BlogCreate())) %></div><%
} %> } %>

View File

@@ -1,3 +1,3 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HasComments>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<span class="commentcount"><a href="#comments"><%=Model.CommentCount %> Comment<%=Model.CommentCount == 1 ? "" : "s" %></a></span> <span class="commentcount"><%=Html.Link(_Encoded("{0} Comment{1}", Model.CommentCount, Model.CommentCount == 1 ? "" : "s").ToString(), "#comments") %></span>

View File

@@ -1,6 +1,6 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<HasComments>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
<%@ Import Namespace="Orchard.Comments.Models"%> <%@ Import Namespace="Orchard.Comments.Models"%>
<h3 id="comments"><a name="comments"><%=Model.CommentCount %> Comment<%=Model.CommentCount == 1 ? "" : "s" %></a></h3><% <h2 id="comments"><%=_Encoded("{0} Comment{1}", Model.CommentCount, Model.CommentCount == 1 ? "" : "s") %></h2><%
foreach (var comment in Model.Comments) { %> foreach (var comment in Model.Comments) { %>
<div> <div>
<div class="comment"> <div class="comment">

View File

@@ -1,21 +1,19 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<HasComments>" %>
<%@ Import Namespace="Orchard.Comments.Models" %> <%@ Import Namespace="Orchard.Comments.Models" %>
<fieldset> <fieldset>
<legend>Comments<% if (Model.ContentItem.Id != 0) { %>: <%-- todo: (heskew) pull the legend and put the link to the comments elsewhere? --%>
<% <legend><%=Model.ContentItem.Id != 0
var commentCount = Model.CommentCount; %> ? T("Comments {0} - <a href=\"#\">?? pending</a>", Html.ActionLink(
<%=Html.ActionLink( T("{0} comment{1}", Model.CommentCount, Model.CommentCount == 1 ? "" : "s").ToString(),
string.Format("{0} comment{1}", commentCount, commentCount == 1 ? "" : "s"),
"Details", "Details",
new { Area = "Orchard.Comments", Controller = "Admin", id = Model.ContentItem.Id, returnUrl = Context.Request.Url } new { Area = "Orchard.Comments", Controller = "Admin", id = Model.ContentItem.Id, returnUrl = Context.Request.Url }))
) %> : T("Comments")%></legend>
- <a href="#">0 pending</a><% } %></legend> <%--
<label for="CommentsShown"> todo: (heskew) can get into a weird state if this is disabled but comments are active so, yeah, comment settings on a content item need to be hashed out
<%=Html.EditorFor(x=>x.CommentsShown) %> <%=Html.EditorFor(m => m.CommentsShown) %>
<%= T("Comments are shown. Existing comments are displayed.")%> <label class="forcheckbox" for="CommentsShown"><%=T("Comments are shown. Existing comments are displayed.") %></label>
</label> --%>
<label for="CommentsActive"> <%=Html.EditorFor(m => m.CommentsActive) %>
<%=Html.EditorFor(x=>x.CommentsActive) %> <label class="forcheckbox" for="CommentsActive"><%=T("Allow new comments") %></label>
<%= T("Comments active. Users may add comments.")%> <span class="hint forcheckbox"><%=T("Enable to show the comment form. Disabling still allows the existing comments to be shown but does not allow the conversation to continue.")%></span>
</label>
</fieldset> </fieldset>

View File

@@ -1,34 +1,35 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Orchard.Comments.Models.CommentSettingsRecord>" %> <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<CommentSettingsRecord>" %>
<h3>Comments</h3> <%@ Import Namespace="Orchard.Comments.Models"%>
<ol> <fieldset>
<li> <legend><%=_Encoded("Comments")%></legend>
<%= Html.LabelFor(x=>x.RequireLoginToAddComment) %> <fieldset>
<%= Html.EditorFor(x=>x.RequireLoginToAddComment) %> <%=Html.EditorFor(m => m.EnableCommentsOnPages) %>
<%= Html.ValidationMessage("RequireLoginToAddComment", "*")%> <label class="forcheckbox" for="CommentSettings_EnableCommentsOnPages"><%=_Encoded("Enable comments on pages")%></label>
</li>
<li>
<%= Html.LabelFor(x=>x.EnableCommentsOnPages) %>
<%= Html.EditorFor(x=>x.EnableCommentsOnPages) %>
<%=Html.ValidationMessage("EnableCommentsOnPages", "*")%> <%=Html.ValidationMessage("EnableCommentsOnPages", "*")%>
</li> </fieldset>
<li> <fieldset>
<%= Html.LabelFor(x=>x.EnableCommentsOnPosts) %> <%=Html.EditorFor(m => m.EnableCommentsOnPosts) %>
<%= Html.EditorFor(x=>x.EnableCommentsOnPosts) %> <label class="forcheckbox" for="CommentSettings_EnableCommentsOnPosts"><%=_Encoded("Enable comments on blog posts")%></label>
<%=Html.ValidationMessage("EnableCommentsOnPosts", "*")%> <%=Html.ValidationMessage("EnableCommentsOnPosts", "*")%>
</li> </fieldset>
<li> <fieldset>
<%= Html.LabelFor(x=>x.EnableSpamProtection) %> <%=Html.EditorFor(m => m.RequireLoginToAddComment) %>
<%= Html.EditorFor(x=>x.EnableSpamProtection) %> <label class="forcheckbox" for="CommentSettings_RequireLoginToAddComment"><%=_Encoded("Require login to comment")%></label>
<%=Html.ValidationMessage("RequireLoginToAddComment", "*")%>
</fieldset>
<fieldset>
<%=Html.EditorFor(m => m.EnableSpamProtection) %>
<label class="forcheckbox" for="CommentSettings_EnableSpamProtection"><%=_Encoded("Enable spam protection") %></label>
<%=Html.ValidationMessage("EnableSpamProtection", "*")%> <%=Html.ValidationMessage("EnableSpamProtection", "*")%>
</li> </fieldset>
<li> <fieldset>
<%= Html.LabelFor(x=>x.AkismetKey) %> <label for="CommentSettings_AkismetKey"><%=_Encoded("Akismet key") %></label>
<%= Html.EditorFor(x=>x.AkismetKey) %> <%=Html.EditorFor(m => m.AkismetKey) %>
<%=Html.ValidationMessage("AkismetKey", "*")%> <%=Html.ValidationMessage("AkismetKey", "*")%>
</li> </fieldset>
<li> <fieldset>
<%= Html.LabelFor(x=>x.AkismetUrl) %> <label for="CommentSettings_AkismetUrl"><%=_Encoded("Akismet endpoint URL") %></label>
<%= Html.EditorFor(x=>x.AkismetUrl) %> <%=Html.EditorFor(m => m.AkismetUrl) %>
<%=Html.ValidationMessage("AkismetUrl", "*")%> <%=Html.ValidationMessage("AkismetUrl", "*")%>
</li> </fieldset>
</ol> </fieldset>

View File

@@ -154,7 +154,7 @@ h6, p, legend, label, input, select, .button,
.message, .validation-summary-errors, .message, .validation-summary-errors,
table.items th, table.items td, table.items caption { font-size:1.5em; line-height:1.5em; } /* 15px */ table.items th, table.items td, table.items caption { font-size:1.5em; line-height:1.5em; } /* 15px */
p .button { font-size:inherit; } p .button { font-size:inherit; }
.meta { font-size:1.2em; } /* 12px */ .meta, .hint { font-size:1.2em; } /* 12px */
@@ -351,6 +351,9 @@ label {
display: block; display: block;
font-weight:700; font-weight:700;
} }
label.forcheckbox {
display:inline;
}
fieldset.bulk.actions label, label.sub { fieldset.bulk.actions label, label.sub {
display:inline; display:inline;
} }
@@ -360,6 +363,12 @@ label span {
label input { label input {
vertical-align:text-top; vertical-align:text-top;
} }
.hint {
display:block;
}
.hint.forcheckbox {
text-indent:3ex; /* todo: (heskew) this might look out of place */
}
/* todo: (heskew) try to get .text on stuff like .text-box */ /* todo: (heskew) try to get .text on stuff like .text-box */
select, textarea, input.text, input.text-box { select, textarea, input.text, input.text-box {
padding:2px; padding:2px;
@@ -372,6 +381,10 @@ input.text, input.text-box {
select:focus, textarea:focus, input.text:focus, input.text-box:focus { select:focus, textarea:focus, input.text:focus, input.text-box:focus {
border-color:#666d51; border-color:#666d51;
} }
input.check-box {
margin-left:0;
vertical-align:-.1em;
}
.permalink input { .permalink input {
background:transparent; background:transparent;
border-color:#EAE9D9; border-color:#EAE9D9;

View File

@@ -1,31 +1,5 @@
using System; namespace Orchard.Localization {
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Orchard.Logging;
namespace Orchard.Localization {
public interface IText { public interface IText {
LocalizedString Get(string textHint, params object[] args); LocalizedString Get(string textHint, params object[] args);
} }
public class Text : IText {
private readonly string _scope;
public Text(string scope) {
_scope = scope;
Logger = NullLogger.Instance;
}
public ILogger Logger { get; set; }
public LocalizedString Get(string textHint, params object[] args) {
Logger.Debug("{0} localizing '{1}'", _scope, textHint);
var localizedFormat = textHint;
var localizedText = string.Format(localizedFormat, args);
return new LocalizedString(localizedText);
}
}
} }

View File

@@ -0,0 +1,25 @@
using Orchard.Logging;
namespace Orchard.Localization {
public class Text : IText {
private readonly string _scope;
public Text(string scope) {
_scope = scope;
Logger = NullLogger.Instance;
}
public ILogger Logger { get; set; }
public LocalizedString Get(string textHint, params object[] args) {
Logger.Debug("{0} localizing '{1}'", _scope, textHint);
//todo: actually localize the textHint
var localizedFormat = textHint;
return args.Length < 1
? new LocalizedString(localizedFormat)
: new LocalizedString(string.Format(localizedFormat, args));
}
}
}

View File

@@ -177,6 +177,7 @@
<Compile Include="ContentManagement\Records\ContentPartVersionRecord.cs" /> <Compile Include="ContentManagement\Records\ContentPartVersionRecord.cs" />
<Compile Include="ContentManagement\Records\ContentTypeRecord.cs" /> <Compile Include="ContentManagement\Records\ContentTypeRecord.cs" />
<Compile Include="ContentManagement\Records\Utility.cs" /> <Compile Include="ContentManagement\Records\Utility.cs" />
<Compile Include="Localization\Text.cs" />
<Compile Include="Mvc\ViewModels\ContentItemViewModel.cs" /> <Compile Include="Mvc\ViewModels\ContentItemViewModel.cs" />
<Compile Include="ContentManagement\ViewModels\TemplateViewModel.cs" /> <Compile Include="ContentManagement\ViewModels\TemplateViewModel.cs" />
<Compile Include="Controllers\HomeController.cs" /> <Compile Include="Controllers\HomeController.cs" />