Refactoring theme templates, fixing variable names.

This commit is contained in:
Lombiq
2015-01-18 19:11:37 +01:00
committed by Zoltán Lehóczky
parent 25c23a1127
commit c0983a32ba
3 changed files with 42 additions and 31 deletions

View File

@@ -15,7 +15,7 @@
} else {
<h3 id="currentThemeTitle">@T("Current Theme")</h3>
@Display.ThemeEntry_Current(ContentPart: Model.CurrentTheme)
@Display.ThemeEntry_Current(Theme: Model.CurrentTheme)
}
<div id="installedBar" class="group">
@@ -29,8 +29,8 @@
<p>@T("There are no additional themes installed.")</p>
} else {
<ul class="templates">
@foreach (ThemeEntry themeEntry in Model.Themes) {
<li>@Display.ThemeEntry(ContentPart: themeEntry)</li>
@foreach (var themeEntry in Model.Themes) {
<li>@Display.ThemeEntry(Theme: themeEntry)</li>
}
</ul>
}

View File

@@ -2,17 +2,21 @@
@using Orchard.Mvc.Html
@using Orchard.Environment.Extensions.Models
@{
Orchard.Themes.Models.ThemeEntry theme = Model.Theme;
}
<div id="currentTheme">
@Html.Image(Href(Html.ThemePath((ExtensionDescriptor)Model.ContentPart.Descriptor, "/Theme.png")), Html.Encode((string)Model.ContentPart.Name), new { @class = "themePreviewImage" })
@Html.Image(Href(Html.ThemePath(theme.Descriptor, "/Theme.png")), Html.Encode(theme.Name), new { @class = "themePreviewImage" })
<div class="details">
<h4>@Model.ContentPart.Name</h4>
<h5>@T("By") @Model.ContentPart.Descriptor.Author<br />
@T("Version:") @Model.ContentPart.Descriptor.Version<br />
@if (Model.ContentPart.Descriptor.WebSite != null) {
<a href="@Model.ContentPart.Descriptor.WebSite">@Model.ContentPart.Descriptor.WebSite</a><br />
<h4>@theme.Name</h4>
<h5>@T("By") @theme.Descriptor.Author<br />
@T("Version:") @theme.Descriptor.Version<br />
@if (theme.Descriptor.WebSite != null) {
<a href="@theme.Descriptor.WebSite">@theme.Descriptor.WebSite</a><br />
}</h5>
<p class="themeInfo">@Model.ContentPart.Descriptor.Description</p>
<p class="themeInfo">@theme.Descriptor.Description</p>
</div>
</div>

View File

@@ -1,65 +1,72 @@
@using Orchard.Themes.Models
@using Orchard.Mvc.Html
@using Orchard.Environment.Extensions.Models
@using Orchard.Utility.Extensions;
@{ string themeClasses = Model.ContentPart.IsRecentlyInstalled ? "recentlyInstalledTheme" : string.Empty; }
@{
Orchard.Themes.Models.ThemeEntry theme = Model.Theme;
var themeClasses = theme.IsRecentlyInstalled ? "class=\"recentlyInstalledTheme\"" : String.Empty;
}
<div>
<h3@{ if(!string.IsNullOrEmpty(themeClasses)) {<text> class="@themeClasses"</text>}}>@Model.ContentPart.Name</h3>
<h3 @Html.Raw(themeClasses)>@theme.Name</h3>
@Html.Image(Href(Html.ThemePath((ExtensionDescriptor) Model.ContentPart.Descriptor, "/Theme.png")), Html.Encode((string)Model.ContentPart.Name), null)
@Html.Image(Href(Html.ThemePath((ExtensionDescriptor) theme.Descriptor, "/Theme.png")), Html.Encode((string)theme.Name), null)
@using (Html.BeginFormAntiForgeryPost(Url.Action("Activate"), FormMethod.Post, new { @class = "inline" })) {
@Html.Hidden("themeId", (string)Model.ContentPart.Descriptor.Id)
@Html.Hidden("themeId", (string)theme.Descriptor.Id)
<button type="submit" title="@T("Activate")">@T("Set Current")</button>
}
@using (Html.BeginFormAntiForgeryPost(Url.Action("Preview"), FormMethod.Post, new { @class = "inline" })) {
@Html.Hidden("themeId", (string)Model.ContentPart.Descriptor.Id)
@Html.Hidden("themeId", (string)theme.Descriptor.Id)
<button type="submit" title="@T("Preview")">@T("Preview")</button>
}
<p class="themeInfo smallText">
@T("By") @Model.ContentPart.Descriptor.Author<br />
@T("Version:") @Model.ContentPart.Descriptor.Version<br />
@Model.ContentPart.Descriptor.Description<br />
@if (Model.ContentPart.Descriptor.WebSite != null) {
<a href="@Model.ContentPart.Descriptor.WebSite">@Model.ContentPart.Descriptor.WebSite</a><br />
@T("By") @theme.Descriptor.Author<br />
@T("Version:") @theme.Descriptor.Version<br />
@theme.Descriptor.Description<br />
@if (theme.Descriptor.WebSite != null) {
<a href="@theme.Descriptor.WebSite">@theme.Descriptor.WebSite</a><br />
}
</p>
@if (Model.ContentPart.Notifications != null && Model.ContentPart.Notifications.Count > 0) {
@if (theme.Notifications != null && theme.Notifications.Count > 0) {
<ul class="notifications">
@foreach (string notification in Model.ContentPart.Notifications) {
@foreach (string notification in theme.Notifications) {
<li>@notification</li>
}
</ul>
}
@if (Model.ContentPart.Enabled) {
@if (theme.Enabled) {
using (Html.BeginFormAntiForgeryPost(Url.Action("Disable"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeId", (string)Model.ContentPart.Descriptor.Id)
@Html.Hidden("themeId", (string)theme.Descriptor.Id)
<button type="submit" class="disable" title="Disable">@T("Disable")</button>
}
}
else {
using (Html.BeginFormAntiForgeryPost(Url.Action("Enable"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeId", (string)Model.ContentPart.Descriptor.Id)
@Html.Hidden("themeId", (string)theme.Descriptor.Id)
<button type="submit" class="enable" title="Enable">@T("Enable")</button>
}
}
@if (Model.ContentPart.NeedsUpdate) {
@if (theme.NeedsUpdate) {
<span> | </span>
using (Html.BeginFormAntiForgeryPost(Url.Action("Update"), FormMethod.Post, new { @class = "inline link" })) {
@Html.Hidden("themeId", (string)Model.ContentPart.Descriptor.Id)
@Html.Hidden("themeId", (string)theme.Descriptor.Id)
<button type="submit" class="update">@T("Update")</button> <br/>
}
}
@if (Model.ContentPart.CanUninstall) {
@if (theme.CanUninstall) {
<span> | </span>
using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveTheme", "PackagingServices", new { area = "Orchard.Packaging", returnUrl = HttpContext.Current.Request.RawUrl, retryUrl = HttpContext.Current.Request.RawUrl, themeId = Model.ContentPart.Descriptor.Id }), FormMethod.Post, new { @class = "inline link" })) {
<button type="submit" class="uninstall" title="@T("Uninstall")">@T("Uninstall")</button>
}
@Html.ActionLink(
T("Uninstall").Text,
"UninstallTheme",
"PackagingServices",
new { ThemeId = theme.Descriptor.Id, ReturnUrl = Request.ToUrlString(), Area = "Orchard.Packaging" },
new { itemprop = "RemoveUrl UnsafeUrl" })
}
</div>