Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eceb9a8

Browse files
committed
Revert "remove v8 site"
This reverts commit 6d48eb4.
1 parent 6d48eb4 commit eceb9a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2583
-15
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ Examples include:
1919
> This repository contains examples of the current backoffice UI, which are not (yet) based on the new [Umbraco UI Library](https://github.com/umbraco/Umbraco.UI).
2020
2121
## Installing the Package
22-
Umbraco v13: install the NuGet package using `dotnet add package Our.Umbraco.UiExamples` *or* manually adding a `PackageReference` to your project file.
22+
Umbraco v8: the UI Examples package can be added via the Package section of the backoffice *or* using NuGet (e.g. from the Package Manager Console: `Install-Package Our.Umbraco.UiExamples`).
23+
24+
Umbraco v9: install the NuGet package using `dotnet add package Our.Umbraco.UiExamples` *or* manually adding a `PackageReference` to your project file.
2325

2426
## Contributing
2527
Contributions are welcome! Please refer to the [issues list](./issues) for ideas of where help is needed.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Administrator",
3+
"email": "[email protected]",
4+
"password": "1234567890"
5+
}

samples/Umbraco8.Website/Global.asax

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Inherits="Umbraco.Web.UmbracoApplication" Language="C#" %>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<configuration>
3+
<system.webServer>
4+
<handlers>
5+
<clear />
6+
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
7+
</handlers>
8+
</system.webServer>
9+
</configuration>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Umbraco8.Website")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Umbraco8.Website")]
13+
[assembly: AssemblyCopyright("Copyright © 2021")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("7c6c2ffa-25a4-4cc4-9aa1-49b2dfb68dfc")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]

samples/Umbraco8.Website/Umbraco8.Website.csproj

