clean start

Signed-off-by: Carl Sargunar <carl@sargunar.com>
This commit is contained in:
Carl Sargunar
2022-06-02 00:32:35 +01:00
parent b8cbf8b999
commit 27be926117
49 changed files with 22 additions and 15 deletions

View File

@@ -0,0 +1,18 @@
@inherits UmbracoViewPage<ContentModels.IProfileControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
<section class="portfolio-block block-intro">
<div class="container">
@if (Model.Avatar != null)
{
<div class="avatar" style="background-image:url('@(Model.Avatar.GetCropUrl(width: 150, height: 150))');"></div>
}
<div class="about-me">
@Model.AboutMe
@if (Model.ProfileLink != null && !string.IsNullOrWhiteSpace(Model.ProfileLink.Url))
{
<a class="btn btn-outline-primary" role="button" target="@Model.ProfileLink.Target" href="@Model.ProfileLink.Url">@Model.ProfileLink.Name</a>
}
</div>
</div>
</section>

View File

@@ -0,0 +1,22 @@
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>
@using Umbraco.Cms.Web.Common.PublishedModels
@{
var cta = (CallToAction)Model.Content;
}
<section class="portfolio-block call-to-action border-bottom">
<div class="container">
<div class="d-flex justify-content-center align-items-center content">
@if(!string.IsNullOrWhiteSpace(cta.Text))
{
<h3>@cta.Text</h3>
}
@if(cta.Link != null)
{
<a class="btn btn-outline-primary btn-lg" target="@cta.Link.Target" href="@cta.Link.Url">@cta.Link.Name</a>
}
</div>
</div>
</section>

View File

@@ -0,0 +1,53 @@
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>
@using Umbraco.Cms.Web.Common.PublishedModels
@using System.Collections
@using Umbraco.Cms.Core.Models
@using Portfolio.Core.Extensions
@{
var cardsRow = (CardsRow)Model.Content;
}
<section class="portfolio-block skills">
<div class="container">
@if(!string.IsNullOrWhiteSpace(cardsRow.Title))
{
<div class="heading">
<h2>@cardsRow.Title</h2>
</div>
}
@if(cardsRow.Cards != null && cardsRow.Cards.Any())
{
var visibleCards = cardsRow.Cards.Where(x => x.Settings == null
|| !x.Settings.HasProperty("hide")
|| !x.Settings.HasValue("hide")
|| !x.Settings.Value<bool>("hide"));
if(visibleCards != null && visibleCards.Any())
{
<div class="row">
@foreach (var item in cardsRow.Cards)
{
IconCard card = (IconCard)item.Content;
<div class="col-md-4">
<div class="card special-skill-item border-0">
@if (!string.IsNullOrWhiteSpace(card.IconClass))
{
<div class="card-header bg-transparent border-0"><i class="icon @card.IconClass.ToIconClass()"></i></div>
}
@if(!string.IsNullOrWhiteSpace(card.Title) || !string.IsNullOrWhiteSpace(card.Description))
{
<div class="card-body">
<h3 class="card-title">@card.Title</h3>
<p class="card-text">@card.Description</p>
</div>
}
</div>
</div>
}
</div>
}
}
</div>
</section>

View File

@@ -0,0 +1,29 @@
@inherits UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListItem>
@using Umbraco.Cms.Web.Common.PublishedModels
@{
var projectPreview = (ProjectPreview)Model.Content;
}
<section class="portfolio-block website bg-primary text-white">
<div class="container">
<div class="row align-items-center">
<div class="col-md-12 col-lg-5 offset-lg-1 text">
<h3>@projectPreview.Title</h3>
<p>@projectPreview.Description</p>
</div>
<div class="col-md-12 col-lg-5">
@if (projectPreview.Image != null)
{
<div class="portfolio-laptop-mockup">
<div class="screen">
<div class="screen-content" style="background-image:url('@(projectPreview.Image.GetCropUrl(width: 298, height: 189))');"></div>
</div>
<div class="keyboard"></div>
</div>
}
</div>
</div>
</div>
</section>

