mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Applied review comments.
--HG-- branch : dev
This commit is contained in:
@@ -198,8 +198,7 @@ namespace Orchard.Tests.Modules.Widgets.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetZonesTest()
|
public void GetZonesTest() {
|
||||||
{
|
|
||||||
IEnumerable<string> zones = _widgetService.GetZones();
|
IEnumerable<string> zones = _widgetService.GetZones();
|
||||||
Assert.That(zones.Count(), Is.EqualTo(2), "One zone on the mock list");
|
Assert.That(zones.Count(), Is.EqualTo(2), "One zone on the mock list");
|
||||||
Assert.That(zones.FirstOrDefault(zone => zone == ThemeZoneName1), Is.Not.Null);
|
Assert.That(zones.FirstOrDefault(zone => zone == ThemeZoneName1), Is.Not.Null);
|
||||||
|
@@ -84,7 +84,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
_widgetsService.MoveWidgetUp(int.Parse(moveUpAction));
|
_widgetsService.MoveWidgetUp(int.Parse(moveUpAction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception exception) {
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Moving widget failed: {0}", exception.Message));
|
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)))
|
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
WidgetPart widgetPart = Services.ContentManager.New<WidgetPart>(widgetType);
|
WidgetPart widgetPart = Services.ContentManager.New<WidgetPart>(widgetType);
|
||||||
if (widgetPart == null)
|
if (widgetPart == null)
|
||||||
return new NotFoundResult();
|
return new NotFoundResult();
|
||||||
@@ -104,16 +104,14 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, ActionName("AddWidget")]
|
[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)))
|
if (!Services.Authorizer.Authorize(Permissions.ManageWidgets, T(NotAuthorizedManageWidgetsLabel)))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -132,8 +130,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
Services.Notifier.Information(T("Your {0} has been created.", widgetPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been created.", widgetPart.TypeDefinition.DisplayName));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -151,8 +148,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -177,8 +173,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -197,8 +192,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -224,8 +218,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -262,8 +255,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -289,8 +281,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception) {
|
||||||
{
|
|
||||||
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -305,7 +296,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
try {
|
try {
|
||||||
_widgetsService.DeleteWidget(id);
|
_widgetsService.DeleteWidget(id);
|
||||||
Services.Notifier.Information(T("Widget was successfully deleted"));
|
Services.Notifier.Information(T("Widget was successfully deleted"));
|
||||||
} catch (Exception exception) {
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Removing Widget failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Removing Widget failed: {0}", exception.Message));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,15 +107,13 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Views\Admin\AddLayer.cshtml">
|
<None Include="Views\Admin\AddLayer.cshtml" />
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
<None Include="Views\Admin\AddWidget.cshtml" />
|
<None Include="Views\Admin\AddWidget.cshtml" />
|
||||||
<None Include="Views\Admin\EditWidget.cshtml" />
|
<None Include="Views\Admin\EditWidget.cshtml" />
|
||||||
<None Include="Views\Admin\EditLayer.cshtml" />
|
<None Include="Views\Admin\EditLayer.cshtml" />
|
||||||
<None Include="Views\Admin\Index.cshtml" />
|
<None Include="Views\Admin\Index.cshtml" />
|
||||||
<Content Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetPart.cshtml" />
|
||||||
<Content Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.LayerPart.cshtml" />
|
||||||
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
<None Include="Views\EditorTemplates\Parts\Widgets.WidgetBagPart.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
Reference in New Issue
Block a user