Lines changed: 413 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@inherits UmbracoViewPage<BlockListModel>
2+
@using Umbraco.Core.Models.Blocks
3+
@{
4+
if (!Model.Any()) { return; }
5+
}
6+
<div class="umb-block-list">
7+
@foreach (var block in Model)
8+
{
9+
if (block?.ContentUdi == null) { continue; }
10+
var data = block.Content;
11+
@Html.Partial("BlockList/Components/" + data.ContentType.Alias, block)
12+
}
13+
</div>
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
@inherits UmbracoViewPage<dynamic>
2+
@using Umbraco.Web.Templates
3+
@using Newtonsoft.Json.Linq
4+
5+
@*
6+
Razor helpers located at the bottom of this file
7+
*@
8+
9+
@if (Model != null && Model.GetType() == typeof(JObject) && Model.sections != null)
10+
{
11+
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
12+
13+
<div class="umb-grid">
14+
@if (oneColumn)
15+
{
16+
foreach (var section in Model.sections) {
17+
<div class="grid-section">
18+
@foreach (var row in section.rows) {
19+
@renderRow(row)
20+
}
21+
</div>
22+
}
23+
}else {
24+
<div class="row clearfix">
25+
@foreach (var s in Model.sections) {
26+
<div class="grid-section">
27+
<div class="[email protected] column">
28+
@foreach (var row in s.rows) {
29+
@renderRow(row)
30+
}
31+
</div>
32+
</div>
33+
}
34+
</div>
35+
}
36+
</div>
37+
}
38+
39+
@helper renderRow(dynamic row){
40+
<div @RenderElementAttributes(row)>
41+
<div class="row clearfix">
42+
@foreach ( var area in row.areas ) {
43+
<div class="[email protected] column">
44+
<div @RenderElementAttributes(area)>
45+
@foreach (var control in area.controls) {
46+
if (control !=null && control.editor != null && control.editor.view != null ) {
47+
<text>@Html.Partial("grid/editors/base", (object)control)</text>
48+
}
49+
}
50+
</div>
51+
</div>}
52+
</div>
53+
</div>
54+
}
55+
56+
@functions {
57+
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
58+
{
59+
var attrs = new List<string>();
60+
JObject cfg = contentItem.config;
61+
62+
if(cfg != null)
63+
foreach (JProperty property in cfg.Properties())
64+
{
65+
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
66+
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
67+
}
68+
69+
JObject style = contentItem.styles;
70+
71+
if (style != null) {
72+
var cssVals = new List<string>();
73+
foreach (JProperty property in style.Properties())
74+
{
75+
var propertyValue = property.Value.ToString();
76+
if (string.IsNullOrWhiteSpace(propertyValue) == false)
77+
{
78+
cssVals.Add(property.Name + ":" + propertyValue + ";");
79+
}
80+
}
81+
82+
if (cssVals.Any())
83+
attrs.Add("style='" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "'");
84+
}
85+
86+
return new MvcHtmlString(string.Join(" ", attrs));
87+
}
88+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
@inherits UmbracoViewPage<dynamic>
2+
@using Umbraco.Web.Templates
3+
@using Newtonsoft.Json.Linq
4+
5+
@if (Model != null && Model.GetType() == typeof(JObject) && Model.sections != null)
6+
{
7+
var oneColumn = ((System.Collections.ICollection)Model.sections).Count == 1;
8+
9+
<div class="umb-grid">
10+
@if (oneColumn)
11+
{
12+
foreach (var section in Model.sections) {
13+
<div class="grid-section">
14+
@foreach (var row in section.rows) {
15+
@renderRow(row, true)
16+
}
17+
</div>
18+
}
19+
}else {
20+
<div class="container">
21+
<div class="row clearfix">
22+
@foreach (var s in Model.sections) {
23+
<div class="grid-section">
24+
<div class="[email protected] column">
25+
@foreach (var row in s.rows) {
26+
@renderRow(row, false)
27+
}
28+
</div>
29+
</div>
30+
}
31+
</div>
32+
</div>
33+
}
34+
</div>
35+
}
36+
37+
@helper renderRow(dynamic row, bool singleColumn){
38+
<div @RenderElementAttributes(row)>
39+
@if (singleColumn) {
40+
@:<div class="container">
41+
}
42+
<div class="row clearfix">
43+
@foreach ( var area in row.areas ) {
44+
<div class="[email protected] column">
45+
<div @RenderElementAttributes(area)>
46+
@foreach (var control in area.controls) {
47+
if (control !=null && control.editor != null && control.editor.view != null ) {
48+
<text>@Html.Partial("grid/editors/base", (object)control)</text>
49+
}
50+
}
51+
</div>
52+
</div>}
53+
</div>
54+
@if (singleColumn) {
55+
@:</div>
56+
}
57+
</div>
58+
}
59+
60+
@functions {
61+
public static MvcHtmlString RenderElementAttributes(dynamic contentItem)
62+
{
63+
var attrs = new List<string>();
64+
JObject cfg = contentItem.config;
65+
66+
if(cfg != null)
67+
foreach (JProperty property in cfg.Properties())
68+
{
69+
var propertyValue = HttpUtility.HtmlAttributeEncode(property.Value.ToString());
70+
attrs.Add(property.Name + "=\"" + propertyValue + "\"");
71+
}
72+
73+
JObject style = contentItem.styles;
74+
75+
if (style != null) {
76+
var cssVals = new List<string>();
77+
foreach (JProperty property in style.Properties())
78+
{
79+
var propertyValue = property.Value.ToString();
80+
if (string.IsNullOrWhiteSpace(propertyValue) == false)
81+
{
82+
cssVals.Add(property.Name + ":" + propertyValue + ";");
83+
}
84+
}
85+
86+
if (cssVals.Any())
87+
attrs.Add("style=\"" + HttpUtility.HtmlAttributeEncode(string.Join(" ", cssVals)) + "\"");
88+
}
89+
90+
return new MvcHtmlString(string.Join(" ", attrs));
91+
}
92+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@model dynamic
2+
@using Umbraco.Web.Templates
3+
4+
@functions {
5+
public static string EditorView(dynamic contentItem)
6+
{
7+
string view = contentItem.editor.render != null ? contentItem.editor.render.ToString() : contentItem.editor.view.ToString();
8+
view = view.ToLower().Replace(".html", ".cshtml");
9+
10+
if (!view.Contains("/")) {
11+
view = "grid/editors/" + view;
12+
}
13+
14+
return view;
15+
}
16+
}
17+
@try
18+
{
19+
string editor = EditorView(Model);
20+
<text>@Html.Partial(editor, (object)Model)</text>
21+
}
22+
catch (Exception ex) {
23+
<pre>@ex.ToString()</pre>
24+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@model dynamic
2+
@using Umbraco.Web.Templates
3+
@{
4+
string embedValue = Convert.ToString(Model.value);
5+
embedValue = embedValue.DetectIsJson() ? Model.value.preview : Model.value;
6+
}
7+
8+
<div class="video-wrapper">
9+
@Html.Raw(embedValue)
10+
</div>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@inherits UmbracoViewPage<dynamic>
2+
@using Umbraco.Web.Templates
3+
4+
5+
@if (Model.value != null)
6+
{
7+
string macroAlias = Model.value.macroAlias.ToString();
8+
ViewDataDictionary parameters = new ViewDataDictionary();
9+
foreach (dynamic mpd in Model.value.macroParamsDictionary)
10+
{
11+
parameters.Add(mpd.Name, mpd.Value);
12+
}
13+
14+
<text>
15+
@Umbraco.RenderMacro(macroAlias, parameters)
16+
</text>
17+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@model dynamic
2+
@using Umbraco.Core.PropertyEditors.ValueConverters
3+
4+
@if (Model.value != null)
5+
{
6+
var url = Model.value.image;
7+
if(Model.editor.config != null && Model.editor.config.size != null){
8+
if (Model.value.coordinates != null)
9+
{
10+
url = ImageCropperTemplateExtensions.GetCropUrl(
11+
(string)url,
12+
width: (int)Model.editor.config.size.width,
13+
height: (int)Model.editor.config.size.height,
14+
cropAlias: "default",
15+
cropDataSet: new ImageCropperValue
16+
{
17+
Crops = new[]
18+
{
19+
new ImageCropperValue.ImageCropperCrop
20+
{
21+
Alias = "default",
22+
Coordinates = new ImageCropperValue.ImageCropperCropCoordinates
23+
{
24+
X1 = (decimal)Model.value.coordinates.x1,
25+
Y1 = (decimal)Model.value.coordinates.y1,
26+
X2 = (decimal)Model.value.coordinates.x2,
27+
Y2 = (decimal)Model.value.coordinates.y2
28+
}
29+
}
30+
}
31+
});
32+
}
33+
else
34+
{
35+
url = ImageCropperTemplateExtensions.GetCropUrl(
36+
(string)url,
37+
width: (int)Model.editor.config.size.width,
38+
height: (int)Model.editor.config.size.height,
39+
cropDataSet: new ImageCropperValue
40+
{
41+
FocalPoint = new ImageCropperValue.ImageCropperFocalPoint
42+
{
43+
Top = Model.value.focalPoint == null ? 0.5m : Model.value.focalPoint.top,
44+
Left = Model.value.focalPoint == null ? 0.5m : Model.value.focalPoint.left
45+
}
46+
});
47+
}
48+
}
49+
50+
var altText = Model.value.altText ?? Model.value.caption ?? string.Empty;
51+
52+
<img src="@url" alt="@altText">
53+
54+
if (Model.value.caption != null)
55+
{
56+
<p class="caption">@Model.value.caption</p>
57+
}
58+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@model dynamic
2+
@using Umbraco.Web.Composing
3+
@using Umbraco.Web.Templates
4+
@{
5+
var htmlLocalLinkParser = Current.Factory.GetInstance<HtmlLocalLinkParser>();
6+
var htmlUrlParser = Current.Factory.GetInstance<HtmlUrlParser>();
7+
var htmlImageSourceParser = Current.Factory.GetInstance<HtmlImageSourceParser>();
8+
9+
var value = htmlLocalLinkParser.EnsureInternalLinks(Model.value.ToString());
10+
value = htmlUrlParser.EnsureUrls(value);
11+
value = htmlImageSourceParser.EnsureImageSources(value);
12+
}
13+
@Html.Raw(value)

0 commit comments

Comments
 (0)