-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert Themes admin views into shapes (#15589)
- Loading branch information
1 parent
b1726ba
commit 15c95ca
Showing
11 changed files
with
205 additions
and
62 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections.Generic; | ||
using OrchardCore.DisplayManagement.Handlers; | ||
using OrchardCore.DisplayManagement.Views; | ||
using OrchardCore.Themes.Models; | ||
|
||
namespace OrchardCore.Themes.Drivers; | ||
|
||
public class ThemeEntryDisplayDriver : DisplayDriver<ThemeEntry> | ||
{ | ||
public override IDisplayResult Display(ThemeEntry model) | ||
{ | ||
var results = new List<ShapeResult>() | ||
{ | ||
View("ThemeEntry_SummaryAdmin__Thumbnail", model).Location("SummaryAdmin", "Thumbnail:5"), | ||
View("ThemeEntry_SummaryAdmin__Title", model).Location("SummaryAdmin", "Header:5"), | ||
View("ThemeEntry_SummaryAdmin__Descriptions", model).Location("SummaryAdmin", "Content:5"), | ||
View("ThemeEntry_SummaryAdmin__Attributes", model).Location("SummaryAdmin", "Tags:5"), | ||
}; | ||
|
||
if (model.IsCurrent) | ||
{ | ||
results.Add(View("ThemeEntry_SummaryAdmin__Current", model).Location("SummaryAdmin", "FooterBelow:5")); | ||
} | ||
else | ||
{ | ||
results.AddRange([ | ||
View("ThemeEntry_SummaryAdmin__ButtonsMakeCurrent", model).Location("SummaryAdmin", "FooterStart:5"), | ||
View("ThemeEntry_SummaryAdmin__ButtonsToggleState", model).Location("SummaryAdmin", "FooterEnd:5") | ||
]); | ||
} | ||
|
||
return Combine(results); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...hardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Attributes.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
@if (!string.IsNullOrWhiteSpace(Model.Value.Extension.Manifest.Author)) | ||
{ | ||
<li class="list-group-item"> | ||
<small> | ||
<i class="fa-solid fa-user fa-fw" aria-hidden="true"></i> | ||
@Model.Value.Extension.Manifest.Author | ||
</small> | ||
</li> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Value.Extension.Manifest.Website)) | ||
{ | ||
<li class="list-group-item"> | ||
<small> | ||
<i class="fa-solid fa-external-link fa-fw" aria-hidden="true"></i> | ||
<a href="@Model.Value.Extension.Manifest.Website" target="_blank">@Model.Value.Extension.Manifest.Website</a> | ||
</small> | ||
</li> | ||
} | ||
@if (Model.Value.Extension.Manifest.Tags.Any()) | ||
{ | ||
<li class="list-group-item"> | ||
<small> | ||
<i class="fa-solid fa-tags fa-fw" aria-hidden="true"></i> @string.Join(", ", Model.Value.Extension.Manifest.Tags.ToArray()) | ||
</small> | ||
</li> | ||
} | ||
<li class="list-group-item"> | ||
<small> | ||
<i class="fa-solid fa-code-branch fa-fw" aria-hidden="true"></i> @Model.Value.Extension.Manifest.Version | ||
</small> | ||
</li> | ||
|
8 changes: 8 additions & 0 deletions
8
....Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsMakeCurrent.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
<form asp-route-action="SetCurrentTheme" asp-route-id="@Model.Value.Extension.Id" method="post" class="no-multisubmit"> | ||
<button type="submit" class="btn btn-sm btn-primary">@T["Make Current"]</button> | ||
</form> |
17 changes: 17 additions & 0 deletions
17
....Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsToggleState.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
@if (Model.Value.Enabled) | ||
{ | ||
<form asp-route-action="Disable" asp-route-id="@Model.Value.Extension.Id" method="post" class="no-multisubmit"> | ||
<button type="submit" class="btn btn-sm btn-secondary">@T["Disable"]</button> | ||
</form> | ||
|
||
return; | ||
} | ||
|
||
<form asp-route-action="Enable" asp-route-id="@Model.Value.Extension.Id" method="post" class="no-multisubmit"> | ||
<button type="submit" class="btn btn-sm btn-secondary">@T["Enable"]</button> | ||
</form> |
13 changes: 13 additions & 0 deletions
13
...OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Current.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
@if (Model.Value.IsAdmin) | ||
{ | ||
<span class="text-muted">@T["This is the current Admin theme"]</span> | ||
|
||
return; | ||
} | ||
|
||
<span class="text-muted">@T["This is the current Site theme"]</span> |
8 changes: 8 additions & 0 deletions
8
...rdCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
<span class="theme-entry-description"> | ||
@Model.Value.Extension.Manifest.Description | ||
</span> |
6 changes: 6 additions & 0 deletions
6
...chardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Thumbnail.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
<div class="card-theme-thumbnail" style="background-image: url('@Url.Content($"~/{Model.Value.Extension.Id}/Theme.png")');"></div> |
6 changes: 6 additions & 0 deletions
6
src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Title.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@using OrchardCore.DisplayManagement.Views | ||
@using OrchardCore.Themes.Models | ||
|
||
@model ShapeViewModel<ThemeEntry> | ||
|
||
<h4 class="card-title">@Model.Value.Name</h4> |
64 changes: 64 additions & 0 deletions
64
src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<div class="card theme-card w-100"> | ||
|
||
@if (Model.Thumbnail != null) | ||
{ | ||
@await DisplayAsync(Model.Thumbnail) | ||
} | ||
|
||
<div class="card-body"> | ||
|
||
@if (Model.Header != null) | ||
{ | ||
@await DisplayAsync(Model.Header) | ||
} | ||
|
||
@if (Model.Content != null || Model.Attributes != null) | ||
{ | ||
<p class="card-text"> | ||
@if (Model.Content != null) | ||
{ | ||
@await DisplayAsync(Model.Content) | ||
} | ||
|
||
@if (Model.Tags != null) | ||
{ | ||
<ul class="list-group list-group-flush"> | ||
@await DisplayAsync(Model.Tags) | ||
</ul> | ||
} | ||
</p> | ||
} | ||
|
||
</div> | ||
|
||
@if (Model.FooterStart != null || Model.FooterEnd != null || Model.FooterBelow != null) | ||
{ | ||
<div class="card-footer"> | ||
|
||
@if (Model.FooterStart != null || Model.FooterEnd != null) | ||
{ | ||
<div class="d-flex justify-content-between"> | ||
|
||
<div> | ||
@if (Model.FooterStart != null) | ||
{ | ||
@await DisplayAsync(Model.FooterStart) | ||
} | ||
</div> | ||
<div> | ||
@if (Model.FooterEnd != null) | ||
{ | ||
@await DisplayAsync(Model.FooterEnd) | ||
} | ||
</div> | ||
</div> | ||
} | ||
|
||
@if (Model.FooterBelow != null) | ||
{ | ||
@await DisplayAsync(Model.FooterBelow) | ||
} | ||
</div> | ||
} | ||
|
||
</div> |