mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Using the returnUrl in the rest of the Widget's admin controller
--HG-- branch : dev
This commit is contained in:
@@ -235,7 +235,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
[HttpPost, ActionName("EditLayer")]
|
||||
[FormValueRequired("submit.Save")]
|
||||
public ActionResult EditLayerSavePOST(int id, string returnUrl) {
|
||||
public ActionResult EditLayerSavePOST(int id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -257,12 +257,12 @@ namespace Orchard.Widgets.Controllers {
|
||||
this.Error(exception, T("Editing layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
}
|
||||
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("EditLayer")]
|
||||
[FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditLayerDeletePOST(int id) {
|
||||
public ActionResult EditLayerDeletePOST(int id, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
this.Error(exception, T("Removing Layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
}
|
||||
|
||||
public ActionResult EditWidget(int id) {
|
||||
@@ -304,7 +304,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
[HttpPost, ActionName("EditWidget")]
|
||||
[FormValueRequired("submit.Save")]
|
||||
public ActionResult EditWidgetSavePOST(int id, int layerId) {
|
||||
public ActionResult EditWidgetSavePOST(int id, int layerId, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -327,14 +327,12 @@ namespace Orchard.Widgets.Controllers {
|
||||
this.Error(exception, T("Editing widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
}
|
||||
|
||||
return widgetPart != null ?
|
||||
RedirectToAction("Index", "Admin", new { id = widgetPart.LayerPart.Id }) :
|
||||
RedirectToAction("Index");
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("EditWidget")]
|
||||
[FormValueRequired("submit.Delete")]
|
||||
public ActionResult EditWidgetDeletePOST(int id) {
|
||||
public ActionResult EditWidgetDeletePOST(int id, string returnUrl) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
@@ -350,9 +348,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
this.Error(exception, T("Removing Widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
}
|
||||
|
||||
return widgetPart != null ?
|
||||
RedirectToAction("Index", "Admin", new { id = widgetPart.LayerPart.Id }) :
|
||||
RedirectToAction("Index");
|
||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
|
@@ -49,7 +49,7 @@
|
||||
int i = 0;
|
||||
foreach (WidgetPart widget in widgets.Where(w => w.Zone == zone).OrderBy(w => w.Position, new Orchard.UI.FlatPositionComparer())) {
|
||||
<li>
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id })</h3>
|
||||
<h3>@Html.ActionLink(HasText(widget.Title) ? widget.Title : widget.TypeDefinition.DisplayName, "EditWidget", new { @widget.Id, returnUrl })</h3>
|
||||
<div class="widgets-move-somewhere">
|
||||
<button name="moveUp" value="@widget.Id" @(i == 0 ? "disabled='disabled'" : "") class="widgets-move widgets-move-up" type="submit" title="@T("Move up")">@T("Move up")</button>
|
||||
<button name="moveDown" value="@widget.Id" @(++i == count ? "disabled='disabled'" : "") class="widgets-move widgets-move-down" type="submit" title="@T("Move down")">@T("Move down")</button>
|
||||
|
Reference in New Issue
Block a user