From f3854ddbb633056c2fefa6e33b53b070eeccbbb5 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 14 Jul 2010 22:39:26 -0700 Subject: [PATCH 1/4] Getting the blogs admin UI back up and running --HG-- branch : dev --- .../Modules/Orchard.Blogs/Controllers/BlogAdminController.cs | 2 -- .../Modules/Orchard.Blogs/Handlers/BlogHandler.cs | 2 -- .../ContentManagement/Drivers/ContentItemTemplateResult.cs | 5 +++++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs index 027c5f5cc..d35aa02c0 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs @@ -1,4 +1,3 @@ -using System; using System.Linq; using System.Web.Mvc; using JetBrains.Annotations; @@ -8,7 +7,6 @@ using Orchard.Blogs.Models; using Orchard.Blogs.Services; using Orchard.Blogs.ViewModels; using Orchard.ContentManagement; -using Orchard.Core.Common.Models; using Orchard.Localization; using Orchard.Mvc.Results; using Orchard.Settings; diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogHandler.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogHandler.cs index 586b32414..0ed267507 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogHandler.cs @@ -2,7 +2,6 @@ using JetBrains.Annotations; using Orchard.Blogs.Drivers; using Orchard.Blogs.Models; using Orchard.ContentManagement.Handlers; -using Orchard.Core.Common.Models; using Orchard.Core.Routable.Models; using Orchard.Data; @@ -11,7 +10,6 @@ namespace Orchard.Blogs.Handlers { public class BlogHandler : ContentHandler { public BlogHandler(IRepository repository) { Filters.Add(new ActivatingFilter(BlogDriver.ContentType.Name)); - Filters.Add(new ActivatingFilter(BlogDriver.ContentType.Name)); Filters.Add(new ActivatingFilter(BlogDriver.ContentType.Name)); Filters.Add(StorageFilter.For(repository)); } diff --git a/src/Orchard/ContentManagement/Drivers/ContentItemTemplateResult.cs b/src/Orchard/ContentManagement/Drivers/ContentItemTemplateResult.cs index 11eebb603..024e92571 100644 --- a/src/Orchard/ContentManagement/Drivers/ContentItemTemplateResult.cs +++ b/src/Orchard/ContentManagement/Drivers/ContentItemTemplateResult.cs @@ -12,6 +12,11 @@ namespace Orchard.ContentManagement.Drivers { public string TemplateName { get; set; } public override void Apply(BuildDisplayModelContext context) { + //todo: (heskew)evaluate - for lack of having access to the full context in a driver to conditionally return results (e.g. BlogDriver item display is otherwise being overriden by the ContentPartDriver) + if (!string.IsNullOrWhiteSpace(context.ViewModel.TemplateName) + && context.ViewModel.GetType() != typeof(ContentItemViewModel)) + return; + context.ViewModel.TemplateName = TemplateName; if (context.ViewModel.GetType() != typeof(ContentItemViewModel)) { context.ViewModel.Adaptor = (html, viewModel) => { From 5345d9ae812c02e97ead7f314e841bc8cc5d8163 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 14 Jul 2010 22:49:50 -0700 Subject: [PATCH 2/4] Showing blog post draft count in the admin blog summary --HG-- branch : dev --- src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/List.ascx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/List.ascx b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/List.ascx index 1ee490df0..d42338709 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/List.ascx +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/BlogAdmin/List.ascx @@ -12,7 +12,7 @@ if (Model.Entries.Count() > 0) { %> int totalPostCount = entry.TotalPostCount; var linkText = T.Plural("1 post", "{0} posts", totalPostCount).ToString(); - if (draftCount==0){ + if (draftCount > 0){ linkText = linkText + " (" + T.Plural("1 draft", "{0} drafts", draftCount).ToString() + ")"; } From dbb9b4eb3feb5ece49399e41f82ae50c3e298c46 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Wed, 14 Jul 2010 23:03:46 -0700 Subject: [PATCH 3/4] Getting the routable container path to show up when creating a new content item --HG-- branch : dev --- src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs index fbbefb304..27839f6bb 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs @@ -59,6 +59,9 @@ namespace Orchard.Core.Routable.Drivers { if (path != null && path.EndsWith(part.Slug)) { model.DisplayLeadingPath = path.Substring(0, path.Length - part.Slug.Length); } + else { + model.DisplayLeadingPath = GetContainerSlug(part) + "/"; + } return ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "before.5"); } From 22b417234165781c92bedc30dcb3734dfbf56a0e Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Thu, 15 Jul 2010 09:50:39 -0700 Subject: [PATCH 4/4] Fixing the routable part editor container path for new items w/out a container (rememoved extra "/") --HG-- branch : dev --- src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs | 5 ++++- .../Views/EditorTemplates/Parts/Routable.IsRoutable.ascx | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs index 27839f6bb..50db3646b 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutableDriver.cs @@ -60,7 +60,10 @@ namespace Orchard.Core.Routable.Drivers { model.DisplayLeadingPath = path.Substring(0, path.Length - part.Slug.Length); } else { - model.DisplayLeadingPath = GetContainerSlug(part) + "/"; + var containerSlug = GetContainerSlug(part); + model.DisplayLeadingPath = !string.IsNullOrWhiteSpace(containerSlug) + ? string.Format("{0}/", containerSlug) + : ""; } return ContentPartTemplate(model, TemplateName, Prefix).Location("primary", "before.5"); diff --git a/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.IsRoutable.ascx b/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.IsRoutable.ascx index f718e1121..788b780b3 100644 --- a/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.IsRoutable.ascx +++ b/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.IsRoutable.ascx @@ -1,6 +1,5 @@ <%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> <%@ Import Namespace="Orchard.Utility.Extensions"%> -<%@ Import Namespace="Orchard.ContentManagement.Extenstions"%> <% Html.RegisterFootScript("jquery.slugify.js"); %>