Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,13 @@ public GlobalOneColumnSection(IPublishedElement content, IPublishedValueFallback
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("textColor")]
public virtual string TextColor => this.Value<string>(_publishedValueFallback, "textColor");

///<summary>
/// Title
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "16.5.0+8b2c22a")]
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("title")]
public virtual string Title => this.Value<string>(_publishedValueFallback, "title");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public UTpro__Article(IPublishedElement content, IPublishedValueFallback publish
[ImplementPropertyType("description")]
public virtual string Description => this.Value<string>(_publishedValueFallback, "description");

///<summary>
/// Header
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "16.5.0+8b2c22a")]
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("header")]
public virtual string Header => this.Value<string>(_publishedValueFallback, "header");

///<summary>
/// Thumbnail
///</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,5 @@ public UTpro__Introduction(IPublishedElement content, IPublishedValueFallback pu
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("special")]
public virtual global::Umbraco.Cms.Core.Strings.IHtmlEncodedString Special => this.Value<global::Umbraco.Cms.Core.Strings.IHtmlEncodedString>(_publishedValueFallback, "special");

///<summary>
/// Title
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "16.5.0+8b2c22a")]
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("title")]
public virtual string Title => this.Value<string>(_publishedValueFallback, "title");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ public UTpro__IntroductionDetail(IPublishedElement content, IPublishedValueFallb
[ImplementPropertyType("description")]
public virtual string Description => this.Value<string>(_publishedValueFallback, "description");

///<summary>
/// Header
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "16.5.0+8b2c22a")]
[global::System.Diagnostics.CodeAnalysis.MaybeNull]
[ImplementPropertyType("header")]
public virtual string Header => this.Value<string>(_publishedValueFallback, "header");

///<summary>
/// Image
///</summary>
Expand Down
31 changes: 22 additions & 9 deletions uTPro/Extension/uTPro.Extension/ContentExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
using System.Net.NetworkInformation;
using Umbraco.Cms.Core.Models.PublishedContent;
using System.Linq;

using Umbraco.Cms.Core.Models.PublishedContent;
namespace uTPro.Extension
{
public static class ContentExtensions
{
public static T? GetInherited<T>(this IPublishedContent content, string alias)
public static T? ValueInherited<T>(this IPublishedContent content, string alias)
{
var node = content.AncestorsOrSelf()
.FirstOrDefault(x => x.HasValue(alias));

var node = content.Inherited(alias);
if (node == null)
return default;

return node.Value<T>(alias);
}
}

public static IPublishedContent? Inherited(this IPublishedContent content, string alias)
{
return content.AncestorsOrSelf().FirstOrDefault(x => x.HasValue(alias));
}

public static (string? alias, IPublishedContent? value) Inherited(this IPublishedContent content, params string[] alias)
{
foreach (var node in content.AncestorsOrSelf())
{
foreach (var a in alias)
{
if (node.HasValue(a))
return (a, node.Value<IPublishedContent>(a));
}
}

return (null, null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ background-color:var(--section-bg-color);";

var textColor = $@"--section-text-color:{(!string.IsNullOrEmpty(Model.Content.TextColor) ? Model.Content.TextColor : "#000")};";
}
<section class="@Model.Content.ContentType.Alias" style="@(bkg + textColor)">
@await Html.GetPreviewBlockGridItemAreasHtmlAsync(Model, $"{CurrentSite.GetItem().Root.Name}{Prefix.PrefixData}areas")
@if (Context.Request.IsBlockPreviewRequest())
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/wrapper.css" />
}
else
{
@using (Html.SetSection(Model.GetType().ToString() + "", HtmlSectionBlockExtensions.Position.BodyBottom))
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/wrapper.css" />
}
}
<section class="@Model.Content.ContentType.Alias"
style="@(bkg + textColor)">
<div class="wrapper">
@if (!string.IsNullOrEmpty(Model.Content.Title))
{
<div class="title">@Model.Content.Title</div>
}
@await Html.GetPreviewBlockGridItemAreasHtmlAsync(Model, $"{CurrentSite.GetItem().Root.Name}{Prefix.PrefixData}areas")
</div>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>
@{
if (Model?.Any() != true) { return; }
var currentPage = Umbraco.AssignedContentItem;
var top = currentPage?.GetInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("topComponent");
var bottom = currentPage?.GetInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("bottomComponent");
}

