Allowing new Core modules to be enabled

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2011-10-01 10:46:47 -07:00
parent 8140293e12
commit c870df637a

View File

@@ -26,8 +26,7 @@
categoryClassName += " last";
}
//temporarily "disable" actions on core features
bool showActions;
bool showEnable, showDisable;
<li class="@categoryClassName">
<h2>@categoryName</h2>
<ul>@{
@@ -53,7 +52,8 @@
select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name);
var missingDependencies = feature.Descriptor.Dependencies
.Where(d => !Model.Features.Any(f => f.Descriptor.Id == d));
showActions = categoryName.ToString() != "Core" && missingDependencies.Count() == 0;
showDisable = categoryName.ToString() != "Core";
showEnable = missingDependencies.Count() == 0 && feature.Descriptor.Id != "Orchard.Setup";
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
<div class="summary">
<div class="properties">
@@ -74,28 +74,28 @@
</div>}
</div>
<div class="actions">
@if (showActions) {
if (feature.IsEnabled) {
@if (showDisable && 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.Id, new {id = ""})
@Html.Hidden("force", true)
<button type="submit">@T("Disable")</button>
}
}
else {
@if(showEnable && !feature.IsEnabled) {
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Enable", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Id, new { id = "" })
@Html.Hidden("force", true)
<button type="submit">@T("Enable")</button>
}
}
}
@if(feature.NeedsUpdate){
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Update", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Id, new { id = "" })
<button type="submit" class="update">@T("Update")</button>
@if(feature.NeedsUpdate){
using (Html.BeginFormAntiForgeryPost(string.Format("{0}", Url.Action("Update", new { area = "Orchard.Modules" })), FormMethod.Post, new {@class = "inline link"})) {
@Html.Hidden("id", feature.Descriptor.Id, new { id = "" })
<button type="submit" class="update">@T("Update")</button>
}
}
}
</div>
</div>
</li>}