Some work on the Blogs admin including a rework of the create blog post (page)

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4042268
This commit is contained in:
skewed
2009-11-26 00:38:40 +00:00
parent bc814e566f
commit 9bf113b224
12 changed files with 173 additions and 120 deletions

View File

@@ -243,10 +243,6 @@ a:hover, a:active, a:focus {
padding:0 0 0 12px;
text-decoration:none;
}
/* todo: (heskew) what's the point of a :visited color for an admin nav?
#navigation ul a:visited{
color: #2b2b2b;
} */
#navigation ul a:hover, #navigation ul a:focus {
background:#f0ecd2;
color: #3e4301;
@@ -255,16 +251,17 @@ a:hover, a:active, a:focus {
/* Content
----------------------------------------------------------*/
#main h2, #main h3, #main h4, #main p, #main form {
#main h2, #main h3, #main h4, #main p {
margin:.23em 0 1em;
}
#main form {
margin:.345em 0 1.5em;
}
#main h2, #main h3 {
border-bottom:1px dashed #e4e7dc;
}
/* Confirmations;
/* Confirmations, Messages and the like
----------------------------------------------------------*/
.message {
margin:10px 0 4px 0;
@@ -346,10 +343,6 @@ textarea {
width:98.662%;
}
.radioButton {
margin:0 6px 0 0;
}
button, .button, .button:link, .button:visited {
background:#dddfcb url(images/tableHeaderBackground.gif) repeat-x top left;
border:1px solid #d2d6c6;
@@ -381,8 +374,8 @@ button:focus, .button:focus {
}
#main .manage {
float:right;
overflow:hidden;
margin:3px 0 6px 4px;
overflow:hidden;
}
#main div.actions {
height:2em;
@@ -398,124 +391,115 @@ button:focus, .button:focus {
/* todo: (heskew) needs attention */
#permalink{
width:200px;
}
input.large.text {
font-size:130%;
font-weight:500;
}
.helperText {
margin:-4px 0 8px 0;
}
#Revision_Slug{
width:245px;
}
/* ---------- Sidebar forms ---------- */
.sideBar fieldset {margin:0px; border:none;}
#Date {width:80px; margin:4px 4px 4px 16px;}
#Hour, #Minutes {width:30px;}
/* ---------- Actions form elements and filtering ---------- */
ol.actions {margin:20px 0 0 0;}
ol.actions .button {margin:4px 4px 4px -8px;}
ol.actions label {
margin:9px 0 0;
}
.filterActions {
float:right;
margin:10px 2px 0 0;
}
/* Tables;
/* Tables
----------------------------------------------------------*/
table {
border-collapse: separate;
width: 100%;
border-spacing: 0px;
border:1px solid #B0B083;
background:#fff;
border:1px solid #B0B083;
border-collapse:separate;
border-spacing:0;
width:100%;
}
tbody
{
border-spacing: 0px;
vertical-align: middle;
border-spacing:0;
vertical-align:middle;
}
thead, th {
font-weight:700;
text-align:left;
background:url(images/tableHeaderBackground.gif) repeat-x top left #dddfcb;
font-weight:700;
overflow:hidden;
text-align:left;
}
/* todo: (heskew) hook back up */
.trhover{background-color:#f0f3d6;}
th, td {
padding: 8px 12px;
border-spacing: 0px;
border-bottom:1px solid #EAE9D9;
border-spacing:0px;
display:table-cell;
vertical-align: middle;
border-bottom: 1px solid #EAE9D9;
padding:8px 12px;
vertical-align:middle;
}
caption {
text-indent: 0px;
font-size:110%;
padding:8px 0 8px 0;
text-indent:0;
}
col {
border-spacing: 0px;
display: table-column;
}
border-spacing:;
display:table-column;
}
colgroup
{
border-spacing: 0px;
display: table-column-group;
border-spacing:0;
display:table-column-group;
}
tr.critical {background:#e68585; border:inherit;}
tr.warning {background:#fdf5bc; border:inherit;}
/* todo: (heskew) needs attention */
/* Horizontal lists
----------------------------------------------------------*/
ul.horizontal, ol.horizontal {
margin:0;
padding:0;
list-style:none;
}
ul.horizontal li, ol.horizontal li {
float:left;
margin:0 4px;
}
ul.horizontal li a, ul.horizontal li a:visited, ul.horizontal li a:active, ol.horizontal li a, ol.horizontal li a:visited, ol.horizontal li a:active {
display:block;
text-decoration: none;
}
/* Miscellaneous;
/* MISC.
todo: (heskew) pull out into relevant modules where appropriate
----------------------------------------------------------*/
/* CMSPages */
/* CMSPages
----------------------------------------------------------*/
.templates fieldset {
margin:0 0 .933%;
}
@@ -528,43 +512,37 @@ ul.horizontal li a, ul.horizontal li a:visited, ul.horizontal li a:active, ol.ho
margin:.27em .93em .93em .54em;
width:124px;
}
.previewImage {
width:70%;
height:70%;
border:1px solid #525e50;
height:70%;
width:70%;
}
/* Blogs
----------------------------------------------------------*/
ul.blogs li {
margin:0.575em 0 2.5em;
}
/* todo: (heskew) needs attention */
/* Extensions;
----------------------------------------------------------*/
.floatLeft {float: left;} /*Use this class to float anything to the left*/
.floatRight {float: right;} /*Use this class to float anything to the right*/
.alignRight {text-align: right;}
.Inline {display: inline;}
.center {margin:0 auto;} /*Center*/
.clearLayout {clear:both;} /*Use this class clear layout*/
.disabled {color:#CCC;}
.topSpacer{margin-top: 20px;}
.bottomSpacer{margin-bottom: 20px;}
.displayText {display:none;}
/*
.separator {border-bottom:1px dashed #E4E7DC; margin-bottom:8px; padding-bottom:2px;}
*/
/*TODO - Remove roundCorners class*/
/* todo: (heskew) remove roundCorners class */
#content, #navigation li,
table, textarea, .button, input.text, input.text-box, .inputTextLarge,
.inputTextPermalink, .linkButton, .confirmation.message,

View File

@@ -96,9 +96,11 @@
<ItemGroup>
<Content Include="Package.txt" />
<Content Include="Views\BlogPost\Create.aspx" />
<Content Include="Views\BlogPost\EditorTemplates\CreateBlogPostViewModel.ascx" />
<Content Include="Views\BlogPost\Item.aspx" />
<Content Include="Views\Blog\Create.aspx" />
<Content Include="Views\BlogPost\ListByBlog.aspx" />
<Content Include="Views\Blog\DisplayTemplates\Blog.ascx" />
<Content Include="Views\Blog\Edit.aspx" />
<Content Include="Views\Blog\EditorTemplates\BlogEditViewModel.ascx" />
<Content Include="Views\Blog\EditorTemplates\BlogPermalink.ascx" />

View File

@@ -4,9 +4,10 @@
<%@ Import Namespace="Orchard.Mvc.Html" %>
<% Html.Include("Head"); %>
<h2>Create New Blog</h2>
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> > Create Blog</p>
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> &gt; Create Blog</p>
<% using (Html.BeginForm()) { %>
<%=Html.ValidationSummary() %>
<%=Html.EditorForModel() %>
<fieldset><input class="button" type="submit" value="Create" /></fieldset>
<% } %>
<% Html.Include("Foot"); %>

View File

@@ -0,0 +1,6 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Blog>" %>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<h3><a href="<%=Url.BlogEdit(Model.Slug) %>"><%=Html.Encode(Model.Name) %></a> <span>(<a href="<%=Url.Blog(Model.Slug) %>">view</a>)</span> <span>(<a href="<%=Url.BlogPostCreate(Model.Slug) %>">post</a>)</span></h3>
<p>[list of authors] [modify blog access]</p>
<p><%=Model.Description %></p>

View File

@@ -1,17 +1,10 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogsViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<%@ Import Namespace="Orchard.Blogs.ViewModels"
%><div class="actions"><a class="add button" href="<%=Url.BlogCreate() %>">Create a New Blog</a></div><%
if (Model.Blogs.Count() > 0) { %>
<ul><%
foreach (Blog blog in Model.Blogs) { %>
<li>
<h3><a href="<%=Url.BlogEdit(blog.Slug) %>"><%=Html.Encode(blog.Name) %></a> <span>(<a href="<%=Url.Blog(blog.Slug) %>">view</a>)</span> <span>(<a href="<%=Url.BlogPostCreate(blog.Slug) %>">post</a>)</span></h3>
<p>[list of authors] [modify blog access]</p>
<p><%=blog.Description %></p>
</li><%
} %>
</ul>
<%=Html.UnorderedList(Model.Blogs, (b, i) => Html.DisplayFor(blog => b).ToHtmlString(), "blogs") %>
<div class="actions"><a class="add button" href="<%=Url.BlogCreate() %>">Create a New Blog</a></div><%
} %>

View File

@@ -4,9 +4,10 @@
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<% Html.Include("Head"); %>
<h2>Edit Blog</h2>
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> > Editing <strong><%=Html.Encode(Model.Name)%></strong></p>
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> &gt; Editing <strong><%=Html.Encode(Model.Name)%></strong></p>
<% using (Html.BeginForm()) { %>
<%=Html.ValidationSummary() %>
<%=Html.EditorForModel() %>
<fieldset><input class="button" type="submit" value="Save" /></fieldset>
<% } %>
<% Html.Include("Foot"); %>

View File

@@ -1,14 +1,11 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogEditViewModel>" %>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<fieldset>
<label for="">Blog Name</label>
<label for="">Blog Name:</label>
<%=Html.EditorFor(m => m.Name) %>
<fieldset>
</fieldset>
<%=Html.EditorFor(m => m.Slug, "BlogPermalink") %>
</fieldset>
<label for="">Description</label>
<%=Html.TextAreaFor(m => m.Description, 5, 60, null)%>
<fieldset>
</fieldset>
<input class="button" type="submit" value="Save" />
<label for="">Description:</label>
<%=Html.TextAreaFor(m => m.Description, 5, 60, null) %>
</fieldset>

View File

@@ -1,14 +1,11 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CreateBlogViewModel>" %>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<fieldset>
<label for="">Blog Name</label>
<label for="">Blog Name:</label>
<%=Html.EditorFor(m => m.Name) %>
<fieldset>
</fieldset>
<%=Html.EditorFor(m => m.Slug, "BlogPermalink") %>
</fieldset>
<label for="">Description</label>
<%=Html.TextAreaFor(m => m.Description, 5, 60, null) %>
<fieldset>
</fieldset>
<input class="button" type="submit" value="Create" />
<label for="">Description:</label>
<%=Html.TextAreaFor(m => m.Description, 5, 60, null) %>
</fieldset>

View File

@@ -4,23 +4,11 @@
<%@ Import Namespace="Orchard.Security" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<% Html.Include("Head"); %>
<div class="yui-u">
<h2 class="separator">
Create a New Blog Post</h2>
<p class="bottomSpacer">
<a href="<%=Url.Blogs() %>">Manage Blogs</a> > <a href="<%=Url.BlogEdit(Model.Blog.Slug) %>"><%=Html.Encode(Model.Blog.Name) %></a> > Create Blog Post
</p>
</div>
<div class="yui-u">
<%using (Html.BeginForm()) { %>
<ol>
<%= Html.ValidationSummary() %>
<%= Html.EditorForModel() %>
<li class="clearLayout">
<input class="button" type="submit" value="Create" />
<a href="<%=Url.Blogs() %>" class="button">Cancel</a>
</li>
</ol>
<%}/*EndForm*/%>
</div>
<h2>Create a New Blog Post</h2>
<p><a href="<%=Url.Blogs() %>">Manage Blogs</a> &gt; <a href="<%=Url.BlogEdit(Model.Blog.Slug) %>"><%=Html.Encode(Model.Blog.Name) %></a> &gt; Create Blog Post</p>
<%using (Html.BeginForm()) { %>
<%= Html.ValidationSummary() %>
<%= Html.EditorForModel() %>
<fieldset><input class="button" type="submit" value="Create" /></fieldset>
<% } %>
<% Html.Include("Foot"); %>

View File

@@ -0,0 +1,36 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<CreateBlogPostViewModel>" %>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<div class="sections">
<div class="primary">
<h3>Blog Post Content</h3>
<%-- todo: (heskew) thin out the fieldsets if they become overkill --%>
<fieldset>
<label for="title">Title:</label>
<span><%=Html.TextBoxFor(m => m.Title, new { id = "title", @class = "text" })%></span>
</fieldset>
<fieldset>
<label class="sub" for="permalink">Permalink: <span>http://localhost/<%=Model.Blog.Slug %>/</span></label>
<span><%=Html.TextBoxFor(m => m.Slug, new { id = "permalink", @class = "text" })%> <span> &laquo; How to write a permalink. &raquo; </span></span>
</fieldset>
<fieldset>
<label for="body">Body:</label>
<span><%=Html.TextAreaFor(m => m.Body, new { id = "body", @class = "html" })%></span>
</fieldset>
</div>
<div class="secondary">
<h3>Publish Settings</h3>
<fieldset>
<label for="Command_PublishNow"><%=Html.RadioButton("Command", "PublishNow", new { id = "Command_PublishNow" }) %> Publish Now</label>
</fieldset>
<fieldset>
<label for="Command_PublishLater"><%=Html.RadioButton("Command", "PublishLater", new { id = "Command_PublishLater" }) %> Publish Later</label>
<%=Html.EditorFor(m => m.Published) %>
</fieldset>
<fieldset>
<label for="Command_SaveDraft"><%=Html.RadioButton("Command", "SaveDraft", new { id = "Command_SaveDraft" }) %> Save Draft</label></li>
</fieldset>
<fieldset>
<input class="button" type="submit" name="submit.Save" value="Save"/>
</fieldset>
</div>
</div>

View File

@@ -6,7 +6,7 @@
<p class="bottomSpacer"><%=_Encoded("about setting up a page") %></p>
<%=Html.ValidationSummary() %>
<div class="sections">
<%using (Html.BeginForm()) { %>
<% using (Html.BeginForm()) { %>
<div class="primary">
<h3><%=_Encoded("Page Content") %></h3>
<%-- todo: (heskew) change the editors to be self-contained (fieldset > editor) --%>
@@ -45,6 +45,6 @@
<input class="delete button" type="submit" name="submit.DeleteDraft" value="Delete Draft" <%=Model.CanDeleteDraft ? "" : "disabled" %>/>
</fieldset>
</div>
<%}/*EndForm*/%>
<% } %>
</div>
<% Html.Include("Foot"); %>

View File

@@ -1,5 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Web.Mvc;
using Orchard.Utility;
@@ -30,5 +33,56 @@ namespace Orchard.Mvc.Html {
return MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
}
#region UnorderedList
public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass) {
return htmlHelper.UnorderedList(items, generateContent, cssClass, null, (string)null);
}
public static string UnorderedList<T>(this HtmlHelper htmlHelper, IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass, string itemCssClass, string alternatingItemCssClass) {
return UnorderedList(items, generateContent, cssClass, t => itemCssClass, t => alternatingItemCssClass);
}
private static string UnorderedList<T>(IEnumerable<T> items, Func<T, int, string> generateContent, string cssClass, Func<T, string> generateItemCssClass, Func<T, string> generateAlternatingItemCssClass) {
if (items == null || items.Count() == 0) return "";
var sb = new StringBuilder(250);
int counter = 0, count = items.Count() - 1;
sb.AppendFormat(
!string.IsNullOrEmpty(cssClass) ? "<ul class=\"{0}\">" : "<ul>",
cssClass
);
foreach (var item in items) {
var sbClass = new StringBuilder(50);
if (counter == 0)
sbClass.Append("first ");
if (counter == count)
sbClass.Append("last ");
if (generateItemCssClass != null)
sbClass.AppendFormat("{0} ", generateItemCssClass(item));
if (counter % 2 != 0 && generateAlternatingItemCssClass != null)
sbClass.AppendFormat("{0} ", generateAlternatingItemCssClass(item));
sb.AppendFormat(
sbClass.Length > 0
? string.Format("<li class=\"{0}\">{{0}}</li>", sbClass.ToString().TrimEnd())
: "<li>{0}</li>",
generateContent(item, counter)
);
counter++;
}
sb.Append("</ul>");
return sb.ToString();
}
#endregion
}
}