@if (top != null)
{
<div class="umb-block-grid"
data-grid-columns="@(Model.GridColumns?.ToString() ?? "12");"
style="--umb-block-grid--grid-columns: @(Model.GridColumns?.ToString() ?? "12");">
@await Html.GetPreviewBlockGridItemsHtmlAsync(top, $"{CurrentSite.GetItem().Root.Name}{Prefix.PrefixData}items")
</div>
}
@if (Model != null)
{
Expand All @@ -24,12 +12,4 @@
@await Html.GetPreviewBlockGridItemsHtmlAsync(Model, $"{CurrentSite.GetItem().Root.Name}{Prefix.PrefixData}items")
</div>

}
@if (bottom != null)
{
<div class="umb-block-grid"
data-grid-columns="@(Model.GridColumns?.ToString() ?? "12");"
style="--umb-block-grid--grid-columns: @(Model.GridColumns?.ToString() ?? "12");">
@await Html.GetPreviewBlockGridItemsHtmlAsync(bottom, $"{CurrentSite.GetItem().Root.Name}{Prefix.PrefixData}items")
</div>
}
8 changes: 7 additions & 1 deletion uTPro/Project/uTPro.Project.Web/Views/uTPro/PageHome.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
var currentPage = Umbraco.AssignedContentItem;
var top = currentPage?.ValueInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("topComponent");
var bottom = currentPage?.ValueInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("bottomComponent");
var content = Model.Value<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("content");
}
@await Html.GetBlockGridHtmlAsync(Model.Value<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("content"), CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(top, CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(content, CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(bottom, CurrentSite.GetItem().Root.Name)
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@using Umbraco.Cms.Web.Common.PublishedModels;
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@{
var currentPage = Umbraco.AssignedContentItem;
var top = currentPage?.ValueInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("topComponent");
var bottom = currentPage?.ValueInherited<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("bottomComponent");
var content = Model.Value<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("content");
}
@await Html.GetBlockGridHtmlAsync(Model.Value<Umbraco.Cms.Core.Models.Blocks.BlockGridModel>("content"), CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(top, CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(content, CurrentSite.GetItem().Root.Name)
@await Html.GetBlockGridHtmlAsync(bottom, CurrentSite.GetItem().Root.Name)
15 changes: 8 additions & 7 deletions uTPro/Project/uTPro.Project.Web/Views/uTPro/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
@{
await Html.RenderPartialAsync(PathFileViews.Partials_MetaData);
await Html.RenderPartialAsync(PathFileViews.Partials_HtmlManage, nameof(GlobalPageScriptSetting.HeaderOpeningScripts));
@Html.RenderSections(HtmlSectionBlockExtensions.Position.Head)
await Html.RenderPartialAsync(PathFileViews.Partials_HtmlManage, nameof(GlobalPageScriptSetting.HeaderClosingScripts));
}

<link rel="stylesheet" href="/assets/css/blockgridlayout.css" />
<link rel="stylesheet" href="/css/uTPro/layout.css" />
<link rel="stylesheet" href="/css/uTPro/main.css" />
<link rel="stylesheet" href="/css/uTPro/icon.css" />
@RenderSection("Styles", false)

@Html.RenderSections(HtmlSectionBlockExtensions.Position.Head)
@{
await Html.RenderPartialAsync(PathFileViews.Partials_HtmlManage, nameof(GlobalPageScriptSetting.HeaderClosingScripts));
}
</head>
<body class="bodypage is-preload">
@Html.RenderSections(HtmlSectionBlockExtensions.Position.BodyTop)
@{
await Html.RenderPartialAsync(PathFileViews.Partials_HtmlManage, nameof(GlobalPageScriptSetting.BodyOpeningScripts));
Html.RenderSections(HtmlSectionBlockExtensions.Position.BodyTop);
await Html.RenderPartialAsync("_Nav.cshtml", homePage);
}
<main class="page-wrapper">
Expand All @@ -36,10 +37,10 @@
<script src="/scripts/uTPro/util.js"></script>
<script src="/scripts/uTPro/main.js"></script>
<script src="/scripts/uTPro/select-language.js"></script>
@RenderSection("Scripts", false)
@{
RenderSection("Scripts", false);
await Html.RenderPartialAsync(PathFileViews.Partials_HtmlManage, nameof(GlobalPageScriptSetting.BodyClosingScripts));
Html.RenderSections(HtmlSectionBlockExtensions.Position.BodyBottom);
}
@Html.RenderSections(HtmlSectionBlockExtensions.Position.BodyBottom)
</body>
</html>
4 changes: 4 additions & 0 deletions uTPro/Project/uTPro.Project.Web/Views/uTPro/_Nav.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
return (Html.Raw(string.Empty), Html.Raw(string.Empty));
}
}
@using (Html.SetSection(Model.GetType().ToString(), HtmlSectionBlockExtensions.Position.BodyBottom))
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/navHeader.css" />
}
<nav class="navHeader">
<ul>
@foreach (var item in navItems.NavigationItems!)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<UTpro__Article>>
@{
}
<div class="wrapper style2">
@if (!string.IsNullOrEmpty(Model.Content.Title))

@if (Context.Request.IsBlockPreviewRequest())
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/Components/Article.css" />
}
else
{
@using (Html.SetSection(Model.GetType().ToString(), HtmlSectionBlockExtensions.Position.BodyBottom))
{
<div class="title">@Model.Content.Title</div>
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/Components/Article.css" />
}
<div class="container">

<!-- Content -->
<div class="content">
<article class="box post">
<header class="style1">
@if (!string.IsNullOrEmpty(Model.Content.Header))
{
<h2>@Model.Content.Header</h2>
}
@if (!string.IsNullOrEmpty(Model.Content.Description))
{
<p>@Model.Content.Description</p>
}
</header>
@if (Model.Content.Thumbnail != null)
}
<div class="container">
<div class="content">
<article class="box post">
<header class="style1">
@if (!string.IsNullOrEmpty(Model.Content.Title))
{
<div class="image featured">
<img src="@Model.Content.Thumbnail.Url()" alt="@Model.Content.Title" />
</div>
<h2>@Model.Content.Title</h2>
}
@if (Model.Content.Content != null)
@if (!string.IsNullOrEmpty(Model.Content.Description))
{
@await Html.GetBlockListHtmlAsync(Model.Content.Content, CurrentSite.GetItem().Root.Name)
<p>@Model.Content.Description</p>
}
</article>
</div>

</header>
@if (Model.Content.Thumbnail != null)
{
<div class="image featured">
<img src="@Model.Content.Thumbnail.Url()" alt="@Model.Content.Title" />
</div>
}
@if (Model.Content.Content != null)
{
@await Html.GetBlockListHtmlAsync(Model.Content.Content, CurrentSite.GetItem().Root.Name)
}
</article>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem<UTpro__BannerHeader>>
@{
}
<section class="header wrapper">
<div class="logo">
@if (Context.Request.IsBlockPreviewRequest())
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/Components/BannerHeader.css" />
}
else
{
@using (Html.SetSection(Model.GetType().ToString() + "", HtmlSectionBlockExtensions.Position.BodyBottom))
{
<link rel="stylesheet" href="~/css/@CurrentSite.GetItem().Root.Name/Components/BannerHeader.css" />
}
}
<section class="banner-header">
<div class="text">
<h1>@Model.Content.Title</h1>
<p>@Model.Content.Description</p>
</div>
Expand Down
Loading
Loading