diff --git a/Orchard.proj b/Orchard.proj
index a68d2afa3..b907eb655 100644
--- a/Orchard.proj
+++ b/Orchard.proj
@@ -69,7 +69,7 @@
-
+
@@ -126,7 +126,7 @@
-
+
@@ -293,10 +293,18 @@
+
+
-
+
+
+
+
+
@@ -307,7 +315,6 @@
-
diff --git a/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs b/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs
index 62493aaab..c696c8b75 100644
--- a/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs
+++ b/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs
@@ -46,7 +46,7 @@ namespace Orchard.Core.Tests.Routable.Services {
builder.RegisterInstance(new Mock().Object);
builder.RegisterInstance(new Mock().Object);
builder.RegisterType().As();
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterType().As();
builder.RegisterType().As();
diff --git a/src/Orchard.Profile/Tests/Profiling.feature b/src/Orchard.Profile/Tests/Profiling.feature
index 267b90d37..cadf674cb 100644
--- a/src/Orchard.Profile/Tests/Profiling.feature
+++ b/src/Orchard.Profile/Tests/Profiling.feature
@@ -22,5 +22,8 @@ Scenario: Hitting blogs
When I go to "/blog4" 10 times
Scenario: Hitting home page
- Given I am logged in
- When I go to "/" 40 times
+ //Given I am logged in
+ When I go to "/" 10 times
+ When I go to "/" 10 times
+ When I go to "/" 10 times
+ When I go to "/" 10 times
diff --git a/src/Orchard.Profile/Tests/Profiling.feature.cs b/src/Orchard.Profile/Tests/Profiling.feature.cs
index ae57373ee..75bb2fb49 100644
--- a/src/Orchard.Profile/Tests/Profiling.feature.cs
+++ b/src/Orchard.Profile/Tests/Profiling.feature.cs
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
//
// This code was generated by SpecFlow (http://www.specflow.org/).
-// SpecFlow Version:1.3.2.0
+// SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
@@ -9,12 +9,12 @@
//
// ------------------------------------------------------------------------------
#region Designer generated code
-namespace Orchard.Specs.Le.Tests
+namespace Orchard.Profile.Tests
{
using TechTalk.SpecFlow;
- [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Profiling")]
@@ -31,7 +31,7 @@ namespace Orchard.Specs.Le.Tests
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Profiling", "In order to profile the site\r\nAs a developer\r\nI want to generate a fixed number o" +
- "f repeatable requests", ((string[])(null)));
+ "f repeatable requests", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -61,13 +61,13 @@ namespace Orchard.Specs.Le.Tests
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
-testRunner.Given("I am logged in");
+ testRunner.Given("I am logged in");
#line 8
-testRunner.When("I go to \"/admin\"");
+ testRunner.When("I go to \"/admin\"");
#line 9
-testRunner.When("I go to \"/blog0\"");
+ testRunner.When("I go to \"/blog0\"");
#line 10
-testRunner.When("I go to \"/\"");
+ testRunner.When("I go to \"/\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -80,9 +80,9 @@ testRunner.When("I go to \"/\"");
#line 12
this.ScenarioSetup(scenarioInfo);
#line 13
-testRunner.Given("I am logged in");
+ testRunner.Given("I am logged in");
#line 14
-testRunner.When("I go to \"/admin\" 40 times");
+ testRunner.When("I go to \"/admin\" 40 times");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -95,17 +95,17 @@ testRunner.When("I go to \"/admin\" 40 times");
#line 16
this.ScenarioSetup(scenarioInfo);
#line 17
-testRunner.Given("I am logged in");
+ testRunner.Given("I am logged in");
#line 18
-testRunner.When("I go to \"/blog0\" 10 times");
+ testRunner.When("I go to \"/blog0\" 10 times");
#line 19
-testRunner.When("I go to \"/blog1\" 10 times");
+ testRunner.When("I go to \"/blog1\" 10 times");
#line 20
-testRunner.When("I go to \"/blog2\" 10 times");
+ testRunner.When("I go to \"/blog2\" 10 times");
#line 21
-testRunner.When("I go to \"/blog3\" 10 times");
+ testRunner.When("I go to \"/blog3\" 10 times");
#line 22
-testRunner.When("I go to \"/blog4\" 10 times");
+ testRunner.When("I go to \"/blog4\" 10 times");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -117,10 +117,14 @@ testRunner.When("I go to \"/blog4\" 10 times");
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Hitting home page", ((string[])(null)));
#line 24
this.ScenarioSetup(scenarioInfo);
-#line 25
-testRunner.Given("I am logged in");
#line 26
-testRunner.When("I go to \"/\" 40 times");
+ testRunner.When("I go to \"/\" 10 times");
+#line 27
+ testRunner.When("I go to \"/\" 10 times");
+#line 28
+ testRunner.When("I go to \"/\" 10 times");
+#line 29
+ testRunner.When("I go to \"/\" 10 times");
#line hidden
testRunner.CollectScenarioErrors();
}
diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
index 972750f32..d9fde2601 100644
--- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
+++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs
@@ -17,11 +17,12 @@ namespace Orchard.Specs.Bindings {
public void GivenIHaveInstalledOrchard(string virtualDirectory) {
var webApp = Binding();
- webApp.GivenIHaveACleanSiteWith(TableData(
+ webApp.GivenIHaveACleanSiteWith(
+ virtualDirectory,
+ TableData(
new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
- new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }),
- virtualDirectory);
+ new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
webApp.WhenIGoTo("Setup");
diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs
index ce2712f31..5d8d009d7 100644
--- a/src/Orchard.Specs/Bindings/WebAppHosting.cs
+++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs
@@ -74,7 +74,7 @@ namespace Orchard.Specs.Bindings {
GivenIHaveACleanSiteBasedOn(siteFolder, "/");
}
- [Given(@"I have a clean site based on (.*) at ""(.*)\""")]
+ [Given(@"I have a clean site based on (.*) at ""(.*)""")]
public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory) {
_webHost = new WebHost(_orchardTemp);
Host.Initialize(siteFolder, virtualDirectory ?? "/");
@@ -129,7 +129,13 @@ namespace Orchard.Specs.Bindings {
}
[Given(@"I have a clean site with")]
- public void GivenIHaveACleanSiteWith(Table table, string virtualDirectory = "/") {
+ public void GivenIHaveACleanSiteWith(Table table) {
+ GivenIHaveACleanSiteWith("/", table);
+ }
+
+
+ [Given(@"I have a clean site at ""(.*)"" with")]
+ public void GivenIHaveACleanSiteWith(string virtualDirectory, Table table) {
GivenIHaveACleanSite(virtualDirectory);
foreach (var row in table.Rows) {
foreach (var name in row["names"].Split(',').Select(x => x.Trim())) {
@@ -207,6 +213,23 @@ namespace Orchard.Specs.Bindings {
else if (radio.Attributes.Contains("checked"))
radio.Attributes.Remove("checked");
}
+ break;
+ case "checkbox":
+ if (string.Equals(row["value"], "true", StringComparison.OrdinalIgnoreCase)) {
+ input.Attributes.Add("checked", "checked");
+ }
+ else {
+ input.Attributes.Remove("checked");
+ }
+
+ var hiddenForCheckbox = inputs.Where(
+ x =>
+ x.GetAttributeValue("type", "") == "hidden" &&
+ x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]
+ ).FirstOrDefault();
+ if (hiddenForCheckbox != null)
+ hiddenForCheckbox.Attributes.Add("value", row["value"]);
+
break;
default:
input.Attributes.Add("value", row["value"]);
diff --git a/src/Orchard.Specs/Pages.feature b/src/Orchard.Specs/Pages.feature
index e0cae236d..67a810400 100644
--- a/src/Orchard.Specs/Pages.feature
+++ b/src/Orchard.Specs/Pages.feature
@@ -39,4 +39,30 @@ Scenario: If I create a page which gets a conflicting path generated its path is
And I hit "Publish Now"
And I go to "super-duper-2"
Then I should see "
]*>.*?Super Duper.*?
"
- And I should see "This is super number two."
\ No newline at end of file
+ And I should see "This is super number two."
+
+Scenario: A new page marked to be the home page and publish does take over the home page and is not accessible from its own standard path.
+ Given I have installed Orchard
+ When I go to "admin/contents/create/page"
+ And I fill in
+ | name | value |
+ | Routable.Title | Super Duper |
+ | Body.Text | This is a draft of the new home page. |
+ | Routable.PromoteToHomePage | true |
+ And I hit "Publish Now"
+ And I go to "/Default.aspx"
+ Then I should see "
Super Duper
"
+ When I go to "super-duper"
+ Then the status should be 404 "Not Found"
+
+Scenario: A new page marked to be the home page but only saved as draft does not take over the home page
+ Given I have installed Orchard
+ When I go to "admin/contents/create/page"
+ And I fill in
+ | name | value |
+ | Routable.Title | Drafty |
+ | Body.Text | This is a draft of the new home page. |
+ | Routable.PromoteToHomePage | true |
+ And I hit "Save"
+ And I go to "/Default.aspx"
+ Then I should see "
Welcome to Orchard!
"
diff --git a/src/Orchard.Specs/Pages.feature.cs b/src/Orchard.Specs/Pages.feature.cs
index 1056c3b64..922fb3968 100644
--- a/src/Orchard.Specs/Pages.feature.cs
+++ b/src/Orchard.Specs/Pages.feature.cs
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
//
// This code was generated by SpecFlow (http://www.specflow.org/).
-// SpecFlow Version:1.3.2.0
+// SpecFlow Version:1.4.0.0
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
@@ -14,7 +14,7 @@ namespace Orchard.Specs
using TechTalk.SpecFlow;
- [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Pages")]
@@ -31,7 +31,7 @@ namespace Orchard.Specs
{
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Pages", "In order to add content pages to my site\r\nAs an author\r\nI want to create, publish" +
- " and edit pages", ((string[])(null)));
+ " and edit pages", GenerationTargetLanguage.CSharp, ((string[])(null)));
testRunner.OnFeatureStart(featureInfo);
}
@@ -61,11 +61,11 @@ namespace Orchard.Specs
#line 6
this.ScenarioSetup(scenarioInfo);
#line 7
-testRunner.Given("I have installed Orchard");
+ testRunner.Given("I have installed Orchard");
#line 8
-testRunner.When("I go to \"admin\"");
+ testRunner.When("I go to \"admin\"");
#line 9
-testRunner.Then("I should see \"Page\"");
+ testRunner.Then("I should see \"Page\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -78,9 +78,9 @@ testRunner.Then("I should see \"Page
#line 11
this.ScenarioSetup(scenarioInfo);
#line 12
-testRunner.Given("I have installed Orchard");
+ testRunner.Given("I have installed Orchard");
#line 13
-testRunner.When("I go to \"admin/contents/create/page\"");
+ testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -92,15 +92,15 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super."});
#line 14
-testRunner.And("I fill in", ((string)(null)), table1);
+ testRunner.And("I fill in", ((string)(null)), table1);
#line 18
-testRunner.And("I hit \"Publish Now\"");
+ testRunner.And("I hit \"Publish Now\"");
#line 19
-testRunner.And("I go to \"super-duper\"");
+ testRunner.And("I go to \"super-duper\"");
#line 20
-testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
+ testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
#line 21
-testRunner.And("I should see \"This is super.\"");
+ testRunner.And("I should see \"This is super.\"");
#line hidden
testRunner.CollectScenarioErrors();
}
@@ -115,9 +115,9 @@ testRunner.And("I should see \"This is super.\"");
#line 23
this.ScenarioSetup(scenarioInfo);
#line 24
-testRunner.Given("I have installed Orchard");
+ testRunner.Given("I have installed Orchard");
#line 25
-testRunner.When("I go to \"admin/contents/create/page\"");
+ testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -129,17 +129,17 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super."});
#line 26
-testRunner.And("I fill in", ((string)(null)), table2);
+ testRunner.And("I fill in", ((string)(null)), table2);
#line 30
-testRunner.And("I hit \"Publish Now\"");
+ testRunner.And("I hit \"Publish Now\"");
#line 31
-testRunner.And("I go to \"super-duper\"");
+ testRunner.And("I go to \"super-duper\"");
#line 32
-testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
+ testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
#line 33
-testRunner.And("I should see \"This is super.\"");
+ testRunner.And("I should see \"This is super.\"");
#line 34
-testRunner.When("I go to \"admin/contents/create/page\"");
+ testRunner.When("I go to \"admin/contents/create/page\"");
#line hidden
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -151,15 +151,95 @@ testRunner.When("I go to \"admin/contents/create/page\"");
"Body.Text",
"This is super number two."});
#line 35
-testRunner.And("I fill in", ((string)(null)), table3);
+ testRunner.And("I fill in", ((string)(null)), table3);
#line 39
-testRunner.And("I hit \"Publish Now\"");
+ testRunner.And("I hit \"Publish Now\"");
#line 40
-testRunner.And("I go to \"super-duper-2\"");
+ testRunner.And("I go to \"super-duper-2\"");
#line 41
-testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
+ testRunner.Then("I should see \"
]*>.*?Super Duper.*?
\"");
#line 42
-testRunner.And("I should see \"This is super number two.\"");
+ testRunner.And("I should see \"This is super number two.\"");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("A new page marked to be the home page and publish does take over the home page an" +
+ "d is not accessible from its own standard path.")]
+ public virtual void ANewPageMarkedToBeTheHomePageAndPublishDoesTakeOverTheHomePageAndIsNotAccessibleFromItsOwnStandardPath_()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page and publish does take over the home page an" +
+ "d is not accessible from its own standard path.", ((string[])(null)));
+#line 44
+this.ScenarioSetup(scenarioInfo);
+#line 45
+ testRunner.Given("I have installed Orchard");
+#line 46
+ testRunner.When("I go to \"admin/contents/create/page\"");
+#line hidden
+ TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table4.AddRow(new string[] {
+ "Routable.Title",
+ "Super Duper"});
+ table4.AddRow(new string[] {
+ "Body.Text",
+ "This is a draft of the new home page."});
+ table4.AddRow(new string[] {
+ "Routable.PromoteToHomePage",
+ "true"});
+#line 47
+ testRunner.And("I fill in", ((string)(null)), table4);
+#line 52
+ testRunner.And("I hit \"Publish Now\"");
+#line 53
+ testRunner.And("I go to \"/Default.aspx\"");
+#line 54
+ testRunner.Then("I should see \"
Super Duper
\"");
+#line 55
+ testRunner.When("I go to \"super-duper\"");
+#line 56
+ testRunner.Then("the status should be 404 \"Not Found\"");
+#line hidden
+ testRunner.CollectScenarioErrors();
+ }
+
+ [NUnit.Framework.TestAttribute()]
+ [NUnit.Framework.DescriptionAttribute("A new page marked to be the home page but only saved as draft does not take over " +
+ "the home page")]
+ public virtual void ANewPageMarkedToBeTheHomePageButOnlySavedAsDraftDoesNotTakeOverTheHomePage()
+ {
+ TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("A new page marked to be the home page but only saved as draft does not take over " +
+ "the home page", ((string[])(null)));
+#line 58
+this.ScenarioSetup(scenarioInfo);
+#line 59
+ testRunner.Given("I have installed Orchard");
+#line 60
+ testRunner.When("I go to \"admin/contents/create/page\"");
+#line hidden
+ TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
+ "name",
+ "value"});
+ table5.AddRow(new string[] {
+ "Routable.Title",
+ "Drafty"});
+ table5.AddRow(new string[] {
+ "Body.Text",
+ "This is a draft of the new home page."});
+ table5.AddRow(new string[] {
+ "Routable.PromoteToHomePage",
+ "true"});
+#line 61
+ testRunner.And("I fill in", ((string)(null)), table5);
+#line 66
+ testRunner.And("I hit \"Save\"");
+#line 67
+ testRunner.And("I go to \"/Default.aspx\"");
+#line 68
+ testRunner.Then("I should see \"
Welcome to Orchard!
\"");
#line hidden
testRunner.CollectScenarioErrors();
}
diff --git a/src/Orchard.Tests/Environment/DefaultWorkContextAccessorTests.cs b/src/Orchard.Tests/Environment/DefaultWorkContextAccessorTests.cs
index 8edd2de91..5de77cf97 100644
--- a/src/Orchard.Tests/Environment/DefaultWorkContextAccessorTests.cs
+++ b/src/Orchard.Tests/Environment/DefaultWorkContextAccessorTests.cs
@@ -22,7 +22,7 @@ namespace Orchard.Tests.Environment {
}
protected override void Register(ContainerBuilder builder) {
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterAutoMocking();
}
diff --git a/src/Orchard.Tests/Environment/ShellBuilders/DefaultShellContextFactoryTests.cs b/src/Orchard.Tests/Environment/ShellBuilders/DefaultShellContextFactoryTests.cs
index 56a96df61..4857f4b72 100644
--- a/src/Orchard.Tests/Environment/ShellBuilders/DefaultShellContextFactoryTests.cs
+++ b/src/Orchard.Tests/Environment/ShellBuilders/DefaultShellContextFactoryTests.cs
@@ -21,7 +21,7 @@ namespace Orchard.Tests.Environment.ShellBuilders {
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterType().As();
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterAutoMocking(Moq.MockBehavior.Strict);
_container = builder.Build();
}
diff --git a/src/Orchard.Tests/Environment/State/DefaultProcessingEngineTests.cs b/src/Orchard.Tests/Environment/State/DefaultProcessingEngineTests.cs
index e35a2f401..d564bb24c 100644
--- a/src/Orchard.Tests/Environment/State/DefaultProcessingEngineTests.cs
+++ b/src/Orchard.Tests/Environment/State/DefaultProcessingEngineTests.cs
@@ -23,7 +23,7 @@ namespace Orchard.Tests.Environment.State {
public void Init() {
var builder = new ContainerBuilder();
builder.RegisterType().As();
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterAutoMocking();
_container = builder.Build();
diff --git a/src/Orchard.Tests/Localization/CultureManagerTests.cs b/src/Orchard.Tests/Localization/CultureManagerTests.cs
index 9d202c2d0..4a0d9e1ce 100644
--- a/src/Orchard.Tests/Localization/CultureManagerTests.cs
+++ b/src/Orchard.Tests/Localization/CultureManagerTests.cs
@@ -51,7 +51,7 @@ namespace Orchard.Tests.Localization {
builder.RegisterInstance(new Mock().Object);
builder.RegisterInstance(new Mock().Object);
builder.RegisterType().As();
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterType().As();
builder.RegisterType().As();
builder.RegisterType().As();
diff --git a/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs b/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs
index 80a99f72f..33bbfb968 100644
--- a/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs
+++ b/src/Orchard.Tests/Mvc/Routes/ShellRouteTests.cs
@@ -36,7 +36,7 @@ namespace Orchard.Tests.Mvc.Routes {
rootBuilder.Register(ctx => _routes);
rootBuilder.RegisterType().InstancePerDependency();
rootBuilder.RegisterType().As().SingleInstance();
- rootBuilder.RegisterType().As().InstancePerMatchingLifetimeScope("shell");
+ rootBuilder.RegisterType().As().InstancePerMatchingLifetimeScope("shell");
rootBuilder.RegisterType().As();
_rootContainer = rootBuilder.Build();
diff --git a/src/Orchard.Tests/Tasks/SweepGeneratorTests.cs b/src/Orchard.Tests/Tasks/SweepGeneratorTests.cs
index 9e0469631..9bb99fa08 100644
--- a/src/Orchard.Tests/Tasks/SweepGeneratorTests.cs
+++ b/src/Orchard.Tests/Tasks/SweepGeneratorTests.cs
@@ -12,7 +12,7 @@ namespace Orchard.Tests.Tasks {
public class SweepGeneratorTests : ContainerTestBase {
protected override void Register(ContainerBuilder builder) {
builder.RegisterAutoMocking(MockBehavior.Loose);
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterType();
}
diff --git a/src/Orchard.Tests/UI/ShapeTests.cs b/src/Orchard.Tests/UI/ShapeTests.cs
index f5d8fb4c0..efac540ea 100644
--- a/src/Orchard.Tests/UI/ShapeTests.cs
+++ b/src/Orchard.Tests/UI/ShapeTests.cs
@@ -19,7 +19,7 @@ namespace Orchard.Tests.UI {
protected override void Register(ContainerBuilder builder) {
builder.RegisterType().As();
- builder.RegisterType().As();
+ builder.RegisterType().As();
builder.RegisterType().As();
builder.RegisterType().As();
builder.RegisterType().As();
diff --git a/src/Orchard.Web/Core/Common/Handlers/CommonPartHandler.cs b/src/Orchard.Web/Core/Common/Handlers/CommonPartHandler.cs
index c012a3ddb..0c939952f 100644
--- a/src/Orchard.Web/Core/Common/Handlers/CommonPartHandler.cs
+++ b/src/Orchard.Web/Core/Common/Handlers/CommonPartHandler.cs
@@ -1,7 +1,6 @@
using System.Linq;
using JetBrains.Annotations;
using Orchard.ContentManagement.MetaData;
-using Orchard.ContentManagement.MetaData.Models;
using Orchard.Core.Common.Models;
using Orchard.Data;
using Orchard.Localization;
@@ -67,9 +66,11 @@ namespace Orchard.Core.Common.Handlers {
bool ContentTypeWithACommonPart(string typeName) {
//Note: What about content type handlers which activate "CommonPart" in code?
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(typeName);
- if (contentTypeDefinition == null)
- return false;
- return contentTypeDefinition.Parts.Any(part => part.PartDefinition.Name == "CommonPart");
+
+ if (contentTypeDefinition != null)
+ return contentTypeDefinition.Parts.Any(part => part.PartDefinition.Name == "CommonPart");
+
+ return false;
}
void AssignCreatingOwner(InitializingContentContext context, CommonPart part) {
diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs
index 706eaec36..012b55d6f 100644
--- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs
+++ b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs
@@ -70,7 +70,7 @@ namespace Orchard.Core.Routable.Drivers {
var containerUrl = new UriBuilder(request.ToRootUrlString()) { Path = (request.ApplicationPath ?? "").TrimEnd('/') + "/" + (part.GetContainerPath() ?? "") };
model.ContainerAbsoluteUrl = containerUrl.Uri.ToString().TrimEnd('/');
- model.PromoteToHomePage = model.Id != 0 && part.Path != null && _routableHomePageProvider != null && _services.WorkContext.CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id);
+ model.PromoteToHomePage = model.Id != 0 && _routableHomePageProvider != null && _services.WorkContext.CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id);
return ContentShape("Parts_Routable_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
}
@@ -81,6 +81,7 @@ namespace Orchard.Core.Routable.Drivers {
part.Title = model.Title;
part.Slug = model.Slug;
+ part.PromoteToHomePage = model.PromoteToHomePage;
if ( !_routableService.IsSlugValid(part.Slug) ) {
var slug = (part.Slug ?? String.Empty);
@@ -90,9 +91,6 @@ namespace Orchard.Core.Routable.Drivers {
updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\". No spaces are allowed (please use dashes or underscores instead)."));
}
- if (part.ContentItem.Id != 0 && model.PromoteToHomePage && _routableHomePageProvider != null)
- _services.WorkContext.CurrentSite.HomePage = _routableHomePageProvider.GetSettingValue(part.ContentItem.Id);
-
return Editor(part, shapeHelper);
}
}
diff --git a/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs b/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs
index 6e70fa72d..62682ab66 100644
--- a/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs
+++ b/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs
@@ -1,4 +1,6 @@
using System;
+using System.Collections.Generic;
+using System.Linq;
using System.Web.Routing;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
@@ -6,6 +8,7 @@ using Orchard.Core.Routable.Models;
using Orchard.Core.Routable.Services;
using Orchard.Data;
using Orchard.Localization;
+using Orchard.Services;
using Orchard.UI.Notify;
namespace Orchard.Core.Routable.Handlers {
@@ -13,11 +16,18 @@ namespace Orchard.Core.Routable.Handlers {
private readonly IOrchardServices _services;
private readonly IRoutablePathConstraint _routablePathConstraint;
private readonly IRoutableService _routableService;
+ private readonly IHomePageProvider _routableHomePageProvider;
- public RoutePartHandler(IOrchardServices services, IRepository repository, IRoutablePathConstraint routablePathConstraint, IRoutableService routableService) {
+ public RoutePartHandler(
+ IOrchardServices services,
+ IRepository repository,
+ IRoutablePathConstraint routablePathConstraint,
+ IRoutableService routableService,
+ IEnumerable homePageProviders) {
_services = services;
_routablePathConstraint = routablePathConstraint;
_routableService = routableService;
+ _routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name);
T = NullLocalizer.Instance;
Filters.Add(StorageFilter.For(repository));
@@ -34,21 +44,10 @@ namespace Orchard.Core.Routable.Handlers {
OnUpdateEditorShape(SetModelProperties);
OnPublished((context, route) => {
- var path = route.Path;
- route.Path = route.GetPathWithSlug(route.Slug);
+ FinalizePath(route, context, processSlug);
- if (context.PublishingItemVersionRecord != null)
- processSlug(route);
-
- // if the path has changed by having the slug changed on the way in (e.g. user input) or to avoid conflict
- // then update and publish all contained items
- if (path != route.Path) {
- _routablePathConstraint.RemovePath(path);
- _routableService.FixContainedPaths(route);
- }
-
- if (!string.IsNullOrWhiteSpace(route.Path))
- _routablePathConstraint.AddPath(route.Path);
+ if (route.ContentItem.Id != 0 && route.PromoteToHomePage && _routableHomePageProvider != null)
+ _services.WorkContext.CurrentSite.HomePage = _routableHomePageProvider.GetSettingValue(route.ContentItem.Id);
});
OnRemoved((context, route) => {
@@ -59,6 +58,24 @@ namespace Orchard.Core.Routable.Handlers {
OnIndexing((context, part) => context.DocumentIndex.Add("title", part.Record.Title).RemoveTags().Analyze());
}
+ private void FinalizePath(RoutePart route, PublishContentContext context, Action processSlug) {
+ var path = route.Path;
+ route.Path = route.GetPathWithSlug(route.Slug);
+
+ if (context.PublishingItemVersionRecord != null)
+ processSlug(route);
+
+ // if the path has changed by having the slug changed on the way in (e.g. user input) or to avoid conflict
+ // then update and publish all contained items
+ if (path != route.Path) {
+ _routablePathConstraint.RemovePath(path);
+ _routableService.FixContainedPaths(route);
+ }
+
+ if (!string.IsNullOrWhiteSpace(route.Path))
+ _routablePathConstraint.AddPath(route.Path);
+ }
+
private static void SetModelProperties(BuildShapeContext context, RoutePart routable) {
var item = context.Shape;
item.Title = routable.Title;
diff --git a/src/Orchard.Web/Core/Routable/Models/RoutePart.cs b/src/Orchard.Web/Core/Routable/Models/RoutePart.cs
index 284b0ed97..5ccb9f277 100644
--- a/src/Orchard.Web/Core/Routable/Models/RoutePart.cs
+++ b/src/Orchard.Web/Core/Routable/Models/RoutePart.cs
@@ -3,7 +3,6 @@ using Orchard.ContentManagement.Aspects;
namespace Orchard.Core.Routable.Models {
public class RoutePart : ContentPart, IRoutableAspect {
-
public string Title {
get { return Record.Title; }
set { Record.Title = value; }
@@ -18,5 +17,7 @@ namespace Orchard.Core.Routable.Models {
get { return Record.Path; }
set { Record.Path = value; }
}
+
+ public bool PromoteToHomePage { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs b/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs
index bf43531b5..47c80c74f 100644
--- a/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs
+++ b/src/Orchard.Web/Core/Routable/Services/RoutableHomePageProvider.cs
@@ -2,7 +2,6 @@
using JetBrains.Annotations;
using Orchard.Core.Routable.Models;
using Orchard.DisplayManagement;
-using Orchard.Localization;
using Orchard.Services;
using Orchard.ContentManagement;
@@ -10,24 +9,16 @@ namespace Orchard.Core.Routable.Services {
[UsedImplicitly]
public class RoutableHomePageProvider : IHomePageProvider {
private readonly IContentManager _contentManager;
- private readonly IWorkContextAccessor _workContextAccessor;
public const string Name = "RoutableHomePageProvider";
public RoutableHomePageProvider(
- IOrchardServices services,
IContentManager contentManager,
- IShapeFactory shapeFactory,
- IWorkContextAccessor workContextAccessor) {
+ IShapeFactory shapeFactory) {
_contentManager = contentManager;
- _workContextAccessor = workContextAccessor;
- Services = services;
- T = NullLocalizer.Instance;
Shape = shapeFactory;
}
dynamic Shape { get; set; }
- public IOrchardServices Services { get; private set; }
- public Localizer T { get; set; }
public string GetProviderName() {
return Name;
@@ -37,8 +28,8 @@ namespace Orchard.Core.Routable.Services {
return GetProviderName() + ";" + id;
}
- public ActionResult GetHomePage(int itemId) {
- var contentItem = _contentManager.Get(itemId, VersionOptions.Published);
+ public ActionResult GetHomePage(int id) {
+ var contentItem = _contentManager.Get(id, VersionOptions.Published);
if (contentItem == null || !contentItem.Is())
return new HttpNotFoundResult();
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.Description.cshtml b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.Description.cshtml
index 1610e4211..08c88c604 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.Description.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Views/Parts/Blogs.Blog.Description.cshtml
@@ -1,5 +1,5 @@
@if (HasText(Model.Description)) {
-