Disabling the Orchard.Pages module by default and adjusted the page content type configured during setup to be a page-like content type.

- also added a RoutableHomePageProvider to support a routable item as the home page

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-13 17:19:08 -07:00
parent 5bf2be1e19
commit 4c7973e2ce
2 changed files with 46 additions and 3 deletions

View File

@@ -0,0 +1,44 @@
using System.Web.Mvc;
using JetBrains.Annotations;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Routable.Models;
using Orchard.Core.Routable.ViewModels;
using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.Services;
using Orchard.ContentManagement;
namespace Orchard.Core.Routable.Services {
[UsedImplicitly]
public class RoutableHomePageProvider : IHomePageProvider {
private readonly IContentManager _contentManager;
public RoutableHomePageProvider(IOrchardServices services, IContentManager contentManager) {
_contentManager = contentManager;
Services = services;
T = NullLocalizer.Instance;
}
public IOrchardServices Services { get; private set; }
public Localizer T { get; set; }
public string GetProviderName() {
return "RoutableHomePageProvider";
}
public ActionResult GetHomePage(int itemId) {
var contentItem = _contentManager.Get(itemId, VersionOptions.Published);
if (contentItem == null || !contentItem.Is<IsRoutable>())
return new NotFoundResult();
var model = new RoutableDisplayViewModel {
Routable = _contentManager.BuildDisplayModel<IRoutableAspect>(contentItem.As<IsRoutable>(), "Detail")
};
return new ViewResult {
ViewName = "~/Core/Routable/Views/Item/Display.ascx",
ViewData = new ViewDataDictionary<RoutableDisplayViewModel>(model)
};
}
}
}