Some work on /tags views

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4043380
This commit is contained in:
skewed
2009-12-07 15:50:14 +00:00
parent 594526e4c6
commit 9f4b2e693c
13 changed files with 79 additions and 105 deletions

View File

@@ -666,7 +666,6 @@ todo: (heskew) pull out into relevant modules where appropriate
width:70%;
}
/* todo: (heskew) needs attention */
/* Extensions;
----------------------------------------------------------*/

View File

@@ -397,4 +397,60 @@ form.comments label {
form.comments .button {
margin-top:15px;
}
}
/* Tag cloud
----------------------------------------------------------*/
ul.tagCloud {
padding:0;
}
ul.tagCloud li {
display:inline;
list-style-type:none;
padding:5px 15px 5px 0;
}
/* Content item lists
----------------------------------------------------------*/
.contentItems {
background:#FFF;
margin:1.4em 0;
padding:2px;
}
.contentItems li {
background:#FFF;
border-bottom:1px solid #E0E8EF;
margin:0;
overflow:hidden;
padding:.7em 0;
}
.contentItems li.last {
border-bottom:0;
}
.contentItems li h3 {
border-bottom:0;
}
.contentItems li.first h3 {
margin-top:0;
}
.contentItems li .actions {
color:#EAE9D9;
height:auto;
margin:-1.3em 0 0;
padding:0 0 .1em;
}
.contentItems li .actions .ibutton {
margin-right:6px;
}
.contentItems li .actions .destruct .ibutton {
margin-left:8px;
margin-right:0;
}
.contentItems li:hover { background:#fafbed; }
.contentItems li:hover a.ibutton { background-position:0 0; }
.contentItems li:hover a.ibutton.remove { background-position:-20px 0; }
.contentItems li:hover a.ibutton.view { background-position:-40px 0; }
.contentItems li:hover a.ibutton.add.page { background-position:-60px 0; }
.contentItems li:hover a.ibutton.edit { background-position:-80px 0; }
.contentItems li:hover a.ibutton.publish { background-position:-100px 0; }
.contentItems li:hover a.ibutton.blog { background-position:-120px 0; }

View File

@@ -171,7 +171,6 @@
<Content Include="Content\Images\headerBackground.gif" />
<Content Include="Content\Images\header_background.gif" />
<Content Include="Content\Images\innerheader_background.gif" />
<Content Include="Content\Images\NavBackground.gif" />
<Content Include="Content\Images\nav_background.gif" />
<Content Include="Content\Images\title_background.gif" />
<Content Include="Content\Site2.css" />

View File

@@ -4,6 +4,7 @@ using Orchard.Core.Common.Models;
using Orchard.Data;
using Orchard.Models;
using Orchard.Models.Driver;
using Orchard.Models.ViewModels;
namespace Orchard.Blogs.Models {
public class BlogPostProvider : ContentProvider {
@@ -17,8 +18,7 @@ namespace Orchard.Blogs.Models {
Filters.Add(new ActivatingFilter<RoutableAspect>("blogpost"));
Filters.Add(new ActivatingFilter<BodyAspect>("blogpost"));
Filters.Add(new StorageFilter<BlogPostRecord>(repository));
Filters.Add(new ContentItemTemplates<BlogPost>("BlogPost", "Summary"));
Filters.Add(new ContentItemTemplates<BlogPost>("BlogPost", "ForList"));
OnLoaded<BlogPost>((context, bp) => bp.Blog = contentManager.Get<Blog>(bp.Record.Blog.Id));

View File

@@ -103,14 +103,14 @@
<Content Include="Package.txt" />
<Content Include="Views\BlogPost\Create.aspx" />
<Content Include="Views\BlogPost\Edit.aspx" />
<Content Include="Views\Models\BlogPost\Summary.ascx" />
<Content Include="Views\BlogPost\EditorTemplates\BlogPostEditViewModel.ascx" />
<Content Include="Views\Blog\DisplayTemplates\BlogForAdminViewModel.ascx" />
<Content Include="Views\Blog\ItemForAdmin.aspx" />
<Content Include="Views\Blog\DisplayTemplates\BlogsForAdminViewModel.ascx" />
<Content Include="Views\Blog\DisplayTemplates\BlogForAdmin.ascx" />
<Content Include="Views\Blog\List.aspx" />
<Content Include="Views\Blog\ListForAdmin.aspx" />
<Content Include="Views\Models\DisplayTemplates\BlogPostSummary.ascx" />
<Content Include="Views\Models\DisplayTemplates\BlogPostForList.ascx" />
<Content Include="Views\Shared\BlogPostPreview.ascx" />
<Content Include="Views\BlogPost\EditorTemplates\CreateBlogPostViewModel.ascx" />
<Content Include="Views\BlogPost\Item.aspx" />
@@ -141,9 +141,6 @@
<Name>Orchard.Users</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Views\Models\EditorTemplates\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,21 +0,0 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Orchard.Blogs.ViewModels.CreateBlogViewModel>" %>
<%@ Import Namespace="Orchard.Security" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<% Html.Include("Header"); %>
<div class="yui-u">
<h2 class="separator">
Add a new Blog</h2>
</div>
<div class="yui-u">
<%using (Html.BeginForm()) { %>
<ol>
<%= Html.ValidationSummary() %>
<%= Html.EditorForModel() %>
<li class="clearLayout">
<input class="button" type="submit" value="Create" />
<%=Html.ActionLink("Cancel", "Index", new{}, new{@class="button"}) %></li>
</ol>
<%}/*EndForm*/%>
</div>
<% Html.Include("Footer"); %>

View File

@@ -1,8 +0,0 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<AdminViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<% Html.Include("Header"); %>
<div class="yui-g">
<h2>Blogs Admin</h2>
</div>
<% Html.Include("Footer"); %>

View File

@@ -12,7 +12,7 @@
<p class="actions">
<%-- todo: (heskew) make into a ul --%>
<span class="construct">
<a href="<%=Url.BlogEdit(Model.Slug) %>" class="ibutton blog" title="Manage Blog">Manage Blog</a>
<a href="<%=Url.BlogForAdmin(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.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>

View File

@@ -1,24 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ItemDisplayViewModel>" %>
<%@ Import Namespace="Orchard.Models"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<%@ Import Namespace="Orchard.Models.ViewModels"%>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<!-- HACK: (erikpo) Need to figure out how to make the model of the partial be templated -->
<% BlogPost model = Model.Item.As<BlogPost>(); %>
<h3><a href="<%=Url.BlogPost(model.Blog.Slug, model.Slug) %>"><%=Html.Encode(model.Title) %></a></h3>
<div class="meta">
<%=Html.PublishedState(model) %>
| <a href="#">?? comments</a>
</div>
<div class="content"><%=model.Body ?? "<p><em>there's no content for this blog post</em></p>" %></div>
<%--<p class="actions">
<span class="construct">
<a href="<%=Url.BlogPostEdit(model.Blog.Slug, model.Slug) %>" class="ibutton edit" title="Edit Post">Edit Post</a>
<a href="<%=Url.BlogPost(model.Blog.Slug, model.Slug) %>" class="ibutton view" title="View Post">View Post</a><%
if (model.Published == null) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^ %>
<a href="<%=Url.BlogPost(model.Blog.Slug, model.Slug) %>" class="ibutton publish" title="Publish Post Now">Publish Post Now</a>
<% } %>
</span>
<span class="destruct"><a href="#" class="ibutton remove" title="Remove Post">Remove Post</a></span>
</p>--%>

View File

@@ -1,22 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<ItemDisplayViewModel<BlogPost>>" %>
<%@ Import Namespace="Orchard.Models"%>
<%@ Import Namespace="Orchard.Blogs.Models"%>
<%@ Import Namespace="Orchard.Models.ViewModels"%>
<%@ Import Namespace="Orchard.Blogs.Extensions"%>
<%@ Import Namespace="Orchard.Blogs.ViewModels"%>
<h3><a href="<%=Url.BlogPost(Model.Item.Blog.Slug, Model.Item.Slug) %>"><%=Html.Encode(Model.Item.Title)%></a></h3>
<div class="meta">
<%=Html.PublishedState(Model.Item)%>
| <a href="#">?? comments</a>
</div>
<div class="content"><%=Model.Item.Body ?? "<p><em>there's no content for this blog post</em></p>"%></div>
<%--<p class="actions">
<span class="construct">
<a href="<%=Url.BlogPostEdit(model.Blog.Slug, model.Slug) %>" class="ibutton edit" title="Edit Post">Edit Post</a>
<a href="<%=Url.BlogPost(model.Blog.Slug, model.Slug) %>" class="ibutton view" title="View Post">View Post</a><%
if (model.Published == null) { // todo: (heskew) be smart about this and maybe have other contextual actions - including view/preview for view up there ^^ %>
<a href="<%=Url.BlogPost(model.Blog.Slug, model.Slug) %>" class="ibutton publish" title="Publish Post Now">Publish Post Now</a>
<% } %>
</span>
<span class="destruct"><a href="#" class="ibutton remove" title="Remove Post">Remove Post</a></span>
</p>--%>

View File

@@ -99,14 +99,14 @@ namespace Orchard.Tags.Controllers {
public ActionResult Search(string tagName) {
try {
Tag tag = _tagService.GetTagByName(tagName);
var contentItems = _tagService.GetTaggedContentItems(tag.Id);
var contentViewModels = contentItems.Select(
item => _contentManager.GetDisplayViewModel(item, null, "Summary"));
var tag = _tagService.GetTagByName(tagName);
var items =
_tagService.GetTaggedContentItems(tag.Id).Select(
ic => _contentManager.GetDisplayViewModel(ic, null, "ForList"));
var viewModel = new TagsSearchViewModel {
TagName = tag.TagName,
Items = contentViewModels.ToList(),
Items = items.ToList()
};
return View(viewModel);

View File

@@ -4,9 +4,14 @@
<%-- todo: (heskew) make master-less when we get into theming --%>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<h2>Tags</h2>
<%=Html.ValidationSummary() %>
<% foreach (var tag in Model.Tags) { %>
<%=Html.ActionLink(tag.TagName, "Search", new {tagName = tag.TagName}, new {@class="floatRight topSpacer"}) %>
&nbsp;
<% } %>
<%=Html.UnorderedList(
Model.Tags,
(t, i) => Html.ActionLink(
t.TagName,
"Search",
new { tagName = t.TagName },
new { @class = "" /* todo: (heskew) classify according to tag use */ }
).ToHtmlString(),
"tagCloud")
%>
</asp:Content>

View File

@@ -4,13 +4,6 @@
<%@ Import Namespace="Orchard.Mvc.Html"%>
<%-- todo: (heskew) make master-less when we get into theming --%>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<h2>List of contents tagged with <%= Model.TagName %></h2>
<!-- TODO: (erikpo) The class being used for the lists "posts" should be made into something more generic like "contentItems" for the front end -->
<%foreach(var item in Model.Items) {%>
<%= Html.DisplayForItem(m=>item) %>
<%}%>
<%--<%=Html.UnorderedList(Model.Items, (c, i) => Html.ItemDisplayTemplate(c, "Summary").ToHtmlString(), "posts")%>--%>
<h2>List of contents tagged with <em><%= Model.TagName %></em></h2>
<%=Html.UnorderedList(Model.Items, (c, i) => Html.DisplayForItem(x=>c).ToHtmlString(), "contentItems") %>
</asp:Content>