Use DisplayName (which is now called Name) in web UI list of features and modules. Note that not all modules have a name, so we fall to Id if not given.

--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-11-18 16:42:05 -08:00
parent 67cb21d12b
commit ee8c482bef
2 changed files with 6 additions and 5 deletions

View File

@@ -32,7 +32,7 @@
var features = featureGroup.OrderBy(f => f.Descriptor.Name);
foreach (var feature in features) {
//hmmm...I feel like I've done this before...
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
var featureId = feature.Descriptor.Id.AsFeatureId(n => T(n));
var featureName = string.IsNullOrEmpty(feature.Descriptor.Name) ? feature.Descriptor.Id : feature.Descriptor.Name;
var featureState = feature.IsEnabled ? "enabled" : "disabled";
var featureClassName = string.Format("feature {0}", featureState + (feature.NeedsUpdate ? " update" : String.Empty));
@@ -42,6 +42,8 @@
if (feature == features.Last()) {
featureClassName += " last";
}
var dependencies = (from d in feature.Descriptor.Dependencies
select (from f in Model.Features where f.Descriptor.Id == d select f).Single()).OrderBy(f => f.Descriptor.Name);
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
<div class="summary">
<div class="properties">
@@ -49,9 +51,8 @@
<p class="description">@feature.Descriptor.Description</p>@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
<div class="dependencies">
<h4>@T("Depends on:")</h4>
@Html.UnorderedList(
feature.Descriptor.Dependencies.OrderBy(s => s),
(s, i) => Html.Link(s, string.Format("#{0}", s.AsFeatureId(n => T(n)))),
@Html.UnorderedList(dependencies,
(s, i) => Html.Link(string.IsNullOrEmpty(s.Descriptor.Name) ? s.Descriptor.Id : s.Descriptor.Name, string.Format("#{0}", s.Descriptor.Id.AsFeatureId(n => T(n)))),
"",
"dependency",
"")

View File

@@ -19,7 +19,7 @@
@if (!string.IsNullOrEmpty(module.Description)) {
<p>@module.Description</p>}
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(f.Id, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Id.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(string.IsNullOrEmpty(f.Name) ? f.Id : f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Id.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
<li>&nbsp;&#124;&nbsp;@T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik", "Andre"})[(module.Name.Length + (new Random()).Next()) % 7])</li>
<li>&nbsp;&#124;&nbsp;@T("Website: {0}", !string.IsNullOrEmpty(module.WebSite) ? module.WebSite : "http://orchardproject.net")</li>
</ul>