Merge remote-tracking branch 'origin/1.10.x' into dev

# Conflicts:
#	src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Link.Edit.cshtml
#	src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/Numeric.Edit.cshtml
This commit is contained in:
Daniel Stolt
2016-03-30 18:17:06 +02:00
23 changed files with 1485 additions and 187 deletions

View File

@@ -53,7 +53,7 @@ Scenario: Creating and using Boolean fields
And I go to "Admin/Contents/Create/Event"
Then I should see "Check if the event is active"
# The default value should be selected
# The default value should be used on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
@@ -65,8 +65,9 @@ Scenario: Creating and using Boolean fields
# The value should be required
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].BooleanFieldSettings.Optional | false |
| name | value |
| Fields[0].BooleanFieldSettings.Optional | false |
| Fields[0].BooleanFieldSettings.DefaultValue | Neutral |
And I fill in
| name | value |
| Fields[0].BooleanFieldSettings.NotSetLabel | May be |
@@ -79,4 +80,23 @@ Scenario: Creating and using Boolean fields
| name | value |
| Event.Active.Value | |
And I hit "Save"
Then I should see "The field Active is mandatory."
Then I should see "The field Active is mandatory."
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].BooleanFieldSettings.Optional | false |
| Fields[0].BooleanFieldSettings.DefaultValue | True |
And I fill in
| name | value |
| Fields[0].BooleanFieldSettings.SelectionMode | Dropdown list |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Active.Value | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
And I should see "selected=\"selected\" value=\"true\""

View File

@@ -193,6 +193,9 @@ this.ScenarioSetup(scenarioInfo);
table6.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.Optional",
"false"});
table6.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.DefaultValue",
"Neutral"});
#line 67
testRunner.And("I fill in", ((string)(null)), table6, "And ");
#line hidden
@@ -202,7 +205,7 @@ this.ScenarioSetup(scenarioInfo);
table7.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.NotSetLabel",
"May be"});
#line 70
#line 71
testRunner.And("I fill in", ((string)(null)), table7, "And ");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
@@ -211,11 +214,11 @@ this.ScenarioSetup(scenarioInfo);
table8.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.SelectionMode",
"Radiobutton"});
#line 73
#line 74
testRunner.And("I fill in", ((string)(null)), table8, "And ");
#line 76
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 77
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 78
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
@@ -224,12 +227,56 @@ this.ScenarioSetup(scenarioInfo);
table9.AddRow(new string[] {
"Event.Active.Value",
""});
#line 78
#line 79
testRunner.And("I fill in", ((string)(null)), table9, "And ");
#line 81
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 82
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 83
testRunner.Then("I should see \"The field Active is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 86
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.Optional",
"false"});
table10.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.DefaultValue",
"True"});
#line 87
testRunner.And("I fill in", ((string)(null)), table10, "And ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Fields[0].BooleanFieldSettings.SelectionMode",
"Dropdown list"});
#line 91
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 94
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 95
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Event.Active.Value",
""});
#line 96
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line 99
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 100
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 101
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 102
testRunner.And("I should see \"selected=\\\"selected\\\" value=\\\"true\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
this.ScenarioCleanup();
}

View File

@@ -89,9 +89,9 @@ Scenario: Creating and using Date fields
# Required & Date and Time
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
| Fields[0].DateTimeFieldSettings.Required | true |
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
| Fields[0].DateTimeFieldSettings.Required | true |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
@@ -139,6 +139,68 @@ Scenario: Creating and using Date fields
When I hit "Save"
Then I should see "Date of the event is required."
# If not required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
| Fields[0].DateTimeFieldSettings.Required | false |
| Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2012 |
| Fields[0].DateTimeFieldSettings.Editor.Time | 11:00 AM |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
When I fill in
| name | value |
| Event.EventDate.Editor.Date | |
| Event.EventDate.Editor.Time | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Date of the event"
And I should see "1/31/2012 11:00"
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
| Fields[0].DateTimeFieldSettings.Required | true |
| Fields[0].DateTimeFieldSettings.Editor.Date | 01/31/2012 |
| Fields[0].DateTimeFieldSettings.Editor.Time | 10:00 AM |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
When I fill in
| name | value |
| Event.EventDate.Editor.Date | |
| Event.EventDate.Editor.Time | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Date of the event"
And I should see "1/31/2012 10:00"
# If required and the default value is incomplete, the value should be required
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].DateTimeFieldSettings.Display | DateAndTime |
| Fields[0].DateTimeFieldSettings.Required | true |
| Fields[0].DateTimeFieldSettings.Editor.Date | |
| Fields[0].DateTimeFieldSettings.Editor.Time | 12:00 AM |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Event.EventDate.Editor.Date"
When I fill in
| name | value |
| Event.EventDate.Editor.Date | |
| Event.EventDate.Editor.Time | |
And I hit "Save"
Then I should see "Date of the event is required."
Scenario: Creating and using date time fields in another culture
# Creating an Event content type
@@ -190,4 +252,4 @@ Scenario: Creating and using date time fields in another culture
| Event.EventDate.Editor.Time | 18:00 |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
Then I should see "Your Event has been created."

View File

