mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Some setup work
- renamed Index POST to IndexPOST and returning Index(model) on failure - taking a dependence on the Comments module and flipping CommentsShown on the home page that's created in setup - redirecting to ~/ on successful setup - removing the remaining views (home) from Orchard.Web - updating the slug constraint to cope with a null slug --HG-- branch : dev
This commit is contained in:
@@ -42,6 +42,9 @@ namespace Orchard.Pages.Services {
|
||||
|
||||
public string LookupPublishedSlug(string slug) {
|
||||
lock (_syncLock) {
|
||||
if (slug == null)
|
||||
return "";
|
||||
|
||||
string actual;
|
||||
if (_currentlyPublishedSlugs.TryGetValue(slug, out actual))
|
||||
return actual;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Comments.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Settings.Models;
|
||||
@@ -29,15 +30,15 @@ namespace Orchard.Setup.Controllers {
|
||||
|
||||
private Localizer T { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
return View(new SetupViewModel { AdminUsername = "admin" });
|
||||
public ActionResult Index(SetupViewModel model) {
|
||||
return View(model ?? new SetupViewModel { AdminUsername = "admin" });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Index(SetupViewModel model) {
|
||||
[HttpPost, ActionName("Index")]
|
||||
public ActionResult IndexPOST(SetupViewModel model) {
|
||||
try {
|
||||
if (!ModelState.IsValid) {
|
||||
return View(model);
|
||||
return Index(model);
|
||||
}
|
||||
|
||||
// initialize the database:
|
||||
@@ -67,8 +68,9 @@ namespace Orchard.Setup.Controllers {
|
||||
// create home page as a CMS page
|
||||
var page = contentManager.Create("page");
|
||||
page.As<BodyAspect>().Text = "Welcome to Orchard";
|
||||
page.As<RoutableAspect>().Slug = "home";
|
||||
page.As<RoutableAspect>().Slug = "";
|
||||
page.As<RoutableAspect>().Title = model.SiteName;
|
||||
page.As<HasComments>().CommentsShown = false;
|
||||
contentManager.Publish(page);
|
||||
|
||||
var authenticationService = finiteEnvironment.Resolve<IAuthenticationService>();
|
||||
@@ -78,11 +80,11 @@ namespace Orchard.Setup.Controllers {
|
||||
_notifier.Information(T("Setup succeeded"));
|
||||
|
||||
// redirect to the welcome page.
|
||||
return Redirect("~/home");
|
||||
return Redirect("~/");
|
||||
}
|
||||
catch (Exception exception) {
|
||||
_notifier.Error(T("Setup failed: " + exception.Message));
|
||||
return RedirectToAction("Index");
|
||||
return Index(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -83,6 +83,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Comments\Orchard.Comments.csproj">
|
||||
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||
<Name>Orchard.Comments</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
|
Reference in New Issue
Block a user