mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Add a "Name" entry to FeatureDescriptors
This is for consistency with Modules (Name != DisplayName) and allows better UI experience (Display Name indenpendant of the internal name) --HG-- branch : dev
This commit is contained in:
@@ -7,10 +7,12 @@ OrchardVersion: 0.8.0
|
||||
Description: The Orchard Blogs module is implementing basic blogging features.
|
||||
Features:
|
||||
Orchard.Blogs:
|
||||
Name: Blogs
|
||||
Description: A simple web log.
|
||||
Dependencies: Feeds
|
||||
Category: Content
|
||||
Remote Blog Publishing:
|
||||
Orchard.Blogs.RemotePublishing:
|
||||
Name: Remote Blog Publishing
|
||||
Description: Blog easier using a dedicated MetaWeblogAPI-compatible publishing tool.
|
||||
Dependencies: XmlRpc
|
||||
Category: Content Publishing
|
||||
|
@@ -220,8 +220,9 @@ namespace Orchard.Modules.Services {
|
||||
Category = TryLocalize(f.Name + " Category", f.Category, localizer),
|
||||
Dependencies = f.Dependencies,
|
||||
Description = TryLocalize(f.Description + " Description", f.Description, localizer),
|
||||
DisplayName = string.IsNullOrEmpty(f.DisplayName) ? "" : TryLocalize(f.DisplayName + " Name", f.Description, localizer),
|
||||
Extension = f.Extension,
|
||||
Name = f.Name
|
||||
Name = f.Name,
|
||||
})
|
||||
};
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@
|
||||
foreach (var feature in features) {
|
||||
//hmmm...I feel like I've done this before...
|
||||
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
|
||||
var featureName = string.IsNullOrEmpty(feature.Descriptor.DisplayName) ? feature.Descriptor.Name : feature.Descriptor.DisplayName;
|
||||
var featureState = feature.IsEnabled ? "enabled" : "disabled";
|
||||
var featureClassName = string.Format("feature {0}", featureState + (Model.FeaturesThatNeedUpdate.Contains(feature.Descriptor.Name) ? " update" : String.Empty));
|
||||
if (feature == features.First()) {
|
||||
@@ -40,10 +41,10 @@
|
||||
if (feature == features.Last()) {
|
||||
featureClassName += " last";
|
||||
}
|
||||
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(feature.Descriptor.Name), featureState)">
|
||||
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3>@feature.Descriptor.Name</h3>
|
||||
<h3>@featureName</h3>
|
||||
<p class="description">@feature.Descriptor.Description</p>@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
||||
<div class="dependencies">
|
||||
<h4>@T("Depends on:")</h4>
|
||||
|
@@ -143,6 +143,11 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
Extension = extensionDescriptor,
|
||||
Name = entity.Key.ToString(),
|
||||
};
|
||||
|
||||
if (featureDescriptor.Name == extensionDescriptor.Name) {
|
||||
featureDescriptor.DisplayName = extensionDescriptor.DisplayName;
|
||||
}
|
||||
|
||||
var featureMapping = (Mapping)entity.Value;
|
||||
foreach (var featureEntity in featureMapping.Entities) {
|
||||
if (featureEntity.Key.ToString() == "Description") {
|
||||
@@ -151,6 +156,9 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
else if (featureEntity.Key.ToString() == "Category") {
|
||||
featureDescriptor.Category = featureEntity.Value.ToString();
|
||||
}
|
||||
else if (featureEntity.Key.ToString() == "Name") {
|
||||
featureDescriptor.DisplayName = featureEntity.Value.ToString();
|
||||
}
|
||||
else if (featureEntity.Key.ToString() == "Dependencies") {
|
||||
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
|
||||
}
|
||||
@@ -161,6 +169,7 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
if (!featureDescriptors.Any(fd => fd.Name == extensionDescriptor.Name)) {
|
||||
featureDescriptors.Add(new FeatureDescriptor {
|
||||
Name = extensionDescriptor.Name,
|
||||
DisplayName = extensionDescriptor.DisplayName,
|
||||
Dependencies = new string[0],
|
||||
Extension = extensionDescriptor
|
||||
});
|
||||
|
@@ -10,6 +10,7 @@ namespace Orchard.Environment.Extensions.Models {
|
||||
public ExtensionDescriptor Extension { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Category { get; set; }
|
||||
public IEnumerable<string> Dependencies { get; set; }
|
||||
|
Reference in New Issue
Block a user