@@ -350,77 +350,58 @@ this.ScenarioSetup(scenarioInfo);
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 140
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Creating and using date time fields in another culture")]
public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
#line 142
this.ScenarioSetup(scenarioInfo);
#line 145
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 146
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 147
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 148
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 149
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 150
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 143
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"DisplayName",
"Event"});
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
table15.AddRow(new string[] {
"Name",
"Event"});
#line 151
"Fields[0].DateTimeFieldSettings.Required",
"false"});
table15.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Date",
"01/31/2012"});
table15.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Time",
"11:00 AM"});
#line 144
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 155
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 156
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 157
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 160
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 161
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 150
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 151
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 152
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"DisplayName",
"Date of the event"});
"Event.EventDate.Editor.Date",
""});
table16.AddRow(new string[] {
"Name",
"EventDate"});
table16.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 162
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 167
"Event.EventDate.Editor.Time",
""});
#line 153
testRunner.When("I fill in", ((string)(null)), table16, "When ");
#line 157
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 168
#line 158
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 169
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 172
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 173
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 159
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 160
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 161
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 162
testRunner.And("I should see \"1/31/2012 11:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 165
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
@@ -431,47 +412,208 @@ this.ScenarioSetup(scenarioInfo);
table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 174
table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Date",
"01/31/2012"});
table17.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Time",
"10:00 AM"});
#line 166
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 178
#line 172
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 173
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 174
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"01/31/2012"});
""});
table18.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"12:00 AM"});
#line 180
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 184
""});
#line 175
testRunner.When("I fill in", ((string)(null)), table18, "When ");
#line 179
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 185
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 186
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 180
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 181
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 182
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 183
testRunner.Then("I should see \"Date of the event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 184
testRunner.And("I should see \"1/31/2012 10:00\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 187
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table19.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
table19.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
table19.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Date",
""});
table19.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Editor.Time",
"12:00 AM"});
#line 188
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 194
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 195
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 196
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table20.AddRow(new string[] {
"Event.EventDate.Editor.Date",
""});
table20.AddRow(new string[] {
"Event.EventDate.Editor.Time",
""});
#line 197
testRunner.When("I fill in", ((string)(null)), table20, "When ");
#line 201
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 202
testRunner.Then("I should see \"Date of the event is required.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Creating and using date time fields in another culture")]
public virtual void CreatingAndUsingDateTimeFieldsInAnotherCulture()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Creating and using date time fields in another culture", ((string[])(null)));
#line 204
this.ScenarioSetup(scenarioInfo);
#line 207
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
#line 208
testRunner.And("I have installed \"Orchard.Fields\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 209
testRunner.And("I have the file \"Content\\orchard.core.po\" in \"Core\\App_Data\\Localization\\fr-FR\\or" +
"chard.core.po\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 210
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 211
testRunner.Then("I should see \"<a[^>]*>.*?Create new type</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 212
testRunner.When("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table21 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table21.AddRow(new string[] {
"DisplayName",
"Event"});
table21.AddRow(new string[] {
"Name",
"Event"});
#line 213
testRunner.And("I fill in", ((string)(null)), table21, "And ");
#line 217
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 218
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 219
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 222
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 223
testRunner.And("I follow \"Add Field\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table22.AddRow(new string[] {
"DisplayName",
"Date of the event"});
table22.AddRow(new string[] {
"Name",
"EventDate"});
table22.AddRow(new string[] {
"FieldTypeName",
"DateTimeField"});
#line 224
testRunner.And("I fill in", ((string)(null)), table22, "And ");
#line 229
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 230
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 231
testRunner.Then("I should see \"The \\\"Date of the event\\\" field has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 234
testRunner.When("I have \"fr-FR\" as the default culture", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 235
testRunner.And("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table23 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table23.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Display",
"DateAndTime"});
table23.AddRow(new string[] {
"Fields[0].DateTimeFieldSettings.Required",
"true"});
#line 236
testRunner.And("I fill in", ((string)(null)), table23, "And ");
#line 240
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 241
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table24 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table24.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"01/31/2012"});
table24.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"12:00 AM"});
#line 242
testRunner.And("I fill in", ((string)(null)), table24, "And ");
#line 246
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 247
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 248
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table25 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table25.AddRow(new string[] {
"Event.EventDate.Editor.Date",
"31/01/2012"});
table19.AddRow(new string[] {
table25.AddRow(new string[] {
"Event.EventDate.Editor.Time",
"18:00"});
#line 187
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 191
#line 249
testRunner.And("I fill in", ((string)(null)), table25, "And ");
#line 253
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 192
#line 254
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 193
#line 255
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();

View File

@@ -107,3 +107,95 @@ Scenario: Creating and using Enumeration fields
And I go to "Admin/Contents/Create/Event"
And I hit "Save"
Then I should see "The field Location is mandatory."
# The default value should be used on creation
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Options | Seattle |
| Fields[0].EnumerationFieldSettings.ListMode | Dropdown |
| Fields[0].EnumerationFieldSettings.DefaultValue | Seattle |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "selected=\"selected">Seattle"
# If not required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | false |
| Fields[0].EnumerationFieldSettings.Options | Boston |
| Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
| Fields[0].EnumerationFieldSettings.DefaultValue | foo;Boston;bar |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Location"
When I fill in
| name | value |
| Event.Location.SelectedValues | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Location:"
And I should see "Boston"
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | true |
| Fields[0].EnumerationFieldSettings.Options | Phoenix |
| Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
| Fields[0].EnumerationFieldSettings.DefaultValue | foo;Phoenix;bar |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Location"
When I fill in
| name | value |
| Event.Location.SelectedValues | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Location:"
And I should see "Phoenix"
# If required and the default value is not valid, the value should be required
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | true |
| Fields[0].EnumerationFieldSettings.Options | Phoenix |
| Fields[0].EnumerationFieldSettings.ListMode | Checkbox |
| Fields[0].EnumerationFieldSettings.DefaultValue | foo;bar |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "Location"
When I fill in
| name | value |
| Event.Location.SelectedValues | |
And I hit "Save"
Then I should see "The field Location is mandatory."
# If required and no default value, the list box should have the required attribute
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | true |
| Fields[0].EnumerationFieldSettings.ListMode | Listbox |
| Fields[0].EnumerationFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
# If required and a default value is set, the list box should not have the required attribute
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].EnumerationFieldSettings.Required | true |
| Fields[0].EnumerationFieldSettings.ListMode | Listbox |
| Fields[0].EnumerationFieldSettings.DefaultValue | Phoenix |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""

View File

@@ -273,6 +273,208 @@ this.ScenarioSetup(scenarioInfo);
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 109
testRunner.Then("I should see \"The field Location is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 112
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Options",
"Seattle"});
table11.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Dropdown"});
table11.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
"Seattle"});
#line 113
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 118
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 119
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 120
testRunner.Then("I should see \"selected=\\\"selected\">Seattle\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 123
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
"false"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Options",
"Boston"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Checkbox"});
table12.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
"foo;Boston;bar"});
#line 124
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line 130
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 131
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 132
testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Event.Location.SelectedValues",
""});
#line 133
testRunner.When("I fill in", ((string)(null)), table13, "When ");
#line 136
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 137
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 138
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 139
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 140
testRunner.Then("I should see \"Location:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 141
testRunner.And("I should see \"Boston\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 144
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
"true"});
table14.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Options",
"Phoenix"});
table14.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Checkbox"});
table14.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
"foo;Phoenix;bar"});
#line 145
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 151
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 152
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 153
testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"Event.Location.SelectedValues",
""});
#line 154
testRunner.When("I fill in", ((string)(null)), table15, "When ");
#line 157
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 158
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 159
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 160
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 161
testRunner.Then("I should see \"Location:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 162
testRunner.And("I should see \"Phoenix\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 165
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
"true"});
table16.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Options",
"Phoenix"});
table16.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Checkbox"});
table16.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
"foo;bar"});
#line 166
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 172
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 173
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 174
testRunner.Then("I should see \"Location\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table17.AddRow(new string[] {
"Event.Location.SelectedValues",
""});
#line 175
testRunner.When("I fill in", ((string)(null)), table17, "When ");
#line 178
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.Then("I should see \"The field Location is mandatory.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 182
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
"true"});
table18.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Listbox"});
table18.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
""});
#line 183
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 188
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 189
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 190
testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 193
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table19.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.Required",
"true"});
table19.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.ListMode",
"Listbox"});
table19.AddRow(new string[] {
"Fields[0].EnumerationFieldSettings.DefaultValue",
"Phoenix"});
#line 194
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 199
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 200
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 201
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}

