Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- end of episode 6 where we added the grid
- Loading branch information
Showing
10 changed files
with
499 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ | |
/CleanBlog.Web/obj/Debug | ||
/CleanBlog.Web/Umbraco | ||
/packages | ||
/CleanBlog.Core/bin/Debug | ||
/CleanBlog.Core/obj/Debug |
Large diffs are not rendered by default.
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,22 @@ | ||
using System.Web; | ||
using System.Web.Mvc; | ||
using Umbraco.Core.Models.PublishedContent; | ||
using Umbraco.Web; | ||
|
||
namespace CleanBlog.Core.Extensions | ||
{ | ||
public static class HtmlExtensions | ||
{ | ||
public static IHtmlString GetGridHtml(this HtmlHelper html, IPublishedContent contentItem, string framework, string propertyAlias, bool fluidImages) | ||
{ | ||
if (fluidImages) | ||
{ | ||
return html.Raw(html.GetGridHtml(contentItem, framework, propertyAlias).ToString().Replace("<img ", "<img class=\"img-fluid\" ")); | ||
} | ||
else | ||
{ | ||
return html.GetGridHtml(contentItem, propertyAlias, framework); | ||
} | ||
} | ||
} | ||
} |
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,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("CleanBlog.Core")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("CleanBlog.Core")] | ||
[assembly: AssemblyCopyright("Copyright © 2019")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("e508ad0f-0e2a-4dde-b0e7-213ff9d8e78e")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> | ||
</dependentAssembly> | ||
<dependentAssembly> | ||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
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,57 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="ClientDependency" version="1.9.7" targetFramework="net472" /> | ||
<package id="ClientDependency-Mvc5" version="1.8.0.0" targetFramework="net472" /> | ||
<package id="CSharpTest.Net.Collections" version="14.906.1403.1082" targetFramework="net472" /> | ||
<package id="Examine" version="1.0.0" targetFramework="net472" /> | ||
<package id="HtmlAgilityPack" version="1.8.14" targetFramework="net472" /> | ||
<package id="ImageProcessor" version="2.7.0.100" targetFramework="net472" /> | ||
<package id="LightInject" version="5.4.0" targetFramework="net472" /> | ||
<package id="LightInject.Annotation" version="1.1.0" targetFramework="net472" /> | ||
<package id="LightInject.Mvc" version="2.0.0" targetFramework="net472" /> | ||
<package id="LightInject.Web" version="2.0.0" targetFramework="net472" /> | ||
<package id="LightInject.WebApi" version="2.0.0" targetFramework="net472" /> | ||
<package id="Lucene.Net" version="3.0.3" targetFramework="net472" /> | ||
<package id="Markdown" version="2.2.1" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.2" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.2" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.SignalR.Core" version="2.4.0" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" /> | ||
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="2.0.0" targetFramework="net472" /> | ||
<package id="Microsoft.Owin" version="4.0.1" targetFramework="net472" /> | ||
<package id="Microsoft.Owin.Host.SystemWeb" version="4.0.1" targetFramework="net472" /> | ||
<package id="Microsoft.Owin.Security" version="4.0.1" targetFramework="net472" /> | ||
<package id="Microsoft.Owin.Security.Cookies" version="4.0.1" targetFramework="net472" /> | ||
<package id="Microsoft.Owin.Security.OAuth" version="4.0.1" targetFramework="net472" /> | ||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" /> | ||
<package id="MiniProfiler" version="4.0.138" targetFramework="net472" /> | ||
<package id="MiniProfiler.Shared" version="4.0.138" targetFramework="net472" /> | ||
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net472" /> | ||
<package id="NPoco" version="3.9.4" targetFramework="net472" /> | ||
<package id="Owin" version="1.0" targetFramework="net472" /> | ||
<package id="Semver" version="2.0.4" targetFramework="net472" /> | ||
<package id="Serilog" version="2.8.0" targetFramework="net472" /> | ||
<package id="Serilog.Enrichers.Process" version="2.0.1" targetFramework="net472" /> | ||
<package id="Serilog.Enrichers.Thread" version="3.0.0" targetFramework="net472" /> | ||
<package id="Serilog.Filters.Expressions" version="2.0.0" targetFramework="net472" /> | ||
<package id="Serilog.Formatting.Compact" version="1.0.0" targetFramework="net472" /> | ||
<package id="Serilog.Formatting.Compact.Reader" version="1.0.3" targetFramework="net472" /> | ||
<package id="Serilog.Settings.AppSettings" version="2.2.2" targetFramework="net472" /> | ||
<package id="Serilog.Sinks.Async" version="1.3.0" targetFramework="net472" /> | ||
<package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net472" /> | ||
<package id="Serilog.Sinks.Map" version="1.0.0" targetFramework="net472" /> | ||
<package id="SharpZipLib" version="0.86.0" targetFramework="net472" /> | ||
<package id="Superpower" version="2.0.0" targetFramework="net472" /> | ||
<package id="System.Diagnostics.DiagnosticSource" version="4.4.1" targetFramework="net472" /> | ||
<package id="System.Threading.Tasks.Dataflow" version="4.9.0" targetFramework="net472" /> | ||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" /> | ||
<package id="Umbraco.SqlServerCE" version="4.0.0.1" targetFramework="net472" /> | ||
<package id="UmbracoCms.Core" version="8.1.4" targetFramework="net472" /> | ||
<package id="UmbracoCms.Web" version="8.1.4" targetFramework="net472" /> | ||
</packages> |
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,80 @@ | ||
@inherits UmbracoViewPage<dynamic> | ||
@using Umbraco.Web.Templates | ||
@using Newtonsoft.Json.Linq | ||
|
||
@if (Model != null && Model.sections != null) | ||
{ | ||
<div class="umb-grid"> | ||
@foreach (var section in Model.sections) | ||
{ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-lg-8 col-md-10 mx-auto"> | ||
<div class="grid-section"> | ||
@foreach (var row in section.rows) | ||
{ | ||
@renderRow(row); | ||
} | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
</div> | ||
} | ||
|
||
@helper 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 != null && control.editor != null && control.editor.view != null) | ||
{ | ||
<text>@Html.Partial("grid/editors/base", (object)control)</text> | ||
} | ||
} | ||
</div> | ||
</div>} | ||
</div> | ||
</div> | ||
} | ||
|
||
@functions { | ||
public static MvcHtmlString 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 MvcHtmlString(string.Join(" ", attrs)); | ||
} | ||
} |
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