Modules: Code styling and Recipe name display fix in Recipe listing

This commit is contained in:
Lombiq
2019-08-28 19:40:41 +02:00
committed by Benedek Farkas
parent cf821e1fdc
commit 66480eb6b1

View File

@@ -1,30 +1,35 @@
@using Orchard.Utility.Extensions @using Orchard.Utility.Extensions
@model Orchard.Modules.ViewModels.RecipesViewModel @model Orchard.Modules.ViewModels.RecipesViewModel
@{ @{
Layout.Title = T("Recipes"); Layout.Title = T("Recipes");
} }
@using (Html.BeginFormAntiForgeryPost()) { @using (Html.BeginFormAntiForgeryPost()) {
if (Model.Modules.Any()) { if (Model.Modules.Any()) {
<ul class="contentItems"> <ul class="contentItems">
@foreach (var moduleEntry in Model.Modules.OrderBy(m => m.Module.Descriptor.Name)) { @foreach (var moduleEntry in Model.Modules.OrderBy(m => m.Module.Descriptor.Name)) {
var module = moduleEntry.Module; var module = moduleEntry.Module;
var descriptor = module.Descriptor; var descriptor = module.Descriptor;
if (string.IsNullOrWhiteSpace(descriptor.Version)) {
descriptor.Version = "1.0";
}
<li> <li>
<div class="summary"> <div class="summary">
<div class="properties"> <div class="properties">
<h2>@descriptor.Name<span> - @T("Version: {0}", !string.IsNullOrEmpty(descriptor.Version) ? descriptor.Version : T("1.0").ToString())</span></h2> <h2>@descriptor.Name<span> - @T("Version: {0}", descriptor.Version)</span></h2>
@*@if (!string.IsNullOrEmpty(descriptor.Description)) {
<p>@descriptor.Description</p>
}*@
@foreach (var recipe in moduleEntry.Recipes) { @foreach (var recipe in moduleEntry.Recipes) {
if (string.IsNullOrWhiteSpace(recipe.Description)) {
recipe.Description = T("No description.").Text;
}
<br /> <br />
<div> <div>
<h4>@recipe.Name.CamelFriendly() - @Html.ActionLink(T("Execute").Text, "Recipes", "Admin", new { area = "Orchard.Modules", moduleId = descriptor.Id, name = recipe.Name }, new { itemprop = "UnsafeUrl" })</h4> <h4>@recipe.Name - @Html.ActionLink(T("Execute").Text, "Recipes", "Admin", new { area = "Orchard.Modules", moduleId = descriptor.Id, name = recipe.Name }, new { itemprop = "UnsafeUrl" })</h4>
<p>@(!string.IsNullOrEmpty(recipe.Description) ? recipe.Description : T("No description").ToString())</p> <p>@recipe.Description</p>
</div> </div>
} }
</div> </div>
@@ -34,6 +39,6 @@
</ul> </ul>
} }
else { else {
<p>@T("No modules available").ToString()</p> <p>@T("No modules available").Text</p>
} }
} }