View File

@@ -128,3 +128,59 @@ Scenario: Creating and using Input fields
When I go to "Admin/Contents/List"
Then I should see "Contact:"
And I should see "contact@orchardproject.net"
# If not required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].InputFieldSettings.Required | false |
| Fields[0].InputFieldSettings.DefaultValue | contact1@orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Contact.Value | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Contact:"
And I should see "contact1@orchardproject.net"
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].InputFieldSettings.Required | true |
| Fields[0].InputFieldSettings.DefaultValue | contact2@orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Contact.Value | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Contact:"
And I should see "contact2@orchardproject.net"
# If required and no default value, the required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].InputFieldSettings.Required | true |
| Fields[0].InputFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
# If required and a default value is set, the required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].InputFieldSettings.Required | true |
| Fields[0].InputFieldSettings.DefaultValue | contact@orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""

View File

@@ -297,6 +297,124 @@ this.ScenarioSetup(scenarioInfo);
testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 130
testRunner.And("I should see \"contact@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 133
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Fields[0].InputFieldSettings.Required",
"false"});
table13.AddRow(new string[] {
"Fields[0].InputFieldSettings.DefaultValue",
"contact1@orchardproject.net"});
#line 134
testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 138
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 139
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Event.Contact.Value",
""});
#line 140
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 143
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 144
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 145
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 146
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 147
testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 148
testRunner.And("I should see \"contact1@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 151
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"Fields[0].InputFieldSettings.Required",
"true"});
table15.AddRow(new string[] {
"Fields[0].InputFieldSettings.DefaultValue",
"contact2@orchardproject.net"});
#line 152
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 156
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 157
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"Event.Contact.Value",
""});
#line 158
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 161
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 162
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 163
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 164
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 165
testRunner.Then("I should see \"Contact:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 166
testRunner.And("I should see \"contact2@orchardproject.net\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 169
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table17.AddRow(new string[] {
"Fields[0].InputFieldSettings.Required",
"true"});
table17.AddRow(new string[] {
"Fields[0].InputFieldSettings.DefaultValue",
""});
#line 170
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 174
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 175
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 176
testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 179
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Fields[0].InputFieldSettings.Required",
"true"});
table18.AddRow(new string[] {
"Fields[0].InputFieldSettings.DefaultValue",
"contact@orchardproject.net"});
#line 180
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 184
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 185
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 186
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}

View File

@@ -67,4 +67,66 @@ Scenario: Creating and using Link fields
| name | value |
| Event.SiteUrl.Value | |
And I hit "Save"
Then I should see "Url is required for Site Url."
Then I should see "Url is required for Site Url."
# If not required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].LinkFieldSettings.Required | false |
| Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.SiteUrl.Value | |
And I fill in
| name | value |
| Event.SiteUrl.Text | Orchard1 |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Site Url:"
And I should see "<a href=\"http://www.orchardproject.net\">Orchard1</a>"
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].LinkFieldSettings.Required | true |
| Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.SiteUrl.Value | |
And I fill in
| name | value |
| Event.SiteUrl.Text | Orchard2 |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Site Url:"
And I should see "<a href=\"http://www.orchardproject.net\">Orchard2</a>"
# If required and no default value, the required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].LinkFieldSettings.Required | true |
| Fields[0].LinkFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
# If required and a default value is set, the required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].LinkFieldSettings.Required | true |
| Fields[0].LinkFieldSettings.DefaultValue | http://www.orchardproject.net |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""

View File

