mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
#19169: Fixing Custom Forms redirection scenarios
Work Item: 19169 --HG-- branch : 1.x
This commit is contained in:
@@ -131,8 +131,9 @@ namespace Orchard.CustomForms.Controllers {
|
||||
foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage)) {
|
||||
Services.Notifier.Error(T(error));
|
||||
}
|
||||
|
||||
if (returnUrl != null) {
|
||||
return Redirect(returnUrl);
|
||||
return this.RedirectLocal(returnUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +166,8 @@ namespace Orchard.CustomForms.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
return this.RedirectLocal(returnUrl, () => Redirect(Request.RawUrl));
|
||||
var referrer = Request.UrlReferrer != null ? Request.UrlReferrer.ToString() : null;
|
||||
return this.RedirectLocal(returnUrl, () => this.RedirectLocal(referrer, () => Redirect(Request.RawUrl)));
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
|
@@ -33,8 +33,7 @@ namespace Orchard.CustomForms.Drivers {
|
||||
return ContentShape("Parts_CustomForm_Wrapper", () => {
|
||||
return shapeHelper.Parts_CustomForm_Wrapper()
|
||||
.Editor(_orchardServices.ContentManager.BuildEditor(contentItem))
|
||||
.ContenItem(part)
|
||||
.ReturnUrl(part.Redirect ? part.RedirectUrl : _orchardServices.WorkContext.HttpContext.Request.RawUrl);
|
||||
.ContenItem(part);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
@{
|
||||
ContentItem customForm = Model.ContentItem;
|
||||
string returnUrl = Model.ReturnUrl;
|
||||
|
||||
// remove default Save/Publish buttons
|
||||
Model.Editor.Zones["Sidebar"].Items.Clear();
|
||||
@@ -13,7 +12,7 @@
|
||||
// Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type
|
||||
@Display(Model.Editor)
|
||||
|
||||
@Html.Hidden("returnUrl", returnUrl);
|
||||
@Html.Hidden("returnUrl", Request.RawUrl);
|
||||
|
||||
<fieldset class="submit-button">
|
||||
<button type="submit" name="submit.Save" value="submit.Save">@T("Submit")</button>
|
||||
|
Reference in New Issue
Block a user