mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
More feature/module management UI updates and some cleanup
- removed unused edit page & action - remvoed super sekret force actions on functions and defaulting enable/disable to force for now (until a dialog solution is in place) - standarized on a feature ID format and threw in a string extension to gen it for good measure --HG-- branch : dev
This commit is contained in:
@@ -25,18 +25,6 @@ namespace Orchard.Modules.Controllers {
|
||||
return View(new ModulesIndexViewModel {Modules = modules});
|
||||
}
|
||||
|
||||
public ActionResult Edit(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageModules, T("Not allowed to edit module")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var module = _moduleService.GetModuleByName(id);
|
||||
|
||||
if (module == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
return View(new ModuleEditViewModel {Name = module.DisplayName});
|
||||
}
|
||||
|
||||
public ActionResult Features() {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageFeatures, T("Not allowed to manage features")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Modules.Extensions {
|
||||
public static class StringExtensions {
|
||||
public static string AsFeatureId(this string text, Func<string, LocalizedString> localize) {
|
||||
return string.IsNullOrEmpty(text)
|
||||
? ""
|
||||
: string.Format(localize("{0} feature").ToString(), text).HtmlClassify();
|
||||
}
|
||||
}
|
||||
}
|
@@ -64,6 +64,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Commands\FeatureCommand.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Extensions\StringExtensions.cs" />
|
||||
<Compile Include="Models\ModuleFeature.cs" />
|
||||
<Compile Include="ViewModels\FeaturesViewModel.cs" />
|
||||
<Compile Include="Models\Module.cs" />
|
||||
@@ -89,7 +90,6 @@
|
||||
<Content Include="Content\Admin\images\enabled.gif" />
|
||||
<Content Include="styles\admin.css" />
|
||||
<Content Include="Views\Admin\Features.ascx" />
|
||||
<Content Include="Views\Admin\Edit.ascx" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
@@ -1,5 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ModuleEditViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
||||
<h1><%=Html.TitleForPage(T("Edit Module: {0}", Model.Name).ToString()) %></h1>
|
||||
<p><%=_Encoded("Edit the module. Maybe show module's features.") %></p>
|
@@ -1,4 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<FeaturesViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Modules.Extensions" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %><%
|
||||
@@ -23,7 +24,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 = string.Format("{0} feature", feature.Descriptor.Name).HtmlClassify();
|
||||
var featureId = feature.Descriptor.Name.AsFeatureId(n => T(n));
|
||||
var featureState = feature.IsEnabled ? "enabled" : "disabled";
|
||||
var featureClassName = string.Format("feature {0}", featureState);
|
||||
if (feature == features.First())
|
||||
@@ -39,7 +40,7 @@
|
||||
<h4><%=_Encoded("Depends on:")%></h4>
|
||||
<%=Html.UnorderedList(
|
||||
feature.Descriptor.Dependencies.OrderBy(s => s),
|
||||
(s, i) => Html.Link(s, string.Format("#{0}", string.Format("{0} feature", s).HtmlClassify())),
|
||||
(s, i) => Html.Link(s, string.Format("#{0}", s.AsFeatureId(n => T(n)))),
|
||||
"",
|
||||
"dependency",
|
||||
"") %>
|
||||
@@ -51,30 +52,16 @@
|
||||
if (feature.IsEnabled) {
|
||||
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Disable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
|
||||
<%=Html.Hidden("force", true)%>
|
||||
<button type="submit"><%=_Encoded("Disable") %></button><%
|
||||
}
|
||||
} else {
|
||||
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
|
||||
<%=Html.Hidden("force", true)%>
|
||||
<button type="submit"><%=_Encoded("Enable") %></button><%
|
||||
}
|
||||
} %>
|
||||
</div>
|
||||
<div class="cathedral"><%
|
||||
//temporary forceful feature actions
|
||||
if (feature.IsEnabled) {
|
||||
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Disable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
|
||||
<%=Html.Hidden("force", true)%>
|
||||
<button type="submit"><%=_Encoded("π")%></button><%
|
||||
}
|
||||
} else {
|
||||
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||
<%=Html.Hidden("id", feature.Descriptor.Name, new { id = "" })%>
|
||||
<%=Html.Hidden("force", true)%>
|
||||
<button type="submit"><%=_Encoded("π")%></button><%
|
||||
}
|
||||
} %>
|
||||
</div><%
|
||||
} %>
|
||||
</div>
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ModulesIndexViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Modules.Extensions" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
||||
<h1><%=Html.TitleForPage(T("Installed Modules").ToString()) %></h1>
|
||||
@@ -14,15 +15,11 @@
|
||||
<h3><%=Html.Encode(module.DisplayName) %></h3>
|
||||
<ul class="pageStatus" style="color:#666">
|
||||
<li><%=T("Version: {0}", !string.IsNullOrEmpty(module.Version) ? Html.Encode(module.Version) : T("1.0")) %></li>
|
||||
<li> | <%=T("Features: {0}", string.Join(", ", module.Features.Select(f => Html.Link(Html.Encode(f.Name), string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), Html.Encode(f.Name)) )).OrderBy(s => s).ToArray())) %></li>
|
||||
<li> | <%=T("Features: {0}", string.Join(", ", module.Features.Select(f => Html.Link(Html.Encode(f.Name), string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Name.AsFeatureId(n => T(n))) )).OrderBy(s => s).ToArray())) %></li>
|
||||
<li> | <%=T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? Html.Encode(module.Author) : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik"})[(module.DisplayName.Length + (new Random()).Next()) % 7]) %></li><%-- very efficient, I know --%>
|
||||
<li> | <%=T("Website: {0}", !string.IsNullOrEmpty(module.HomePage) ? Html.Encode(module.HomePage) : T("<a href=\"http://orchardproject.net\">http://orchardproject.net</a>"))%></li>
|
||||
</ul>
|
||||
</div>
|
||||
<%--<div class="related">
|
||||
<%=Html.ActionLink(T("Edit").ToString(), "edit", new {moduleName = module.ModuleName, area = "Orchard.Modules"}) %><%=_Encoded(" | ")%>
|
||||
<a href="#">Delete</a>
|
||||
</div>--%>
|
||||
</div><%
|
||||
if (!string.IsNullOrEmpty(module.Description)) { %>
|
||||
<p><%=Html.Encode(module.Description) %></p><%
|
||||
|
Reference in New Issue
Block a user