Skip to content

Commit

Permalink
fix: only migrate old data
Browse files Browse the repository at this point in the history
  • Loading branch information
jptissot committed Jun 9, 2021
1 parent 500b420 commit adde04d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
42 changes: 25 additions & 17 deletions src/Modules/StatCan.OrchardCore.VueForms/Migrations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,29 +364,37 @@ public async Task<int> UpdateFrom6Async()
// form.Content.VueFormScripts.OnValidation = null;

var flow = form.As<FlowPart>();
var templateBuilder = new StringBuilder();
foreach (var widget in flow.Widgets)
if (flow != null)
{
if (widget.ContentType == "VueComponent")
var templateBuilder = new StringBuilder();
foreach (var widget in flow.Widgets)
{
templateBuilder.Append((string)widget.Content.VueComponent.Template.Text);
templateBuilder.AppendLine();
if (widget.ContentType == "VueComponent")
{
templateBuilder.Append((string)widget.Content.VueComponent.Template.Text);
templateBuilder.AppendLine();
}
}
form.Remove("FlowPart");
form.Alter<VueForm>(v =>
{
v.Template = new TextField() { Text = templateBuilder.ToString() };
});
}
form.Remove("FlowPart");

var isDisabled = false;
if (form.Content?.VueForm?.Enabled?.Value != null)
if(form.Content?.VueForm?.Disabled == null)
{
isDisabled = !(bool)form.Content.VueForm.Enabled.Value;
}
form.Content.VueForm.Enabled = null;
var isDisabled = false;
if (form.Content?.VueForm?.Enabled?.Value != null)
{
isDisabled = !(bool)form.Content.VueForm.Enabled.Value;
}
form.Content.VueForm.Enabled = null;

form.Alter<VueForm>(v =>
{
v.Disabled = new BooleanField() { Value = isDisabled };
v.Template = new TextField() { Text = templateBuilder.ToString() };
});
form.Alter<VueForm>(v =>
{
v.Disabled = new BooleanField() { Value = isDisabled };
});
}
_session.Save(form);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Themes/DigitalAdmin/Views/TextField-Monaco.Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ $(document).ready(function () {
const defaultSettings = {
"scrollBeyondLastLine": false,
"scrollbar": {
// allow the page to scroll when bottom of editor is scrolling
//"alwaysConsumeMouseWheel": false,
// allow the page to scroll when bottom of editor is scrolling
"alwaysConsumeMouseWheel": false,
}
}
Expand Down

0 comments on commit adde04d

Please sign in to comment.