View File

@@ -0,0 +1,22 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockListModel>
@using Umbraco.Extensions
@{
if (!Model.Any()) { return; }
var visibleBlocks = Model.Where(x =>
x.Settings == null
|| !x.Settings.HasProperty("hide")
|| !x.Settings.HasValue("hide")
|| !x.Settings.Value<bool>("hide"));
if (!visibleBlocks.Any()) { return; }
}
@foreach (var block in visibleBlocks)
{
if (block?.ContentUdi == null) { continue; }
var data = block.Content;
@await Html.PartialAsync("blocklist/Components/" + data.ContentType.Alias, block)
}

View File

@@ -0,0 +1,31 @@
@inherits UmbracoViewPage<ContentModels.IWorkHistoryControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
@using Portfolio.Core.Extensions
<div class="contact-info portfolio-info-card">
@if (!string.IsNullOrWhiteSpace(Model?.ContactInfoTitle ?? ""))
{
<h2>@Model.ContactInfoTitle</h2>
}
@if (Model.ContactInfo != null && Model.ContactInfo.Any())
{
foreach (var item in Model.ContactInfo)
{
<div class="row">
<div class="col-1"><i class="icon @(item.Value<string>("icon").ToIconClass())"></i></div>
@if (item is ContentModels.IconLinkItem)
{
var linkItem = item as ContentModels.IconLinkItem;
<div class="col-9"><span><a href="@(linkItem.Link.Url)" target="@linkItem.Link.Target">@linkItem.Link.Name</a></span></div>
}
else if (item is ContentModels.IconTextItem)
{
<div class="col-9"><span>@(item.Value<string>("text"))</span></div>
}
</div>
}
}
</div>

View File

@@ -0,0 +1,26 @@
@inherits UmbracoViewPage<ContentModels.IWorkHistoryControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
<div class="education group">
<div class="heading">
<h2 class="text-center">@Model.EducationHistoryTitle</h2>
</div>
@if (Model.EducationHistory != null && Model.EducationHistory.Any())
{
foreach (var item in Model.EducationHistory)
{
<div class="item">
<div class="row">
<div class="col-md-6">
<h3>@item.Title</h3>
<h4 class="organization">@item.PlaceName</h4>
</div>
<div class="col-md-6"><span class="period">@item.StartDate.ToString("MM/yyyy") - @(item.EndDate != null && item.EndDate > DateTime.MinValue ? item.EndDate.ToString("MM/yyyy") : "Present")</span></div>
</div>
<div class="text-muted">@item.Details</div>
</div>
}
}
</div>

View File

@@ -0,0 +1,38 @@
@inherits UmbracoViewPage<ContentModels.IFooterControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
@using Portfolio.Core.Extensions
@if (Model != null)
{
var homePage = (IPublishedContent)Model;
<footer class="page-footer">
<div class="container">
@if (Model.FooterContentLinks != null && Model.FooterContentLinks.Any())
{
<div class="links">
@foreach (var item in Model.FooterContentLinks)
{
<a href="@item.Url" target="@item.Target">@item.Name</a>
}
</div>
}
@if (Model.FooterSocialLinks != null && Model.FooterSocialLinks.Any())
{
<div class="social-icons">
@foreach (var item in Model.FooterSocialLinks)
{
@if (item is ContentModels.IconLinkItem)
{
var linkItem = item as ContentModels.IconLinkItem;
<a href="@(linkItem.Link.Url)" target="@linkItem.Link.Target" rel="noopener" title="@linkItem.Link.Name" class="bg-primary"><i class="icon @(item.Value<string>("icon").ToIconClass())"></i></a>
}
}
</div>
}
<p class="text-center small">&copy; Copyright @homePage.GetSiteName() @DateTime.UtcNow.Year</p>
</div>
</footer>
}

View File

