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.
|
Description: The Orchard Blogs module is implementing basic blogging features.
|
||||||
Features:
|
Features:
|
||||||
Orchard.Blogs:
|
Orchard.Blogs:
|
||||||
|
Name: Blogs
|
||||||
Description: A simple web log.
|
Description: A simple web log.
|
||||||
Dependencies: Feeds
|
Dependencies: Feeds
|
||||||
Category: Content
|
Category: Content
|
||||||
Remote Blog Publishing:
|
Orchard.Blogs.RemotePublishing:
|
||||||
|
Name: Remote Blog Publishing
|
||||||
Description: Blog easier using a dedicated MetaWeblogAPI-compatible publishing tool.
|
Description: Blog easier using a dedicated MetaWeblogAPI-compatible publishing tool.
|
||||||
Dependencies: XmlRpc
|
Dependencies: XmlRpc
|
||||||
Category: Content Publishing
|
Category: Content Publishing
|
||||||
|
@@ -220,8 +220,9 @@ namespace Orchard.Modules.Services {
|
|||||||
Category = TryLocalize(f.Name + " Category", f.Category, localizer),
|
Category = TryLocalize(f.Name + " Category", f.Category, localizer),
|
||||||
Dependencies = f.Dependencies,
|
Dependencies = f.Dependencies,
|
||||||
Description = TryLocalize(f.Description + " Description", f.Description, localizer),
|
Description = TryLocalize(f.Description + " Description", f.Description, localizer),
|
||||||
|
DisplayName = string.IsNullOrEmpty(f.DisplayName) ? "" : TryLocalize(f.DisplayName + " Name", f.Description, localizer),
|
||||||
Extension = f.Extension,
|
Extension = f.Extension,
|
||||||
Name = f.Name
|
Name = f.Name,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
foreach (var feature in features) {
|
foreach (var feature in features) {
|
||||||
//hmmm...I feel like I've done this before...
|
//hmmm...I feel like I've done this before...
|
||||||
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
|
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 featureState = feature.IsEnabled ? "enabled" : "disabled";
|
||||||
var featureClassName = string.Format("feature {0}", featureState + (Model.FeaturesThatNeedUpdate.Contains(feature.Descriptor.Name) ? " update" : String.Empty));
|
var featureClassName = string.Format("feature {0}", featureState + (Model.FeaturesThatNeedUpdate.Contains(feature.Descriptor.Name) ? " update" : String.Empty));
|
||||||
if (feature == features.First()) {
|
if (feature == features.First()) {
|
||||||
@@ -40,10 +41,10 @@
|
|||||||
if (feature == features.Last()) {
|
if (feature == features.Last()) {
|
||||||
featureClassName += " 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="summary">
|
||||||
<div class="properties">
|
<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()) {
|
<p class="description">@feature.Descriptor.Description</p>@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
||||||
<div class="dependencies">
|
<div class="dependencies">
|
||||||
<h4>@T("Depends on:")</h4>
|
<h4>@T("Depends on:")</h4>
|
||||||
|
@@ -143,6 +143,11 @@ namespace Orchard.Environment.Extensions.Folders {
|
|||||||
Extension = extensionDescriptor,
|
Extension = extensionDescriptor,
|
||||||
Name = entity.Key.ToString(),
|
Name = entity.Key.ToString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (featureDescriptor.Name == extensionDescriptor.Name) {
|
||||||
|
featureDescriptor.DisplayName = extensionDescriptor.DisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
var featureMapping = (Mapping)entity.Value;
|
var featureMapping = (Mapping)entity.Value;
|
||||||
foreach (var featureEntity in featureMapping.Entities) {
|
foreach (var featureEntity in featureMapping.Entities) {
|
||||||
if (featureEntity.Key.ToString() == "Description") {
|
if (featureEntity.Key.ToString() == "Description") {
|
||||||
@@ -151,6 +156,9 @@ namespace Orchard.Environment.Extensions.Folders {
|
|||||||
else if (featureEntity.Key.ToString() == "Category") {
|
else if (featureEntity.Key.ToString() == "Category") {
|
||||||
featureDescriptor.Category = featureEntity.Value.ToString();
|
featureDescriptor.Category = featureEntity.Value.ToString();
|
||||||
}
|
}
|
||||||
|
else if (featureEntity.Key.ToString() == "Name") {
|
||||||
|
featureDescriptor.DisplayName = featureEntity.Value.ToString();
|
||||||
|
}
|
||||||
else if (featureEntity.Key.ToString() == "Dependencies") {
|
else if (featureEntity.Key.ToString() == "Dependencies") {
|
||||||
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
|
featureDescriptor.Dependencies = ParseFeatureDependenciesEntry(featureEntity.Value.ToString());
|
||||||
}
|
}
|
||||||
@@ -161,6 +169,7 @@ namespace Orchard.Environment.Extensions.Folders {
|
|||||||
if (!featureDescriptors.Any(fd => fd.Name == extensionDescriptor.Name)) {
|
if (!featureDescriptors.Any(fd => fd.Name == extensionDescriptor.Name)) {
|
||||||
featureDescriptors.Add(new FeatureDescriptor {
|
featureDescriptors.Add(new FeatureDescriptor {
|
||||||
Name = extensionDescriptor.Name,
|
Name = extensionDescriptor.Name,
|
||||||
|
DisplayName = extensionDescriptor.DisplayName,
|
||||||
Dependencies = new string[0],
|
Dependencies = new string[0],
|
||||||
Extension = extensionDescriptor
|
Extension = extensionDescriptor
|
||||||
});
|
});
|
||||||
|
@@ -10,6 +10,7 @@ namespace Orchard.Environment.Extensions.Models {
|
|||||||
public ExtensionDescriptor Extension { get; set; }
|
public ExtensionDescriptor Extension { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Category { get; set; }
|
public string Category { get; set; }
|
||||||
public IEnumerable<string> Dependencies { get; set; }
|
public IEnumerable<string> Dependencies { get; set; }
|
||||||
|
Reference in New Issue
Block a user