@@ -204,6 +204,142 @@ this.ScenarioSetup(scenarioInfo);
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 70
testRunner.Then("I should see \"Url is required for Site Url.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 73
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table8.AddRow(new string[] {
"Fields[0].LinkFieldSettings.Required",
"false"});
table8.AddRow(new string[] {
"Fields[0].LinkFieldSettings.DefaultValue",
"http://www.orchardproject.net"});
#line 74
testRunner.And("I fill in", ((string)(null)), table8, "And ");
#line 78
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 79
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table9.AddRow(new string[] {
"Event.SiteUrl.Value",
""});
#line 80
testRunner.And("I fill in", ((string)(null)), table9, "And ");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
"Event.SiteUrl.Text",
"Orchard1"});
#line 83
testRunner.And("I fill in", ((string)(null)), table10, "And ");
#line 86
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 87
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 88
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 89
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 90
testRunner.Then("I should see \"Site Url:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 91
testRunner.And("I should see \"<a href=\\\"http://www.orchardproject.net\\\">Orchard1</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 94
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Fields[0].LinkFieldSettings.Required",
"true"});
table11.AddRow(new string[] {
"Fields[0].LinkFieldSettings.DefaultValue",
"http://www.orchardproject.net"});
#line 95
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 99
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 100
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Event.SiteUrl.Value",
""});
#line 101
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Event.SiteUrl.Text",
"Orchard2"});
#line 104
testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 107
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 108
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 109
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 110
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 111
testRunner.Then("I should see \"Site Url:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 112
testRunner.And("I should see \"<a href=\\\"http://www.orchardproject.net\\\">Orchard2</a>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 115
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Fields[0].LinkFieldSettings.Required",
"true"});
table14.AddRow(new string[] {
"Fields[0].LinkFieldSettings.DefaultValue",
""});
#line 116
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 120
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 121
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 122
testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 125
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"Fields[0].LinkFieldSettings.Required",
"true"});
table15.AddRow(new string[] {
"Fields[0].LinkFieldSettings.DefaultValue",
"http://www.orchardproject.net"});
#line 126
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 130
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 131
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 132
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}

View File

@@ -96,4 +96,104 @@ Scenario: Creating and using numeric fields
| Fields[0].NumericFieldSettings.Maximum | b |
And I hit "Save"
Then I should see "The value &#39;a&#39; is not valid for Minimum."
And I should see "The value &#39;b&#39; is not valid for Maximum."
And I should see "The value &#39;b&#39; is not valid for Maximum."
# The value should be validated
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | false |
| Fields[0].NumericFieldSettings.DefaultValue | 4 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | a |
And I hit "Save"
Then I should see "Guests or its default value is an invalid number"
# If not required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | false |
| Fields[0].NumericFieldSettings.DefaultValue | 4 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Guests:"
And I should see "4"
# If required and no value, the default value should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | true |
| Fields[0].NumericFieldSettings.DefaultValue | 5 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | |
And I hit "Save"
And I am redirected
Then I should see "Your Event has been created."
When I go to "Admin/Contents/List"
Then I should see "Guests:"
And I should see "5"
# The default value should be validated
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | false |
| Fields[0].NumericFieldSettings.DefaultValue | a |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | |
And I hit "Save"
Then I should see "Guests or its default value is an invalid number"
# The default value should be bound
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | false |
| Fields[0].NumericFieldSettings.Minimum | -10 |
| Fields[0].NumericFieldSettings.Maximum | 100 |
| Fields[0].NumericFieldSettings.DefaultValue | -20 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
And I fill in
| name | value |
| Event.Guests.Value | |
And I hit "Save"
Then I should see "The value must be greater than -10"
# If required and no default value, the required attribute should be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | true |
| Fields[0].NumericFieldSettings.DefaultValue | |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should see "required=\"required\""
# If required and a default value is set, the required attribute should not be used
When I go to "Admin/ContentTypes/Edit/Event"
And I fill in
| name | value |
| Fields[0].NumericFieldSettings.Required | true |
| Fields[0].NumericFieldSettings.DefaultValue | 6 |
And I hit "Save"
And I go to "Admin/Contents/Create/Event"
Then I should not see "required=\"required\""

View File

