From 3219053649be53ce2c24fc0a788ff462a32821ad Mon Sep 17 00:00:00 2001 From: Andre Rodrigues Date: Mon, 11 Oct 2010 11:27:20 -0700 Subject: [PATCH] Applied review comments. --HG-- branch : dev --- .../Widgets/Services/WidgetsServiceTest.cs | 3 +- .../Controllers/AdminController.cs | 36 ++++++++----------- .../Orchard.Widgets/Orchard.Widgets.csproj | 8 ++--- 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/Orchard.Tests.Modules/Widgets/Services/WidgetsServiceTest.cs b/src/Orchard.Tests.Modules/Widgets/Services/WidgetsServiceTest.cs index 792aab17a..b371f269b 100644 --- a/src/Orchard.Tests.Modules/Widgets/Services/WidgetsServiceTest.cs +++ b/src/Orchard.Tests.Modules/Widgets/Services/WidgetsServiceTest.cs @@ -198,8 +198,7 @@ namespace Orchard.Tests.Modules.Widgets.Services { } [Test] - public void GetZonesTest() - { + public void GetZonesTest() { IEnumerable zones = _widgetService.GetZones(); Assert.That(zones.Count(), Is.EqualTo(2), "One zone on the mock list"); Assert.That(zones.FirstOrDefault(zone => zone == ThemeZoneName1), Is.Not.Null); diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs index 39a1af490..018e9779a 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Controllers/AdminController.cs @@ -84,7 +84,8 @@ namespace Orchard.Widgets.Controllers { _widgetsService.MoveWidgetUp(int.Parse(moveUpAction)); } } - } catch (Exception exception) { + } + catch (Exception exception) { Services.Notifier.Error(T("Moving widget failed: {0}", exception.Message)); } @@ -95,8 +96,7 @@ namespace Orchard.Widgets.Controllers { if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel))) return new HttpUnauthorizedResult(); - try - { + try { WidgetPart widgetPart = Services.ContentManager.New(widgetType); if (widgetPart == null) return new NotFoundResult(); @@ -104,16 +104,14 @@ namespace Orchard.Widgets.Controllers { dynamic model = Services.ContentManager.BuildEditor(widgetPart); return View(model); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message)); return RedirectToAction("Index"); } } [HttpPost, ActionName("AddWidget")] - public ActionResult AddWidgetPOST(int layerId, string widgetType) - { + public ActionResult AddWidgetPOST(int layerId, string widgetType) { if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel))) return new HttpUnauthorizedResult(); @@ -132,8 +130,7 @@ namespace Orchard.Widgets.Controllers { Services.Notifier.Information(T("Your {0} has been created.", widgetPart.TypeDefinition.DisplayName)); return RedirectToAction("Index"); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -151,8 +148,7 @@ namespace Orchard.Widgets.Controllers { dynamic model = Services.ContentManager.BuildEditor(layerPart); return View(model); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -177,8 +173,7 @@ namespace Orchard.Widgets.Controllers { Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName)); return RedirectToAction("Index"); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -197,8 +192,7 @@ namespace Orchard.Widgets.Controllers { dynamic model = Services.ContentManager.BuildEditor(layerPart); return View(model); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -224,8 +218,7 @@ namespace Orchard.Widgets.Controllers { Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName)); return RedirectToAction("Index"); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -262,8 +255,7 @@ namespace Orchard.Widgets.Controllers { dynamic model = Services.ContentManager.BuildEditor(widgetPart); return View(model); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -289,8 +281,7 @@ namespace Orchard.Widgets.Controllers { Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName)); return RedirectToAction("Index"); } - catch (Exception exception) - { + catch (Exception exception) { Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message)); return RedirectToAction("Index"); } @@ -305,7 +296,8 @@ namespace Orchard.Widgets.Controllers { try { _widgetsService.DeleteWidget(id); Services.Notifier.Information(T("Widget was successfully deleted")); - } catch (Exception exception) { + } + catch (Exception exception) { Services.Notifier.Error(T("Removing Widget failed: {0}", exception.Message)); } diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj index 39084ec68..f71910ccf 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj @@ -107,15 +107,13 @@ - - Designer - + - - + +