Ordered layers alphabetically in Widget admin UI.

This commit is contained in:
mahsaro
2015-08-04 15:02:08 +01:00
parent 8a08680a74
commit 3657cfecab

View File

@@ -61,7 +61,7 @@ namespace Orchard.Widgets.Controllers {
return RedirectToAction("Index", "Admin", new { area = "Dashboard" }); return RedirectToAction("Index", "Admin", new { area = "Dashboard" });
} }
IEnumerable<LayerPart> layers = _widgetsService.GetLayers().ToList(); IEnumerable<LayerPart> layers = _widgetsService.GetLayers().OrderBy(x => x.Name).ToList();
if (!layers.Any()) { if (!layers.Any()) {
Services.Notifier.Error(T("There are no widget layers defined. A layer will need to be added in order to add widgets to any part of the site.")); Services.Notifier.Error(T("There are no widget layers defined. A layer will need to be added in order to add widgets to any part of the site."));
@@ -87,10 +87,10 @@ namespace Orchard.Widgets.Controllers {
if (!String.IsNullOrWhiteSpace(culture)) { if (!String.IsNullOrWhiteSpace(culture)) {
widgets = widgets.Where(x => { widgets = widgets.Where(x => {
if(x.Has<ILocalizableAspect>()) { if (x.Has<ILocalizableAspect>()) {
return String.Equals(x.As<ILocalizableAspect>().Culture, culture, StringComparison.InvariantCultureIgnoreCase); return String.Equals(x.As<ILocalizableAspect>().Culture, culture, StringComparison.InvariantCultureIgnoreCase);
} }
return false; return false;
}).ToList(); }).ToList();
} }
@@ -142,7 +142,7 @@ namespace Orchard.Widgets.Controllers {
return RedirectToAction("Index"); return RedirectToAction("Index");
} }
IEnumerable<LayerPart> layers = _widgetsService.GetLayers().ToList(); IEnumerable<LayerPart> layers = _widgetsService.GetLayers().OrderBy(x => x.Name).ToList();
if (!layers.Any()) { if (!layers.Any()) {
Services.Notifier.Error(T("Layer not found: {0}", layerId)); Services.Notifier.Error(T("Layer not found: {0}", layerId));
@@ -315,7 +315,8 @@ namespace Orchard.Widgets.Controllers {
try { try {
_widgetsService.DeleteLayer(id); _widgetsService.DeleteLayer(id);
Services.Notifier.Information(T("Layer was successfully deleted")); Services.Notifier.Information(T("Layer was successfully deleted"));
} catch (Exception exception) { }
catch (Exception exception) {
Logger.Error(T("Removing Layer failed: {0}", exception.Message).Text); Logger.Error(T("Removing Layer failed: {0}", exception.Message).Text);
Services.Notifier.Error(T("Removing Layer failed: {0}", exception.Message)); Services.Notifier.Error(T("Removing Layer failed: {0}", exception.Message));
} }