@@ -265,6 +265,223 @@ this.ScenarioSetup(scenarioInfo);
testRunner.Then("I should see \"The value &#39;a&#39; is not valid for Minimum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 99
testRunner.And("I should see \"The value &#39;b&#39; is not valid for Maximum.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 102
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"false"});
table11.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"4"});
#line 103
testRunner.And("I fill in", ((string)(null)), table11, "And ");
#line 107
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 108
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Event.Guests.Value",
"a"});
#line 109
testRunner.And("I fill in", ((string)(null)), table12, "And ");
#line 112
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 113
testRunner.Then("I should see \"Guests or its default value is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 116
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table13.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"false"});
table13.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"4"});
#line 117
testRunner.And("I fill in", ((string)(null)), table13, "And ");
#line 121
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 122
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table14.AddRow(new string[] {
"Event.Guests.Value",
""});
#line 123
testRunner.And("I fill in", ((string)(null)), table14, "And ");
#line 126
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 127
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 128
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 129
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 130
testRunner.Then("I should see \"Guests:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 131
testRunner.And("I should see \"4\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 134
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table15 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table15.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"true"});
table15.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"5"});
#line 135
testRunner.And("I fill in", ((string)(null)), table15, "And ");
#line 139
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 140
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table16 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table16.AddRow(new string[] {
"Event.Guests.Value",
""});
#line 141
testRunner.And("I fill in", ((string)(null)), table16, "And ");
#line 144
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 145
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 146
testRunner.Then("I should see \"Your Event has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 147
testRunner.When("I go to \"Admin/Contents/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line 148
testRunner.Then("I should see \"Guests:\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 149
testRunner.And("I should see \"5\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 152
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table17 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table17.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"false"});
table17.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"a"});
#line 153
testRunner.And("I fill in", ((string)(null)), table17, "And ");
#line 157
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 158
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table18 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table18.AddRow(new string[] {
"Event.Guests.Value",
""});
#line 159
testRunner.And("I fill in", ((string)(null)), table18, "And ");
#line 162
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 163
testRunner.Then("I should see \"Guests or its default value is an invalid number\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 166
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table19 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table19.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"false"});
table19.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Minimum",
"-10"});
table19.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Maximum",
"100"});
table19.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"-20"});
#line 167
testRunner.And("I fill in", ((string)(null)), table19, "And ");
#line 173
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 174
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line hidden
TechTalk.SpecFlow.Table table20 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table20.AddRow(new string[] {
"Event.Guests.Value",
""});
#line 175
testRunner.And("I fill in", ((string)(null)), table20, "And ");
#line 178
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 179
testRunner.Then("I should see \"The value must be greater than -10\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 182
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table21 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table21.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"true"});
table21.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
""});
#line 183
testRunner.And("I fill in", ((string)(null)), table21, "And ");
#line 187
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 188
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 189
testRunner.Then("I should see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line 192
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
#line hidden
TechTalk.SpecFlow.Table table22 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table22.AddRow(new string[] {
"Fields[0].NumericFieldSettings.Required",
"true"});
table22.AddRow(new string[] {
"Fields[0].NumericFieldSettings.DefaultValue",
"6"});
#line 193
testRunner.And("I fill in", ((string)(null)), table22, "And ");
#line 197
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 198
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
#line 199
testRunner.Then("I should not see \"required=\\\"required\\\"\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
#line hidden
this.ScenarioCleanup();
}

View File

@@ -48,7 +48,12 @@ namespace Orchard.Fields.Drivers {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel<BooleanFieldSettings>();
if (!settings.Optional && !field.Value.HasValue) {
updater.AddModelError(field.Name, T("The field {0} is mandatory.", T(field.DisplayName)));
if (settings.DefaultValue.HasValue) {
field.Value = settings.DefaultValue;
}
else {
updater.AddModelError(field.Name, T("The field {0} is mandatory.", T(field.DisplayName)));
}
}
}

View File

@@ -136,31 +136,41 @@ namespace Orchard.Fields.Drivers {
var showDate = settings.Display == DateTimeFieldDisplays.DateAndTime || settings.Display == DateTimeFieldDisplays.DateOnly;
var showTime = settings.Display == DateTimeFieldDisplays.DateAndTime || settings.Display == DateTimeFieldDisplays.TimeOnly;
DateTime? value = null;
var IsParseError = false;
// If required and one field is missing, don't try to parse data.
if (settings.Required && ((showDate && String.IsNullOrWhiteSpace(viewModel.Editor.Date)) || (showTime && String.IsNullOrWhiteSpace(viewModel.Editor.Time)))) {
updater.AddModelError(GetPrefix(field, part), T("{0} is required.", field.DisplayName));
// And use the default value only if all required fields are empty.
if (!showDate || !showTime || (String.IsNullOrWhiteSpace(viewModel.Editor.Date) && String.IsNullOrWhiteSpace(viewModel.Editor.Time))) {
value = settings.DefaultValue;
}
}
else {
try {
var utcDateTime = DateLocalizationServices.ConvertFromLocalizedString(viewModel.Editor.Date, viewModel.Editor.Time, options);
if (utcDateTime.HasValue) {
// Hackish workaround to make sure a time-only field with an entered time equivalent to
// 00:00 UTC doesn't get stored as a full DateTime.MinValue in the database, resulting
// in it being interpreted as an empty value when subsequently retrieved.
if (settings.Display == DateTimeFieldDisplays.TimeOnly && utcDateTime.Value == DateTime.MinValue) {
field.DateTime = utcDateTime.Value.AddDays(1);
}
else {
field.DateTime = utcDateTime.Value;
}
} else {
field.DateTime = settings.DefaultValue.HasValue ? settings.DefaultValue.Value : DateTime.MinValue;
}
value = utcDateTime.HasValue ? utcDateTime : settings.DefaultValue;
}
catch {
IsParseError = true;
updater.AddModelError(GetPrefix(field, part), T("{0} could not be parsed as a valid date and time.", field.DisplayName));
}
}
if (!IsParseError) {
// Hackish workaround to make sure a time-only field with an entered time equivalent to
// 00:00 UTC doesn't get stored as a full DateTime.MinValue in the database, resulting
// in it being interpreted as an empty value when subsequently retrieved.
if (value.HasValue && settings.Display == DateTimeFieldDisplays.TimeOnly && value == DateTime.MinValue) {
value = value.Value.AddDays(1);
}
if (settings.Required && (!value.HasValue || (settings.Display != DateTimeFieldDisplays.TimeOnly && value.Value.Date == DateTime.MinValue))) {
updater.AddModelError(GetPrefix(field, part), T("{0} is required.", field.DisplayName));
}
}
field.DateTime = value.HasValue ? value.Value : DateTime.MinValue;
}
return Editor(part, field, shapeHelper);

View File

@@ -7,6 +7,7 @@ using Orchard.Localization;
using Orchard.Tokens;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Orchard.Fields.Drivers {
public class EnumerationFieldDriver : ContentFieldDriver<EnumerationField> {
@@ -40,7 +41,7 @@ namespace Orchard.Fields.Drivers {
() => {
if (field.Value == null) {
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
if (!String.IsNullOrEmpty(settings.DefaultValue)) {
if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
}
}
@@ -52,6 +53,16 @@ namespace Orchard.Fields.Drivers {
protected override DriverResult Editor(ContentPart part, EnumerationField field, IUpdateModel updater, dynamic shapeHelper) {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
if (field.SelectedValues.Length == 0 && !String.IsNullOrWhiteSpace(settings.DefaultValue) && !String.IsNullOrWhiteSpace(settings.Options)) {
field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
string[] options = settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
var selectedValues = field.SelectedValues.ToList();
selectedValues.RemoveAll(value => !options.Any(value.Equals));
field.SelectedValues = selectedValues.ToArray();
}
if (settings.Required && field.SelectedValues.Length == 0) {
updater.AddModelError(field.Name, T("The field {0} is mandatory", T(field.DisplayName)));
}

View File

@@ -46,11 +46,11 @@ namespace Orchard.Fields.Drivers {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel<InputFieldSettings>();
if (field.Value == null && !String.IsNullOrEmpty(settings.DefaultValue)) {
if (String.IsNullOrWhiteSpace(field.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
}
if (settings.Required && string.IsNullOrWhiteSpace(field.Value)) {
if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} is mandatory.", T(field.DisplayName)));
}
}

View File

@@ -46,21 +46,21 @@ namespace Orchard.Fields.Drivers {
if (updater.TryUpdateModel(field, GetPrefix(field, part), null, null)) {
var settings = field.PartFieldDefinition.Settings.GetModel<LinkFieldSettings>();
if (String.IsNullOrEmpty(field.Value) && !String.IsNullOrEmpty(settings.DefaultValue)) {
if (String.IsNullOrWhiteSpace(field.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
field.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
}
if(!String.IsNullOrEmpty(settings.TextDefaultValue) && String.IsNullOrWhiteSpace(field.Text)) {
if(!String.IsNullOrWhiteSpace(settings.TextDefaultValue) && String.IsNullOrWhiteSpace(field.Text)) {
field.Text = _tokenizer.Replace(settings.TextDefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
}
if (settings.Required && string.IsNullOrWhiteSpace(field.Value)) {
if (settings.Required && String.IsNullOrWhiteSpace(field.Value)) {
updater.AddModelError(GetPrefix(field, part), T("Url is required for {0}", field.DisplayName));
}
else if (!string.IsNullOrWhiteSpace(field.Value) && !Uri.IsWellFormedUriString(field.Value, UriKind.RelativeOrAbsolute)) {
else if (!String.IsNullOrWhiteSpace(field.Value) && !Uri.IsWellFormedUriString(field.Value, UriKind.RelativeOrAbsolute)) {
updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid url.", field.Value));
}
else if (settings.LinkTextMode == LinkTextMode.Required && string.IsNullOrWhiteSpace(field.Text)) {
else if (settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(field.Text)) {
updater.AddModelError(GetPrefix(field, part), T("Text is required for {0}.", field.DisplayName));
}
}

View File

@@ -64,47 +64,41 @@ namespace Orchard.Fields.Drivers {
var settings = field.PartFieldDefinition.Settings.GetModel<NumericFieldSettings>();
if (settings.Required && String.IsNullOrWhiteSpace(viewModel.Value)) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} is mandatory.", T(field.DisplayName)));
if (String.IsNullOrWhiteSpace(viewModel.Value) && !String.IsNullOrWhiteSpace(settings.DefaultValue)) {
viewModel.Value = _tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } });
}
if (!settings.Required && String.IsNullOrWhiteSpace(viewModel.Value)) {
if (settings.DefaultValue != null) {
if (Decimal.TryParse(_tokenizer.Replace(settings.DefaultValue, new Dictionary<string, object> { { "Content", part.ContentItem } }), NumberStyles.Any, _cultureInfo.Value, out value)
&& Math.Round(value, settings.Scale) == value
&& !String.IsNullOrEmpty(settings.DefaultValue)) {
field.Value = value;
}
}
else {
field.Value = null;
field.Value = null;
if (String.IsNullOrWhiteSpace(viewModel.Value)) {
if (settings.Required) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} is mandatory.", T(field.DisplayName)));
}
}
else if (Decimal.TryParse(viewModel.Value, NumberStyles.Any, _cultureInfo.Value, out value)) {
field.Value = value;
else if (!Decimal.TryParse(viewModel.Value, NumberStyles.Any, _cultureInfo.Value, out value)) {
updater.AddModelError(GetPrefix(field, part), T("{0} or its default value is an invalid number", field.DisplayName));
}
else {
updater.AddModelError(GetPrefix(field, part), T("{0} is an invalid number", field.DisplayName));
field.Value = null;
}
if (settings.Minimum.HasValue && field.Value.HasValue && field.Value.Value < settings.Minimum.Value) {
updater.AddModelError(GetPrefix(field, part), T("The value must be greater than {0}", settings.Minimum.Value));
}
field.Value = value;
if (settings.Maximum.HasValue && field.Value.HasValue && field.Value.Value > settings.Maximum.Value) {
updater.AddModelError(GetPrefix(field, part), T("The value must be less than {0}", settings.Maximum.Value));
}
// checking the number of decimals
if(field.Value.HasValue && Math.Round(field.Value.Value, settings.Scale) != field.Value.Value) {
if(settings.Scale == 0) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} must be an integer", field.DisplayName));
if (settings.Minimum.HasValue && value < settings.Minimum.Value) {
updater.AddModelError(GetPrefix(field, part), T("The value must be greater than {0}", settings.Minimum.Value));
}
else {
updater.AddModelError(GetPrefix(field, part), T("Invalid number of digits for {0}, max allowed: {1}", field.DisplayName, settings.Scale));
if (settings.Maximum.HasValue && value > settings.Maximum.Value) {
updater.AddModelError(GetPrefix(field, part), T("The value must be less than {0}", settings.Maximum.Value));
}
// checking the number of decimals
if (Math.Round(value, settings.Scale) != value) {
if (settings.Scale == 0) {
updater.AddModelError(GetPrefix(field, part), T("The field {0} must be an integer", field.DisplayName));
}
else {
updater.AddModelError(GetPrefix(field, part), T("Invalid number of digits for {0}, max allowed: {1}", field.DisplayName, settings.Scale));
}
}
}
}

View File

@@ -81,7 +81,7 @@
<div>
<label for="@Html.FieldIdFor(m => m.DefaultValue)">@T("Default value")</label>
@Html.TextBoxFor(m => m.DefaultValue, new { @class = "text large tokenized ui-autocomplete-input" })
<span class="hint">@T("A valid url as a default value, i.e. http://orchardproject.net, /content/file.pdf ... You can use tokens in this field. (optional)")</span>
<span class="hint">@T("Default value for the field. You can use tokens in this field. If there is no value given for the actual field, this will be filled in. (optional)")</span>
@Html.ValidationMessageFor(m => m.DefaultValue)
</div>
</fieldset>
</fieldset>

View File

@@ -3,47 +3,49 @@
@{
var settings = Model.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ? settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None) : new string[] { T("Select an option").ToString() };
var isRequired = settings.Required && String.IsNullOrWhiteSpace(settings.DefaultValue);
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)" @if(settings.Required) { <text>class="required"</text> }>@Model.DisplayName</label>
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@Model.DisplayName</label>
@switch (settings.ListMode) {
case ListMode.Dropdown:
@Html.DropDownListFor(m => m.Value, new SelectList(options, Model.Value), settings.Required ? new {required = "required"} : null)
@Html.DropDownListFor(m => m.Value, new SelectList(options, Model.Value), isRequired ? new { required = "required" } : null)
break;
case ListMode.Radiobutton:
foreach (var option in options) {
if (string.IsNullOrWhiteSpace(option)) {
<label>@Html.RadioButton("Value", "", string.IsNullOrWhiteSpace(Model.Value), settings.Required ? new {required = "required"} : null)<i>@T("unset")</i></label>
}
if (string.IsNullOrWhiteSpace(option)) {
<label>@Html.RadioButton("Value", "", string.IsNullOrWhiteSpace(Model.Value), isRequired ? new { required = "required" } : null)<i>@T("unset")</i></label> }
else {
<label>@Html.RadioButton("Value", option, (option == Model.Value), settings.Required ? new {required = "required"} : null)@option</label>
}
<label>@Html.RadioButton("Value", option, (option == Model.Value), isRequired ? new { required = "required" } : null)@option</label> }
}
break;
case ListMode.Listbox:
<input name="@Html.FieldNameFor(m => m.SelectedValues)" type="hidden" />
@Html.ListBoxFor(m => m.SelectedValues, new MultiSelectList(options, Model.SelectedValues), settings.Required ? new {required = "required"} : null)
@Html.ListBoxFor(m => m.SelectedValues, new MultiSelectList(options, Model.SelectedValues), isRequired ? new { required = "required" } : null)
break;
case ListMode.Checkbox:
int index = 0;
<input name="@Html.FieldNameFor(m => m.SelectedValues)" type="hidden" />
foreach (var option in options) {
index++;
if (!string.IsNullOrWhiteSpace(option)) {
foreach (var option in options) {
index++;
if (!string.IsNullOrWhiteSpace(option)) {
<div>
<input type="checkbox" name="@Html.FieldNameFor(m => m.SelectedValues)" value="@option" @((Model.SelectedValues != null && Model.SelectedValues.Contains(option)) ? "checked=\"checked\"" : "") class="check-box" id="@Html.FieldIdFor(m => m.SelectedValues)-@index" @if(settings.Required) {<text> required="required"</text> } />
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.SelectedValues)-@index">@T(option)</label>
<input type="checkbox" name="@Html.FieldNameFor(m => m.SelectedValues)" value="@option" @((Model.SelectedValues != null && Model.SelectedValues.Contains(option)) ? "checked=\"checked\"" : "") class="check-box" id="@Html.FieldIdFor(m => m.SelectedValues)-@index" />
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.SelectedValues)-@index">@T(option)</label>
</div>
}
}
break;
}
}
break;
}
@Html.ValidationMessageFor(m => m.SelectedValues)
@if (HasText(settings.Hint)) {
<span class="hint">@settings.Hint</span>
<span class="hint">@settings.Hint</span>
}
</fieldset>
@if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
<span class="hint">@T("If no option is selected then the default value will be used.")</span>
}
</fieldset>

View File

@@ -3,13 +3,14 @@
@using Orchard.Fields.Settings;
@{
var settings = Model.PartFieldDefinition.Settings.GetModel<InputFieldSettings>();
var isRequired = settings.Required && String.IsNullOrWhiteSpace(settings.DefaultValue);
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)" @if(settings.Required) { <text>class="required"</text> }>@Model.DisplayName</label>
<input type="@settings.Type.ToString().ToLower()" id="@Html.FieldIdFor(m => m.Value)" name="@Html.FieldNameFor(m => m.Value)"@if(!String.IsNullOrWhiteSpace(settings.Title)) {<text> title="@settings.Title"</text>} value="@Model.Value"@if(settings.Required) {<text> required="required"</text> }@if(settings.AutoFocus) {<text> autofocus="autofocus"</text> }@if(settings.AutoComplete) {<text> autocomplete="on"</text> }@if(!string.IsNullOrWhiteSpace(settings.Placeholder)) {<text> placeholder="@settings.Placeholder"</text>}@if(!string.IsNullOrEmpty(settings.Pattern)) {<text> pattern="@settings.Pattern"</text>}@if(!string.IsNullOrEmpty(settings.EditorCssClass)) {<text> class="@settings.EditorCssClass"</text>} else {<text> class="text medium"</text>} @if(settings.MaxLength > 1) {<text> maxlength="@settings.MaxLength.ToString()"</text>} />
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@Model.DisplayName</label>
<input type="@settings.Type.ToString().ToLower()" id="@Html.FieldIdFor(m => m.Value)" name="@Html.FieldNameFor(m => m.Value)" @if (!String.IsNullOrWhiteSpace(settings.Title)) { <text> title="@settings.Title" </text> } value="@Model.Value" @if (isRequired) { <text> required="required" </text> } @if (settings.AutoFocus) { <text> autofocus="autofocus" </text> } @if (settings.AutoComplete) { <text> autocomplete="on" </text> } @if (!String.IsNullOrWhiteSpace(settings.Placeholder)) { <text> placeholder="@settings.Placeholder" </text> } @if (!String.IsNullOrWhiteSpace(settings.Pattern)) { <text> pattern="@settings.Pattern" </text> } @if (!String.IsNullOrWhiteSpace(settings.EditorCssClass)) { <text> class="@settings.EditorCssClass" </text> } else { <text> class="text medium" </text> } @if (settings.MaxLength > 1) { <text> maxlength="@settings.MaxLength.ToString()" </text> } />
@Html.ValidationMessageFor(m => m.Value)
@if (HasText(settings.Hint)) {
<span class="hint">@settings.Hint</span>
<span class="hint">@settings.Hint</span>
}
@if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
<span class="hint">@T("If the field is left empty then the default value will be used.")</span>

View File

@@ -2,7 +2,7 @@
@using Orchard.Fields.Settings;
@{
var settings = Model.PartFieldDefinition.Settings.GetModel<LinkFieldSettings>();
string target = string.Empty;
string target = String.Empty;
switch (settings.TargetMode) {
case TargetMode.NewWindow:
target = "_blank";
@@ -13,18 +13,21 @@
case TargetMode.Top:
target = "_top";
break;
}
}
var isRequired = settings.Required && String.IsNullOrWhiteSpace(settings.DefaultValue);
var isTextRequired = settings.LinkTextMode == LinkTextMode.Required && String.IsNullOrWhiteSpace(settings.TextDefaultValue);
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)">@Model.DisplayName</label>
@if (HasText(settings.Hint)) {
<span class="hint">@settings.Hint</span>
<span class="hint">@settings.Hint</span>
}
<div class="editor-label">
<label for="@Html.FieldIdFor(m => m.Value)" @if(settings.Required) { <text>class="required"</text> }>@T("Url")</label>
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@T("Url")</label>
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.Value, new { @class = "text large", placeholder = settings.UrlPlaceholder })
@(isRequired ? Html.TextBoxFor(m => m.Value, new { @class = "text large", placeholder = settings.UrlPlaceholder, required = "required" }) : Html.TextBoxFor(m => m.Value, new { @class = "text large", placeholder = settings.UrlPlaceholder }))
<span class="hint">@T("A valid url, i.e. http://orchardproject.net, /content/file.pdf, ...")</span>
</div>
@if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
@@ -32,10 +35,10 @@
}
@if (settings.LinkTextMode == LinkTextMode.Optional || settings.LinkTextMode == LinkTextMode.Required) {
<div class="editor-label">
<label for="@Html.FieldIdFor(m => m.Text)" @if(settings.LinkTextMode == LinkTextMode.Required) { <text>class="required"</text> }>@T("Text")</label>
<label for="@Html.FieldIdFor(m => m.Text)" @if (settings.LinkTextMode == LinkTextMode.Required) { <text> class="required" </text> }>@T("Text")</label>
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.Text, new { @class = "text medium", placeholder = settings.TextPlaceholder })
@(isTextRequired ? Html.TextBoxFor(m => m.Text, new { @class = "text medium", placeholder = settings.UrlPlaceholder, required = "required" }) : Html.TextBoxFor(m => m.Text, new { @class = "text medium", placeholder = settings.UrlPlaceholder }))
@if (!String.IsNullOrWhiteSpace(settings.TextDefaultValue)) {
<span class="hint">@T("If the field is left empty then the default value will be used.")</span>
}
@@ -44,13 +47,13 @@
}
</div>
}
@if (settings.TargetMode == TargetMode.UserChoice) {
<div class="editor-label">
<label for="@Html.FieldIdFor(m => m.Target)">@T("Target")</label>
</div>
<div class="editor-field">
@Html.TextBoxFor(m => m.Target, new { @class = "text"})
@Html.TextBoxFor(m => m.Target, new { @class = "text" })
<span class="hint">@T("A valid HTML target attribute value. e.g., _blank, _parent, _top, or an anchor. ")</span>
</div>
}

View File

@@ -2,14 +2,32 @@
@using System.Globalization
@using Orchard.Fields.Settings;
@{
var isRequired = Model.Settings.Required && String.IsNullOrWhiteSpace(Model.Settings.DefaultValue);
var hasValue = !String.IsNullOrWhiteSpace(Model.Value);
var attributes = new Dictionary<string, object>();
attributes.Add("class", "text-small"); attributes.Add("type", "text");
attributes.Add("min", Model.Settings.Minimum.HasValue ? Model.Settings.Minimum.Value : 0);
attributes.Add("max", Model.Settings.Maximum.HasValue ? Model.Settings.Maximum.Value : 1000000);
attributes.Add("step", Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture));
attributes.Add("placeholder", Model.Settings.Placeholder);
if (isRequired) {
attributes.Add("required", "required");
}
if (hasValue) {
attributes.Add("Value", Model.Value);
}
}
<fieldset>
<label for="@Html.FieldIdFor(m => m.Value)" @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.Field.DisplayName</label>
@(Model.Settings.Required
? Html.TextBoxFor(m => m.Value, new {@class = "text-small", type = "text", min = (Model.Settings.Minimum.HasValue) ? Model.Settings.Minimum.Value : 0, max = (Model.Settings.Maximum.HasValue) ? Model.Settings.Maximum.Value : 1000000, step = Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture), required = "required", placeholder = Model.Settings.Placeholder })
: Html.TextBoxFor(m => m.Value, new {@class = "text-small", type = "text", min = (Model.Settings.Minimum.HasValue) ? Model.Settings.Minimum.Value : 0, max = (Model.Settings.Maximum.HasValue) ? Model.Settings.Maximum.Value : 1000000, step = Math.Pow(10, 0 - Model.Settings.Scale).ToString(CultureInfo.InvariantCulture), placeholder = Model.Settings.Placeholder }))
<label for="@Html.FieldIdFor(m => m.Value)" @if (Model.Settings.Required) { <text> class="required" </text> }>@Model.Field.DisplayName</label>
@Html.TextBoxFor(m => m.Value, attributes)
@Html.ValidationMessageFor(m => m.Value)
@if (HasText(Model.Settings.Hint)) {
<span class="hint">@Model.Settings.Hint</span>
<span class="hint">@Model.Settings.Hint</span>
}
@if (!String.IsNullOrWhiteSpace(Model.Settings.DefaultValue)) {
<span class="hint">@T("If the field is left empty then the default value will be used.")</span>