mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixed default layout data for Form.
This commit is contained in:
@@ -5,6 +5,27 @@ using Orchard.Data.Migration;
|
||||
|
||||
namespace Orchard.DynamicForms {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
private const string DefaultFormLayoutData =
|
||||
@"{
|
||||
""elements"": [
|
||||
{
|
||||
""typeName"": ""Orchard.Layouts.Elements.Canvas"",
|
||||
""elements"": [
|
||||
{
|
||||
""typeName"": ""Orchard.DynamicForms.Elements.Form"",
|
||||
""data"": ""FormName=Untitled&FormAction=&FormMethod=POST&FormBindingContentType=&Publication=Draft&Notification=&RedirectUrl="",
|
||||
""elements"": [
|
||||
{
|
||||
""typeName"": ""Orchard.DynamicForms.Elements.Button"",
|
||||
""data"": ""InputName=&FormBindingContentType=&Text=Submit""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}";
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("Submission", table => table
|
||||
.Column<int>("Id", c => c.PrimaryKey().Identity())
|
||||
@@ -23,16 +44,7 @@ namespace Orchard.DynamicForms {
|
||||
.WithSetting("AutorouteSettings.PatternDefinitions", "[{\"Name\":\"Title\",\"Pattern\":\"{Content.Slug}\",\"Description\":\"my-form\"}]")
|
||||
.WithSetting("AutorouteSettings.DefaultPatternIndex", "0"))
|
||||
.WithPart("LayoutPart", p => p
|
||||
.WithSetting("LayoutTypePartSettings.DefaultLayoutData",
|
||||
"{" +
|
||||
"\"elements\": [{" +
|
||||
"\"typeName\": \"Orchard.DynamicForms.Elements.Form\"," +
|
||||
"\"elements\": [{" +
|
||||
"\"typeName\": \"Orchard.DynamicForms.Elements.Button\"," +
|
||||
"\"state\": \"ButtonText=Submit\"" +
|
||||
"}]" +
|
||||
"}]" +
|
||||
"}"))
|
||||
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", DefaultFormLayoutData))
|
||||
.DisplayedAs("Form")
|
||||
.Listable()
|
||||
.Creatable()
|
||||
@@ -44,16 +56,7 @@ namespace Orchard.DynamicForms {
|
||||
.WithSetting("DateEditorSettings.ShowDateEditor", "false"))
|
||||
.WithPart("WidgetPart")
|
||||
.WithPart("LayoutPart", p => p
|
||||
.WithSetting("LayoutTypePartSettings.DefaultLayoutData",
|
||||
"{" +
|
||||
"\"elements\": [{" +
|
||||
"\"typeName\": \"Orchard.DynamicForms.Elements.Form\"," +
|
||||
"\"elements\": [{" +
|
||||
"\"typeName\": \"Orchard.DynamicForms.Elements.Button\"," +
|
||||
"\"state\": \"ButtonText=Submit\"" +
|
||||
"}]" +
|
||||
"}]" +
|
||||
"}"))
|
||||
.WithSetting("LayoutTypePartSettings.DefaultLayoutData", DefaultFormLayoutData))
|
||||
.WithSetting("Stereotype", "Widget")
|
||||
.DisplayedAs("Form Widget"));
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user