Updating the features admin UI to drop the "Core" category to the bottom of the page

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-25 02:36:21 -07:00
parent 89864bee85
commit 8a33ee043a
3 changed files with 31 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
namespace Orchard.Modules.Models {
public class DoghouseComparer : IComparer<string> {
private readonly string _theDog;
public DoghouseComparer(string theDog) {
_theDog = theDog;
}
public int Compare(string x, string y) {
if (x == null || y == null)
return x == null && y == null ? 0 : (x == null ? -1 : 1);
if (string.Equals(x, y, StringComparison.OrdinalIgnoreCase))
return 0;
if (string.Equals(x, _theDog, StringComparison.OrdinalIgnoreCase))
return 1;
if (string.Equals(y, _theDog, StringComparison.OrdinalIgnoreCase))
return -1;
return string.Compare(x, y, StringComparison.OrdinalIgnoreCase);
}
}
}

View File

@@ -69,6 +69,7 @@
<Compile Include="Commands\FeatureCommands.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Models\DoghouseComparer.cs" />
<Compile Include="Models\ModuleFeature.cs" />
<Compile Include="ViewModels\FeaturesViewModel.cs" />
<Compile Include="Models\Module.cs" />

View File

@@ -2,12 +2,13 @@
<%@ Import Namespace="Orchard.Localization" %>
<%@ Import Namespace="Orchard.Modules.Extensions" %>
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
<%@ Import Namespace="Orchard.Utility.Extensions" %><%
<%@ Import Namespace="Orchard.Utility.Extensions" %>
<%@ Import Namespace="Orchard.Modules.Models" %><%
Html.RegisterStyle("admin.css"); %>
<h1><%: Html.TitleForPage(T("Manage Features").ToString()) %></h1>
<% if (Model.Features.Count() > 0) { %>
<ul class="<% Html.RenderPartial("UI/Switchable", "features summary-view"); %>"><%
var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category).GroupBy(f => f.Descriptor.Category);
var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category, new DoghouseComparer("Core")).GroupBy(f => f.Descriptor.Category);
foreach (var featureGroup in featureGroups) {
var categoryName = LocalizedString.TextOrDefault(featureGroup.First().Descriptor.Category, T("Uncategorized"));
var categoryClassName = string.Format("category {0}", Html.Encode(categoryName.ToString().HtmlClassify()));