@@ -0,0 +1,106 @@
@using System.Web
@using Microsoft.AspNetCore.Html
@using Newtonsoft.Json.Linq
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<dynamic>
@*
Razor helpers located at the bottom of this file
*@
@if (Model is JObject && Model?.sections is not null)
{
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
<div class="umb-grid">
@if (oneColumn)
{
foreach (var section in Model.sections)
{
<div class="grid-section">
@foreach (var row in section.rows)
{
renderRow(row);
}
</div>
}
}
else
{
<div class="row clearfix">
@foreach (var sec in Model.sections)
{
<div class="grid-section">
<div class="col-md-@sec.grid column">
@foreach (var row in sec.rows)
{
renderRow(row);
}
</div>
</div>
}
</div>
}
</div>
}
@functions{
private async Task renderRow(dynamic row)
{
<div @RenderElementAttributes(row)>
<div class="row clearfix">
@foreach (var area in row.areas)
{
<div class="col-md-@area.grid column">
<div @RenderElementAttributes(area)>
@foreach (var control in area.controls)
{
if (control?.editor?.view != null)
{
<text>@await Html.PartialAsync("grid/editors/base", (object)control)</text>
}
}
</div>
</div>
}
</div>
</div>
}
}
@functions{
public static HtmlString RenderElementAttributes(dynamic contentItem)
{
var attrs = new List<string>();
JObject cfg = contentItem.config;
if (cfg != null)
{
foreach (JProperty property in cfg.Properties())
{
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
}
}
JObject style = contentItem.styles;
if (style != null) {
var cssVals = new List<string>();
foreach (JProperty property in style.Properties())
{
var propertyValue = property.Value.ToString();
if (string.IsNullOrWhiteSpace(propertyValue) == false)
{
cssVals.Add(property.Name + ":" + propertyValue + ";");
}
}
if (cssVals.Any())
attrs.Add("style='" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "'");
}
return new HtmlString(string.Join(" ", attrs));
}
}

View File

@@ -0,0 +1,112 @@
@using System.Web
@using Microsoft.AspNetCore.Html
@using Newtonsoft.Json.Linq
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<dynamic>
@if (Model is JObject && Model?.sections is not null)
{
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
<div class="umb-grid">
@if (oneColumn)
{
foreach (var section in Model.sections)
{
<div class="grid-section">
@foreach (var row in section.rows)
{
renderRow(row, true);
}
</div>
}
}
else
{
<div class="container">
<div class="row clearfix">
@foreach (var sec in Model.sections)
{
<div class="grid-section">
<div class="col-md-@sec.grid column">
@foreach (var row in sec.rows)
{
renderRow(row, false);
}
</div>
</div>
}
</div>
</div>
}
</div>
}
@functions{
private async Task renderRow(dynamic row, bool singleColumn)
{
<div @RenderElementAttributes(row)>
@if (singleColumn) {
@:<div class="container">
}
<div class="row clearfix">
@foreach (var area in row.areas)
{
<div class="col-md-@area.grid column">
<div @RenderElementAttributes(area)>
@foreach (var control in area.controls)
{
if (control?.editor?.view != null)
{
<text>@await Html.PartialAsync("grid/editors/base", (object)control)</text>
}
}
</div>
</div>
}
</div>
@if (singleColumn) {
@:</div>
}
</div>
}
}
@functions{
public static HtmlString RenderElementAttributes(dynamic contentItem)
{
var attrs = new List<string>();
JObject cfg = contentItem.config;
if (cfg != null)
{
foreach (JProperty property in cfg.Properties())
{
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
}
}
JObject style = contentItem.styles;
if (style != null)
{
var cssVals = new List<string>();
foreach (JProperty property in style.Properties())
{
var propertyValue = property.Value.ToString();
if (string.IsNullOrWhiteSpace(propertyValue) == false)
{
cssVals.Add(property.Name + ":" + propertyValue + ";");
}
}
if (cssVals.Any())
attrs.Add("style=\"" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "\"");
}
return new HtmlString(string.Join(" ", attrs));
}
}

View File

