mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Changed rendering of content items by tag page to look for templates by content type and a template name. Also changed admin link on front end to (temporarily) point to manage blogs page in admin.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4043360
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
<Content Include="Package.txt" />
|
||||
<Content Include="Views\BlogPost\Create.aspx" />
|
||||
<Content Include="Views\BlogPost\Edit.aspx" />
|
||||
<Content Include="Views\BlogPost\EditorTemplates\BlogPostEditViewModel.ascx" />
|
||||
<Content Include="Views\Models\BlogPost\Summary.ascx" />
|
||||
<Content Include="Views\Blog\DisplayTemplates\BlogForAdminViewModel.ascx" />
|
||||
<Content Include="Views\Blog\ItemForAdmin.aspx" />
|
||||
<Content Include="Views\Blog\DisplayTemplates\BlogsForAdminViewModel.ascx" />
|
||||
|
@@ -0,0 +1,24 @@
|
||||
<%@ 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>--%>
|
@@ -4,8 +4,7 @@
|
||||
<%@ 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><%
|
||||
foreach (var contentItem in Model.Contents) { %>
|
||||
<%=Html.ItemDisplayLink(contentItem)%>
|
||||
<% } %>
|
||||
<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 -->
|
||||
<%=Html.UnorderedList(Model.Contents, (c, i) => Html.ItemDisplayTemplate(c, "Summary").ToHtmlString(), "posts")%>
|
||||
</asp:Content>
|
@@ -5,6 +5,6 @@
|
||||
<li><%= Html.ActionLink("Home", "Index", "Home", new {Area = ""}, new {})%></li>
|
||||
<li><%= Html.ActionLink("About", "About", "Home", new {Area = ""}, new {})%></li>
|
||||
<li><%= Html.ActionLink("Blogs", "List", "Blog", new {Area = "Orchard.Blogs"}, new {})%></li>
|
||||
<li><%= Html.ActionLink("Admin", "Index", new {Area = "Orchard.CMSPages", Controller = "Admin"})%></li>
|
||||
<li><%= Html.ActionLink("Admin", "ListForAdmin", new {Area = "Orchard.Blogs", Controller = "Blog"})%></li>
|
||||
</ul>
|
||||
</div>
|
@@ -17,6 +17,10 @@ namespace Orchard.Models.ViewModels {
|
||||
Item = viewModel.Item;
|
||||
}
|
||||
|
||||
public ItemDisplayViewModel(ContentItem item) {
|
||||
Item = item;
|
||||
}
|
||||
|
||||
public ContentItem Item {
|
||||
get { return _item; }
|
||||
set { SetItem(value); }
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
using Orchard.Models;
|
||||
using Orchard.Models.ViewModels;
|
||||
|
||||
namespace Orchard.Mvc.Html {
|
||||
public static class ContentItemExtensions {
|
||||
@@ -42,5 +43,9 @@ namespace Orchard.Mvc.Html {
|
||||
public static MvcHtmlString ItemEditLink(this HtmlHelper html, IContent content) {
|
||||
return ItemEditLink(html, null, content);
|
||||
}
|
||||
|
||||
public static MvcHtmlString ItemDisplayTemplate(this HtmlHelper html, IContent content, string template) {
|
||||
return html.Partial(string.Format("{0}/{1}", content.ContentItem.ContentType, template), new ItemDisplayViewModel(content.ContentItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user