-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from fluentcms/243-add-plugin-as-cascadeparam…
…eter-in-section-component-for-each-plugin 243 add plugin as cascadeparameter in section component for each plugin
- Loading branch information
Showing
18 changed files
with
229 additions
and
97 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="/css/app.min.css"> | ||
<HeadContent /> | ||
<HeadOutlet @rendermode="@InteractiveServer" /> | ||
</head> | ||
<body> | ||
<Routes /> | ||
<Routes @rendermode="@InteractiveServer" /> | ||
<script src="_framework/blazor.web.js"></script> | ||
</body> | ||
</html> |
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,27 @@ | ||
using FluentCMS.Api.Models; | ||
using FluentCMS.Entities; | ||
using Microsoft.AspNetCore.Components; | ||
|
||
namespace FluentCMS.Web.UI; | ||
|
||
public class AppState | ||
{ | ||
public SiteResponse? Site { get; set; } | ||
public PageResponse? Page { get; set; } | ||
public Layout? Layout { get; set; } | ||
public string? Route { get; set; } | ||
public Uri? Uri { get; set; } | ||
public string Host { get; set; } | ||
|
||
public AppState() | ||
{ | ||
|
||
} | ||
|
||
public AppState(NavigationManager navigation) | ||
{ | ||
Host = navigation.BaseUri; | ||
if (Host.EndsWith("/")) | ||
Host = Host.Substring(0, Host.Length - 1); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="/css/app.min.css"> | ||
<link rel="icon" type="image/png" href="favicon.png" /> |
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
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,48 @@ | ||
@inherits LayoutComponentBase | ||
<div class="f-layout"> | ||
<aside id="default-sidebar" aria-label="Sidebar" class="f-sidebar -translate-x-full"> | ||
<div class="f-sidebar-body"> | ||
<NavLink href="/" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Home</span> | ||
</NavLink> | ||
<NavLink href="/about-me" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">About Me</span> | ||
</NavLink> | ||
<NavLink href="/contact" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Contact Me</span> | ||
</NavLink> | ||
<NavLink href="/contact?id=1&me=you" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Contact with query</span> | ||
</NavLink> | ||
<NavLink href="/kitchen-sink" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Kitchen Sink</span> | ||
</NavLink> | ||
<NavLink href="/doc" class="f-sidebar-item" target="_blank"> | ||
<span class="f-sidebar-item-text">Api Doc</span> | ||
</NavLink> | ||
<hr /> | ||
<a href="/" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Home</span> | ||
</a> | ||
<a href="/about-me" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">About Me</span> | ||
</a> | ||
<a href="/contact" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Contact Me</span> | ||
</a> | ||
<a href="/kitchen-sink" class="f-sidebar-item"> | ||
<span class="f-sidebar-item-text">Kitchen Sink</span> | ||
</a> | ||
<a href="/doc" class="f-sidebar-item" target="_blank"> | ||
<span class="f-sidebar-item-text">Api Doc</span> | ||
</a> | ||
</div> | ||
</aside> | ||
<main class="f-content"> | ||
<header class="navbar sticky-top bg-dark flex-md-nowrap p-0 shadow" data-bs-theme="dark"> | ||
<a class="navbar-brand col-md-3 col-lg-2 me-0 px-3 fs-6 text-white" href="#">FluentCMS</a> | ||
</header> | ||
@Body | ||
</main> | ||
</div> | ||
<script src="/js/flowbite.min.js"></script> |
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,31 @@ | ||
@using FluentCMS.Entities | ||
@using System.Linq | ||
|
||
@((MarkupString)$"<!-- Begin Section: {@Name} -->") | ||
@if (AppState?.Page?.Plugins != null) | ||
{ | ||
@foreach (var plugin in AppState.Page.Plugins.Where(x => x.Section.ToLower() == Name.ToLower()).OrderBy(x => x.Order)) | ||
{ | ||
@((MarkupString)$"<!-- Begin Plugin: {@plugin.Definition.Name} -->") | ||
<CascadingValue Value="@plugin" Name="Plugin"> | ||
<DynamicComponent Type=@GetType(plugin) /> | ||
</CascadingValue> | ||
@((MarkupString)$"<!-- End Plugin: {@plugin.Definition.Name} -->") | ||
} | ||
} | ||
@((MarkupString)$"<!-- End Section: {@Name} -->") | ||
|
||
@code { | ||
[Parameter] | ||
public string Name { get; set; } = string.Empty; | ||
|
||
[CascadingParameter] | ||
public AppState? AppState { get; set; } | ||
|
||
private Type? GetType(PluginResponse plugin) | ||
{ | ||
var assembly = typeof(Section).Assembly; | ||
var typeInfo = assembly.DefinedTypes.FirstOrDefault(x => x.Name == plugin.Definition.ViewType); | ||
return typeInfo?.AsType(); | ||
} | ||
} |
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
Oops, something went wrong.