@@ -0,0 +1,27 @@
@model dynamic
@try
{
string editor = EditorView(Model);
<text>@await Html.PartialAsync(editor, Model as object)</text>
}
catch (Exception ex)
{
<pre>@ex.ToString()</pre>
}
@functions{
public static string EditorView(dynamic contentItem)
{
string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString();
view = view.Replace(".html", ".cshtml");
if (!view.Contains("/"))
{
view = "grid/editors/" + view;
}
return view;
}
}

View File

@@ -0,0 +1,11 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<dynamic>
@if (Model is not null)
{
string embedValue = Convert.ToString(Model.value);
embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value;
<div class="video-wrapper">
@Html.Raw(embedValue)
</div>
}

View File

@@ -0,0 +1,15 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<dynamic>
@if (Model?.value is not null)
{
string macroAlias = Model.value.macroAlias.ToString();
var parameters = new Dictionary<string,object>();
foreach (var mpd in Model.value.macroParamsDictionary)
{
parameters.Add(mpd.Name, mpd.Value);
}
<text>
@await Umbraco.RenderMacroAsync(macroAlias, parameters)
</text>
}

View File

@@ -0,0 +1,64 @@
@model dynamic
@using Umbraco.Cms.Core.Media
@using Umbraco.Cms.Core.PropertyEditors.ValueConverters
@inject IImageUrlGenerator ImageUrlGenerator
@if (Model?.value is not null)
{
var url = Model.value.image;
if (Model.editor.config != null && Model.editor.config.size != null)
{
if (Model.value.coordinates != null)
{
url = ImageCropperTemplateCoreExtensions.GetCropUrl(
(string)url,
ImageUrlGenerator,
width: (int)Model.editor.config.size.width,
height: (int)Model.editor.config.size.height,
cropAlias: "default",
cropDataSet: new ImageCropperValue
{
Crops = new[]
{
new ImageCropperValue.ImageCropperCrop
{
Alias = "default",
Coordinates = new ImageCropperValue.ImageCropperCropCoordinates
{
X1 = (decimal)Model.value.coordinates.x1,
Y1 = (decimal)Model.value.coordinates.y1,
X2 = (decimal)Model.value.coordinates.x2,
Y2 = (decimal)Model.value.coordinates.y2
}
}
}
});
}
else
{
url = ImageCropperTemplateCoreExtensions.GetCropUrl(
(string)url,
ImageUrlGenerator,
width: (int)Model.editor.config.size.width,
height: (int)Model.editor.config.size.height,
cropDataSet: new ImageCropperValue
{
FocalPoint = new ImageCropperValue.ImageCropperFocalPoint
{
Top = Model.value.focalPoint == null ? 0.5m : Model.value.focalPoint.top,
Left = Model.value.focalPoint == null ? 0.5m : Model.value.focalPoint.left
}
});
}
}
var altText = Model.value.altText ?? Model.value.caption ?? string.Empty;
<img src="@url" alt="@altText">
if (Model.value.caption != null)
{
<p class="caption">@Model.value.caption</p>
}
}

View File

@@ -0,0 +1,13 @@
@using Umbraco.Cms.Core.Templates
@model dynamic
@inject HtmlLocalLinkParser HtmlLocalLinkParser;
@inject HtmlUrlParser HtmlUrlParser;
@inject HtmlImageSourceParser HtmlImageSourceParser;
@{
var value = HtmlLocalLinkParser.EnsureInternalLinks(Model?.value.ToString());
value = HtmlUrlParser.EnsureUrls(value);
value = HtmlImageSourceParser.EnsureImageSources(value);
}
@Html.Raw(value)

View File

@@ -0,0 +1,23 @@
@using System.Web
@model dynamic
@if (Model?.editor.config.markup is not null)
{
string markup = Model.editor.config.markup.ToString();
markup = markup.Replace("#value#", Html.ReplaceLineBreaks((string)Model.value.ToString()).ToString());
if (Model.editor.config.style != null)
{
markup = markup.Replace("#style#", Model.editor.config.style.ToString());
}
<text>
@Html.Raw(markup)
</text>
}
else
{
<text>
<div style="@Model?.editor.config.style">@Model?.value</div>
</text>
}

View File

