Merge pull request #5796 from OrchardCMS/issue/5791/homealias

[Fixes #5791] Home Alias fixes for issue
This commit is contained in:
Sébastien Ros
2015-10-08 12:15:54 -07:00
11 changed files with 192 additions and 166 deletions

View File

@@ -155,7 +155,9 @@ Scenario: I set my blog to be the content for the home page and the posts for th
And I go to "/"
Then I should see "<h1>My Blog</h1>"
When I go to "/my-blog"
Then the status should be 404 "Not Found"
Then the status should be 200 "OK"
When I go to "/"
Then the status should be 200 "OK"
When I go to "/my-post"
Then I should see "<h1>My Post</h1>"

View File

@@ -484,10 +484,14 @@ this.ScenarioSetup(scenarioInfo);
#line 157
testRunner.When("I go to \"/my-blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 158
testRunner.Then("the status should be 404 \"Not Found\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
testRunner.Then("the status should be 200 \"OK\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 159
testRunner.When("I go to \"/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
testRunner.When("I go to \"/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 160
testRunner.Then("the status should be 200 \"OK\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 161
testRunner.When("I go to \"/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 162
testRunner.Then("I should see \"<h1>My Post</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
@@ -498,11 +502,11 @@ this.ScenarioSetup(scenarioInfo);
public virtual void ICanCreateBrowseBlogPostsOnSeveralPages()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create browse blog posts on several pages", ((string[])(null)));
#line 162
this.ScenarioSetup(scenarioInfo);
#line 163
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 164
this.ScenarioSetup(scenarioInfo);
#line 165
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 166
testRunner.When("I go to \"admin/blogs/create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
@@ -511,15 +515,15 @@ this.ScenarioSetup(scenarioInfo);
table14.AddRow(new string[] {
"Title.Title",
"My Blog"});
#line 165
#line 167
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 168
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 169
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 170
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 171
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 172
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 173
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
@@ -528,17 +532,17 @@ this.ScenarioSetup(scenarioInfo);
table15.AddRow(new string[] {
"Title.Title",
"My Post 1"});
#line 172
#line 174
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 175
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 176
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 177
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 178
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 180
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 181
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
@@ -547,17 +551,17 @@ this.ScenarioSetup(scenarioInfo);
table16.AddRow(new string[] {
"Title.Title",
"My Post 2"});
#line 180
#line 182
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 183
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 184
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 185
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 186
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 187
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 188
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 189
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
@@ -566,17 +570,17 @@ this.ScenarioSetup(scenarioInfo);
table17.AddRow(new string[] {
"Title.Title",
"My Post 3"});
#line 188
#line 190
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 191
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 192
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 193
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 194
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 195
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 196
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 197
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
@@ -585,17 +589,17 @@ this.ScenarioSetup(scenarioInfo);
table18.AddRow(new string[] {
"Title.Title",
"My Post 4"});
#line 196
#line 198
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 199
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 200
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 201
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 202
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 203
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 204
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 205
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
@@ -604,17 +608,17 @@ this.ScenarioSetup(scenarioInfo);
table19.AddRow(new string[] {
"Title.Title",
"My Post 5"});
#line 204
#line 206
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 207
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 208
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 209
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 210
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 211
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 212
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 213
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
@@ -623,17 +627,17 @@ this.ScenarioSetup(scenarioInfo);
table20.AddRow(new string[] {
"Title.Title",
"My Post 6"});
#line 212
#line 214
testRunner.And("I fill in", ((string)(null)), table20, "And ");
#line 215
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 216
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 217
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 218
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 219
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 220
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 221
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table21 = new TechTalk.SpecFlow.Table(new string[] {
@@ -642,17 +646,17 @@ this.ScenarioSetup(scenarioInfo);
table21.AddRow(new string[] {
"Title.Title",
"My Post 7"});
#line 220
#line 222
testRunner.And("I fill in", ((string)(null)), table21, "And ");
#line 223
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 224
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 225
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 226
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 227
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 228
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 229
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
@@ -661,17 +665,17 @@ this.ScenarioSetup(scenarioInfo);
table22.AddRow(new string[] {
"Title.Title",
"My Post 8"});
#line 228
#line 230
testRunner.And("I fill in", ((string)(null)), table22, "And ");
#line 231
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 232
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 233
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 234
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 235
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 236
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 237
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table23 = new TechTalk.SpecFlow.Table(new string[] {
@@ -680,17 +684,17 @@ this.ScenarioSetup(scenarioInfo);
table23.AddRow(new string[] {
"Title.Title",
"My Post 9"});
#line 236
#line 238
testRunner.And("I fill in", ((string)(null)), table23, "And ");
#line 239
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 240
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 241
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 242
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 243
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 244
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 245
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table24 = new TechTalk.SpecFlow.Table(new string[] {
@@ -699,17 +703,17 @@ this.ScenarioSetup(scenarioInfo);
table24.AddRow(new string[] {
"Title.Title",
"My Post 10"});
#line 244
#line 246
testRunner.And("I fill in", ((string)(null)), table24, "And ");
#line 247
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 248
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 249
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 250
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 251
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 252
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 253
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table25 = new TechTalk.SpecFlow.Table(new string[] {
@@ -718,17 +722,17 @@ this.ScenarioSetup(scenarioInfo);
table25.AddRow(new string[] {
"Title.Title",
"My Post 11"});
#line 252
#line 254
testRunner.And("I fill in", ((string)(null)), table25, "And ");
#line 255
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 256
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 257
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 258
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 259
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 260
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 261
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table26 = new TechTalk.SpecFlow.Table(new string[] {
@@ -737,33 +741,33 @@ this.ScenarioSetup(scenarioInfo);
table26.AddRow(new string[] {
"Title.Title",
"My Post 12"});
#line 260
#line 262
testRunner.And("I fill in", ((string)(null)), table26, "And ");
#line 263
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 264
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 265
testRunner.Then("I should see \"Your Blog Post has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 266
testRunner.When("I go to \"my-blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 267
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
testRunner.Then("I should see \"Your Blog Post has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 268
testRunner.And("I should see \"<h1[^>]*>.*?My Post 12.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.When("I go to \"my-blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 269
testRunner.And("I should see \"<h1[^>]*>.*?My Post 11.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 270
testRunner.And("I should not see \"<h1[^>]*>.*?My Post 10.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 271
testRunner.When("I go to \"my-blog?page=2\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 272
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 270
testRunner.And("I should see \"<h1[^>]*>.*?My Post 12.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 271
testRunner.And("I should see \"<h1[^>]*>.*?My Post 11.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 272
testRunner.And("I should not see \"<h1[^>]*>.*?My Post 10.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 273
testRunner.And("I should see \"<h1[^>]*>.*?My Post 1.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.When("I go to \"my-blog?page=2\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 274
testRunner.And("I should see \"<h1[^>]*>.*?My Post 2.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.Then("I should see \"<h1[^>]*>.*?My Blog.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 275
testRunner.And("I should see \"<h1[^>]*>.*?My Post 1.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 276
testRunner.And("I should see \"<h1[^>]*>.*?My Post 2.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 277
testRunner.And("I should not see \"<h1[^>]*>.*?My Post 3.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
@@ -776,11 +780,11 @@ this.ScenarioSetup(scenarioInfo);
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can create a new blog with a percent sign in the title and it gets stripped out" +
" of the slug", ((string[])(null)));
#line 277
this.ScenarioSetup(scenarioInfo);
#line 278
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 279
this.ScenarioSetup(scenarioInfo);
#line 280
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 281
testRunner.When("I go to \"admin/blogs/create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table27 = new TechTalk.SpecFlow.Table(new string[] {
@@ -789,15 +793,15 @@ this.ScenarioSetup(scenarioInfo);
table27.AddRow(new string[] {
"Title.Title",
"My Blog"});
#line 280
#line 282
testRunner.And("I fill in", ((string)(null)), table27, "And ");
#line 283
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 284
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 285
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 286
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 287
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 288
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table28 = new TechTalk.SpecFlow.Table(new string[] {
@@ -809,15 +813,15 @@ this.ScenarioSetup(scenarioInfo);
table28.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 287
#line 289
testRunner.And("I fill in", ((string)(null)), table28, "And ");
#line 291
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 292
testRunner.And("I go to \"my-blog/my-post-with-a-sign\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 293
testRunner.Then("I should see \"<h1[^>]*>.*?My Post with a % Sign.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 294
testRunner.And("I go to \"my-blog/my-post-with-a-sign\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 295
testRunner.Then("I should see \"<h1[^>]*>.*?My Post with a % Sign.*?</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 296
testRunner.And("I should see \"Hi there.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();

View File

@@ -25,13 +25,13 @@ Scenario: In the admin (menu) there is a link to create a Page
And I fill in
| name | value |
| Title.Title | Super Duper |
| AutoroutePart.LayoutEditor.Data | { "type": "Content", "data": "TypeName=Orchard.Layouts.Elements.Text&Content=This+is+super+number+two", "isTemplated": false, "contentType": "Orchard.Layouts.Elements.Text", "contentTypeLabel": "Text", "contentTypeClass": "text", "html": "This is super number two", "hasEditor": true } |
| LayoutPart.LayoutEditor.Data | { "type": "Content", "data": "TypeName=Orchard.Layouts.Elements.Text&Content=This+is+super+number+two", "isTemplated": false, "contentType": "Orchard.Layouts.Elements.Text", "contentTypeLabel": "Text", "contentTypeClass": "text", "html": "This is super number two", "hasEditor": true } |
And I hit "Publish Now"
And I go to "super-duper-2"
Then I should see "<h1[^>]*>.*?Super Duper.*?</h1>"
And I should see "This is super number two."
# 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
# A new page marked to be the home page and publish does take over the home page and is also accessible from its own standard path
When I go to "Admin/Contents/Create/Page"
And I fill in
| name | value |
@@ -41,7 +41,7 @@ Scenario: In the admin (menu) there is a link to create a Page
And I go to "/"
Then I should see "<h1>Another</h1>"
When I go to "another"
Then the status should be 404 "Not Found"
Then the status should be 200 "OK"
# A new page marked to be the home page but only saved as draft does not take over the home page
When I go to "Admin/Contents/Create/Page"

View File

@@ -110,7 +110,7 @@ this.ScenarioSetup(scenarioInfo);
"Title.Title",
"Super Duper"});
table2.AddRow(new string[] {
"AutoroutePart.LayoutEditor.Data",
"LayoutPart.LayoutEditor.Data",
@"{ ""type"": ""Content"", ""data"": ""TypeName=Orchard.Layouts.Elements.Text&Content=This+is+super+number+two"", ""isTemplated"": false, ""contentType"": ""Orchard.Layouts.Elements.Text"", ""contentTypeLabel"": ""Text"", ""contentTypeClass"": ""text"", ""html"": ""This is super number two"", ""hasEditor"": true }"});
#line 25
testRunner.And("I fill in", ((string)(null)), table2, "And ");
@@ -145,7 +145,7 @@ this.ScenarioSetup(scenarioInfo);
#line 43
testRunner.When("I go to \"another\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 44
testRunner.Then("the status should be 404 \"Not Found\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
testRunner.Then("the status should be 200 \"OK\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 47
testRunner.When("I go to \"Admin/Contents/Create/Page\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden

View File

@@ -171,7 +171,8 @@ namespace Orchard.Alias.Implementation.Map {
}
if (match == null) {
var foundPath = focus.Paths.Keys.FirstOrDefault();
// Get the shortest path available to ensure the "home" alias is always taken if present.
var foundPath = focus.Paths.Keys.OrderBy(x => x.Length).FirstOrDefault();
if (foundPath != null) {
// Here the deepest match is being created, which will be populated as it rises back up the stack, but save the path here.
// Within this function it's used to count how many items match so we get the best one; but when it's returned

View File

@@ -115,7 +115,7 @@ namespace Orchard.Autoroute.Drivers {
};
// Retrieve home page.
var homePageId = _homeAliasService.GetHomePageId();
var homePageId = _homeAliasService.GetHomePageId(VersionOptions.Latest);
var isHomePage = part.Id == homePageId;
viewModel.IsHomePage = isHomePage;

View File

@@ -39,7 +39,7 @@ namespace Orchard.Autoroute.Handlers {
OnPublished<AutoroutePart>((ctx, part) => PublishAlias(part));
// Remove alias if removed or unpublished
OnRemoved<AutoroutePart>((ctx, part) => RemoveAlias(part));
OnRemoving<AutoroutePart>((ctx, part) => RemoveAlias(part));
OnUnpublished<AutoroutePart>((ctx, part) => RemoveAlias(part));
// Register alias as identity
@@ -99,7 +99,7 @@ namespace Orchard.Autoroute.Handlers {
}
void RemoveAlias(AutoroutePart part) {
var homePageId = _homeAliasService.GetHomePageId();
var homePageId = _homeAliasService.GetHomePageId(VersionOptions.Latest);
// Is this the current home page?
if (part.ContentItem.Id == homePageId) {

View File

@@ -10,10 +10,12 @@ using Orchard.Core.Common.Models;
namespace Orchard.Autoroute.Providers {
public class SlugTokens : ITokenProvider {
private readonly ISlugService _slugService;
private readonly IHomeAliasService _homeAliasService;
public SlugTokens(ISlugService slugService) {
public SlugTokens(ISlugService slugService, IHomeAliasService homeAliasService) {
T = NullLocalizer.Instance;
_slugService = slugService;
_homeAliasService = homeAliasService;
}
public Localizer T { get; set; }
@@ -40,11 +42,12 @@ namespace Orchard.Autoroute.Providers {
// {Content.Slug}
.Token("Slug", (content => content == null ? String.Empty : _slugService.Slugify(content)))
.Token("Path", (content => {
var autoroute = content.As<AutoroutePart>();
if (autoroute == null) {
var autoroutePart = content.As<AutoroutePart>();
if (autoroutePart == null) {
return String.Empty;
}
return autoroute.DisplayAlias;
var isHomePage = _homeAliasService.IsHomePage(autoroutePart);
return isHomePage ? String.Empty : autoroutePart.DisplayAlias;
}))
// {Content.ParentPath}
.Token("ParentPath", (content => {
@@ -52,13 +55,15 @@ namespace Orchard.Autoroute.Providers {
if (common == null || common.Container == null) {
return String.Empty;
}
var ar = common.Container.As<AutoroutePart>();
if (ar == null) {
var containerAutoroutePart = common.Container.As<AutoroutePart>();
if (containerAutoroutePart == null) {
return String.Empty;
}
if (String.IsNullOrEmpty(ar.DisplayAlias))
if (String.IsNullOrEmpty(containerAutoroutePart.DisplayAlias))
return String.Empty;
return ar.DisplayAlias + "/";
var isHomePage = _homeAliasService.IsHomePage(containerAutoroutePart);
return isHomePage ? "/" : containerAutoroutePart.DisplayAlias + "/";
}));
context.For<ContentTypeDefinition>("TypeDefinition")

View File

@@ -13,7 +13,6 @@ using Orchard.Localization.Services;
using Orchard.Mvc;
using System.Web;
using Orchard.ContentManagement.Aspects;
using Orchard.Alias.Implementation.Storage;
namespace Orchard.Autoroute.Services {
public class AutorouteService : Component, IAutorouteService {
@@ -24,7 +23,6 @@ namespace Orchard.Autoroute.Services {
private readonly IContentManager _contentManager;
private readonly IRouteEvents _routeEvents;
private readonly ICultureManager _cultureManager;
private readonly IAliasStorage _aliasStorage;
private readonly IHttpContextAccessor _httpContextAccessor;
private const string AliasSource = "Autoroute:View";
@@ -35,15 +33,13 @@ namespace Orchard.Autoroute.Services {
IContentManager contentManager,
IRouteEvents routeEvents,
ICultureManager cultureManager,
IHttpContextAccessor httpContextAccessor,
IAliasStorage aliasStorage) {
IHttpContextAccessor httpContextAccessor) {
_aliasService = aliasService;
_tokenizer = tokenizer;
_contentDefinitionManager = contentDefinitionManager;
_contentManager = contentManager;
_routeEvents = routeEvents;
_aliasStorage = aliasStorage;
_cultureManager = cultureManager;
_httpContextAccessor = httpContextAccessor;
}
@@ -69,13 +65,14 @@ namespace Orchard.Autoroute.Services {
if (settings.UseCulturePattern) {
// TODO: Refactor the below so that we don't need to know about Request.Form["Localization.SelectedCulture"].
// If we are creating from a form post we use the form value for culture.
HttpContextBase context = _httpContextAccessor.Current();
if (!String.IsNullOrEmpty(context.Request.Form["Localization.SelectedCulture"])) {
itemCulture = context.Request.Form["Localization.SelectedCulture"].ToString();
var context = _httpContextAccessor.Current();
var selectedCulture = context.Request.Form["Localization.SelectedCulture"];
if (!String.IsNullOrEmpty(selectedCulture)) {
itemCulture = selectedCulture;
}
}
string pattern = GetDefaultPattern(part.ContentItem.ContentType, itemCulture).Pattern;
var pattern = GetDefaultPattern(part.ContentItem.ContentType, itemCulture).Pattern;
// String.Empty forces pattern based generation.
if (part.UseCustomPattern && (!String.IsNullOrWhiteSpace(part.CustomPattern))) {

View File

@@ -1,17 +1,22 @@
using System;
using System.Linq;
using System.Web.Routing;
using Orchard.Alias;
using Orchard.Alias.Implementation.Holder;
using Orchard.Autoroute.Models;
using Orchard.ContentManagement;
namespace Orchard.Autoroute.Services {
public class HomeAliasService : IHomeAliasService {
private readonly IAliasService _aliasService;
private readonly IContentManager _contentManager;
private readonly IAliasHolder _aliasHolder;
private const string AliasSource = "Autoroute:Home";
private const string HomeAlias = "";
public HomeAliasService(IAliasService aliasService, IContentManager contentManager) {
public HomeAliasService(IAliasService aliasService, IAliasHolder aliasHolder, IContentManager contentManager) {
_aliasService = aliasService;
_aliasHolder = aliasHolder;
_contentManager = contentManager;
}
@@ -19,21 +24,27 @@ namespace Orchard.Autoroute.Services {
return _aliasService.Get(HomeAlias);
}
public int? GetHomePageId() {
var homePageRoute = GetHomeRoute();
var homePageIdValue = homePageRoute != null && homePageRoute.ContainsKey("id") ? (string)homePageRoute["id"] : default(string);
var homePageId = TryParseInt32(homePageIdValue);
return homePageId;
public int? GetHomePageId(VersionOptions version = null) {
var homePage = GetHomePage(version);
return homePage != null ? homePage.Id : default(int?);
}
public IContent GetHomePage(VersionOptions version = null) {
var homePageId = GetHomePageId();
var homePage = homePageId != null ? _contentManager.Get(homePageId.Value, version ?? VersionOptions.Published) : default(IContent);
var homePageRoute = GetHomeRoute();
var alias = LookupAlias(homePageRoute);
if (alias == null)
return null;
var homePage = _contentManager.Query<AutoroutePart, AutoroutePartRecord>(version).Where(x => x.DisplayAlias == alias).Slice(0, 1).SingleOrDefault();
return homePage;
}
public bool IsHomePage(IContent content, VersionOptions homePageVersion = null) {
var homePageId = GetHomePageId(homePageVersion);
return content.Id == homePageId;
}
public void PublishHomeAlias(IContent content) {
var routeValues = _contentManager.GetItemMetadata(content).DisplayRouteValues;
PublishHomeAlias(routeValues);
@@ -49,13 +60,18 @@ namespace Orchard.Autoroute.Services {
_aliasService.Set(HomeAlias, route, AliasSource);
}
private int? TryParseInt32(string value) {
int i;
private string LookupAlias(RouteValueDictionary routeValues) {
object area;
if (String.IsNullOrWhiteSpace(value) || !Int32.TryParse(value, out i))
if (!routeValues.TryGetValue("area", out area))
return null;
return i;
var map = _aliasHolder.GetMap(area.ToString());
if (map == null)
return null;
var alias = map.GetAliases().FirstOrDefault(x => !String.IsNullOrWhiteSpace(x.Path));
return alias != null ? alias.Path : null;
}
}
}

View File

@@ -5,8 +5,9 @@ namespace Orchard.Autoroute.Services {
public interface IHomeAliasService : IDependency {
RouteValueDictionary GetHomeRoute();
int? GetHomePageId();
int? GetHomePageId(VersionOptions version = null);
IContent GetHomePage(VersionOptions version = null);
bool IsHomePage(IContent content, VersionOptions homePageVersion = null);
void PublishHomeAlias(IContent content);
void PublishHomeAlias(string route);
void PublishHomeAlias(RouteValueDictionary route);