mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19732: Retaining update editor for custom forms widgets
Work Item: 19732 --HG-- branch : 1.x
This commit is contained in:
@@ -130,7 +130,10 @@ namespace Orchard.CustomForms.Controllers {
|
||||
if (form.ContentType == "CustomFormWidget") {
|
||||
foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage)) {
|
||||
Services.Notifier.Error(T(error));
|
||||
}
|
||||
}
|
||||
|
||||
// save the updated editor shape into TempData to survive a redirection and keep the edited values
|
||||
TempData["CustomFormWidget.InvalidCustomFormState"] = model;
|
||||
|
||||
if (returnUrl != null) {
|
||||
return this.RedirectLocal(returnUrl);
|
||||
|
@@ -1,14 +1,18 @@
|
||||
@using Orchard.ContentManagement;
|
||||
|
||||
@{
|
||||
@{
|
||||
dynamic editor = Model.Editor;
|
||||
|
||||
if (TempData.ContainsKey("CustomFormWidget.InvalidCustomFormState")) {
|
||||
editor = TempData["CustomFormWidget.InvalidCustomFormState"];
|
||||
}
|
||||
|
||||
// remove default Save/Publish buttons
|
||||
Model.Editor.Zones["Sidebar"].Items.Clear();
|
||||
editor.Zones["Sidebar"].Items.Clear();
|
||||
}
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Create", "Item", new { area = "Orchard.CustomForms", id = Model.ContentItem.Id }))) {
|
||||
@Html.ValidationSummary()
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model.Editor)
|
||||
@Display(editor)
|
||||
|
||||
@Html.Hidden("returnUrl", Request.RawUrl);
|
||||
|
||||
|
Reference in New Issue
Block a user