@@ -0,0 +1,13 @@
@inherits UmbracoViewPage<ContentModels.CV>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
<div class="hobbies group">
<div class="heading">
<h2 class="text-center">@Model.HobbiesTitle</h2>
</div>
<div class="text-center w-100">
<p class="text-muted">@Model.Hobbies</p>
</div>
</div>

View File

@@ -0,0 +1,34 @@
@inherits UmbracoViewPage<ContentModels.ProjectList>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
@using Portfolio.Core.Extensions
@{
var projects = Model != null ? Model.Children<ContentModels.Project>().Where(x => x.IsVisible()) : Enumerable.Empty<ContentModels.Project>();
}
@if (projects != null && projects.Any())
{
<section class="portfolio-block photography">
<div class="container">
<div class="row no-gutters">
@foreach (var project in projects)
{
var projectTitle = project.GetPageTitle();
<div class="col-md-6 col-lg-4 item zoom-on-hover">
<a href="@project.Url()" title="@projectTitle">
@if (project.MainImage != null)
{
<img class="img-fluid image" width="663" height="442" src="@project.MainImage.GetCropUrl(width: 663, height: 442)" alt="@project.MainImage.GetAltText()">
}
else
{
@projectTitle;
}
</a>
</div>
}
</div>
</div>
</section>
}

View File

@@ -0,0 +1,10 @@
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage
@using Portfolio.Core.Extensions
<meta charset="utf-8">
<meta content="IE=edge,chrome=1' http-equiv='X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<meta name="description" content="@Model.GetMetaDescription()">
<title>@Model.GetMetaTitle()</title>
<link rel="canonical" href="@Model.GetCanonicalUrl()">

View File

@@ -0,0 +1,17 @@
@inherits UmbracoViewPage<ContentModels.IWorkHistoryControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
<div class="skills portfolio-info-card">
<h2>@Model.SkillsTitle</h2>
@if (Model.Skills != null && Model.Skills.Any())
{
foreach (var item in Model.Skills)
{
<h3>@item.Skill</h3>
<div class="progress">
<div class="progress-bar" aria-valuenow="@(item.Rating)" aria-valuemin="0" aria-valuemax="100" style="width: @(item.Rating)%;"><span class="sr-only">@(item.Rating)%</span></div>
</div>
}
}
</div>

View File

@@ -0,0 +1,25 @@
@inherits UmbracoViewPage<ContentModels.Home>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
@{
var pages = Model?.Children().Where(x => x.IsVisible()) ?? Enumerable.Empty<IPublishedContent>();
}
<nav class="navbar navbar-dark navbar-expand-lg fixed-top bg-primary portfolio-navbar">
<div class="container">
<a class="navbar-brand logo" href="@Model.Url()">@(Model.SiteName)</a><button data-toggle="collapse" class="navbar-toggler" data-target="#navbarNav"><span class="sr-only">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link active" href="@Model.Url()">@Model.Name</a></li>
@if (pages != null && pages.Any())
{
@foreach (var item in pages)
{
<li class="nav-item"><a class="nav-link active" href="@item.Url()">@item.Name</a></li>
}
}
</ul>
</div>
</div>
</nav>

View File

@@ -0,0 +1,25 @@
@inherits UmbracoViewPage<ContentModels.IWorkHistoryControls>
@using ContentModels = Umbraco.Cms.Web.Common.PublishedModels
<div class="work-experience group">
<div class="heading">
<h2 class="text-center">@Model.WorkHistoryTitle</h2>
</div>
@if (Model.WorkHistory != null && Model.WorkHistory.Any())
{
foreach (var item in Model.WorkHistory)
{
<div class="item">
<div class="row">
<div class="col-md-6">
<h3>@item.Title</h3>
<h4 class="organization">@item.PlaceName</h4>
</div>
<div class="col-md-6"><span class="period">@item.StartDate.ToString("MM/yyyy") - @(item.EndDate != null && item.EndDate > DateTime.MinValue ? item.EndDate.ToString("MM/yyyy") : "Present")</span></div>
</div>
<div class="text-muted">@item.Details</div>
</div>
}
}
</div>