Applied review comments.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-10-11 11:27:20 -07:00
parent 140f4d22cc
commit 3219053649
3 changed files with 18 additions and 29 deletions

View File

@@ -198,8 +198,7 @@ namespace Orchard.Tests.Modules.Widgets.Services {
}
[Test]
public void GetZonesTest()
{
public void GetZonesTest() {
IEnumerable<string> 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);

View File

@@ -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<WidgetPart>(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));
}

View File

@@ -107,15 +107,13 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="Views\Admin\AddLayer.cshtml">
<SubType>Designer</SubType>
</None>
<None Include="Views\Admin\AddLayer.cshtml" />
<None Include="Views\Admin\AddWidget.cshtml" />
<None Include="Views\Admin\EditWidget.cshtml" />
<None Include="Views\Admin\EditLayer.cshtml" />
<None Include="Views\Admin\Index.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />