Skip to content

Commit

Permalink
Merge branch 'v8/dev' into v8/contrib
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/Umbraco.Web.UI.Client/package.json
#	src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js
#	src/Umbraco.Web.UI.Client/src/common/directives/validation/valformmanager.directive.js
#	src/Umbraco.Web.UI.Client/src/common/services/formhelper.service.js
#	src/Umbraco.Web.UI.Client/src/views/components/overlays/umb-overlay.html
#	src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js
#	src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.html
#	src/Umbraco.Web.UI.Client/src/views/dictionary/edit.html
#	src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
  • Loading branch information
nul800sebastiaan committed Aug 19, 2020
2 parents 5d93d8e + 39fcdb0 commit c8da515
Show file tree
Hide file tree
Showing 245 changed files with 30,032 additions and 4,209 deletions.
79 changes: 41 additions & 38 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
end_of_line = crlf
indent_style = space
indent_size = 4

# Trim trailing whitespace, limited support.
# https://github.com/editorconfig/editorconfig/wiki/Property-research:-Trim-trailing-spaces
trim_trailing_whitespace = true

[*.{cs,vb}]
dotnet_style_predefined_type_for_locals_parameters_members = true:error

dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _

# https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/ide/editorconfig-code-style-settings-reference.md
[*.cs]
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
insert_final_newline = true
end_of_line = crlf
indent_style = space
indent_size = 4

# Trim trailing whitespace, limited support.
# https://github.com/editorconfig/editorconfig/wiki/Property-research:-Trim-trailing-spaces
trim_trailing_whitespace = true

[*.{cs,vb}]
dotnet_style_predefined_type_for_locals_parameters_members = true:error

dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
dotnet_naming_rule.private_members_with_underscore.severity = suggestion

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

dotnet_naming_style.prefix_underscore.capitalization = camel_case
dotnet_naming_style.prefix_underscore.required_prefix = _

# https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/ide/editorconfig-code-style-settings-reference.md
[*.cs]
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_prefer_braces = false : none

[*.{js,less}]

[*.js]
trim_trailing_whitespace = true

[*.less]
trim_trailing_whitespace = false
52 changes: 52 additions & 0 deletions build/V8-Docs-Pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
##############################################################
## V8 CMS - .NET & AngularJS Doc sites ##
## Built on demand only, NO automatic PR/branch triggers ##
## ##
## This build pipeline has a webhook for sucessful ##
## builds, that sends the ZIP artifacts to our.umb to host ##
##############################################################

# Name != name of pipeline but the build number format
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/run-number?view=azure-devops&tabs=yaml

# Build Pipeline triggers
# https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#ci-triggers
trigger: none
pr: none

# Variables & their default values
variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

# VM to run the build on & it's installed software
# https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops
# https://github.com/actions/virtual-environments/blob/master/images/win/Windows2019-Readme.md
pool:
vmImage: 'windows-2019'

jobs:
- job: buildDocs
displayName: 'Build static docs site as ZIPs'
steps:

- task: PowerShell@2
displayName: 'Prep build tool, build C# & JS Docs'
inputs:
targetType: 'inline'
script: |
$uenv=./build.ps1 -get -doc
$uenv.SandboxNode()
$uenv.CompileBelle()
$uenv.PrepareAngularDocs()
$nugetsourceUmbraco = "https://api.nuget.org/v3/index.json"
$uenv.PrepareCSharpDocs()
$uenv.RestoreNode()
errorActionPreference: 'continue'
workingDirectory: 'build'

- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.Repository.LocalPath)\build.out\'
artifact: 'docs'
publishLocation: 'pipeline'
16 changes: 9 additions & 7 deletions build/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,11 @@
Write-Host "Prepare C# Documentation"

$src = "$($this.SolutionRoot)\src"
$tmp = $this.BuildTemp
$out = $this.BuildOutput
$tmp = $this.BuildTemp
$out = $this.BuildOutput
$DocFxJson = Join-Path -Path $src "\ApiDocs\docfx.json"
$DocFxSiteOutput = Join-Path -Path $tmp "\_site\*.*"


#restore nuget packages
$this.RestoreNuGet()
# run DocFx
$DocFx = $this.BuildEnv.DocFx

Expand All @@ -463,17 +460,22 @@
$src = "$($this.SolutionRoot)\src"
$out = $this.BuildOutput

# Check if the solution has been built
if (!(Test-Path "$src\Umbraco.Web.UI.Client\node_modules")) {throw "Umbraco needs to be built before generating the Angular Docs"}

"Moving to Umbraco.Web.UI.Docs folder"
cd ..\src\Umbraco.Web.UI.Docs
cd $src\Umbraco.Web.UI.Docs

"Generating the docs and waiting before executing the next commands"
& npm install
& npx gulp docs

Pop-Location

# change baseUrl
$BaseUrl = "https://our.umbraco.com/apidocs/v8/ui/"
$IndexPath = "./api/index.html"
(Get-Content $IndexPath).replace('location.href.replace(rUrl, indexFile)', "`'" + $BaseUrl + "`'") | Set-Content $IndexPath
(Get-Content $IndexPath).replace('origin + location.href.substr(origin.length).replace(rUrl, indexFile)', "`'" + $BaseUrl + "`'") | Set-Content $IndexPath

# zip it
& $this.BuildEnv.Zip a -tzip -r "$out\ui-docs.zip" "$src\Umbraco.Web.UI.Docs\api\*.*"
Expand Down
5 changes: 5 additions & 0 deletions src/Umbraco.Core/Constants-PropertyEditors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public static class Aliases
/// </summary>
public static class Aliases
{
/// <summary>
/// Block List.
/// </summary>
public const string BlockList = "Umbraco.BlockList";

/// <summary>
/// CheckBox List.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions src/Umbraco.Core/Contants-UdiEntityType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ internal static Dictionary<string, UdiType> GetTypes()
{ Unknown, UdiType.Unknown },

{ AnyGuid, UdiType.GuidUdi },
{ Element, UdiType.GuidUdi },
{ Document, UdiType.GuidUdi },
{ DocumentBlueprint, UdiType.GuidUdi },
{ Media, UdiType.GuidUdi },
Expand Down Expand Up @@ -64,6 +65,8 @@ internal static Dictionary<string, UdiType> GetTypes()

public const string AnyGuid = "any-guid"; // that one is for tests

public const string Element = "element";

public const string Document = "document";

public const string DocumentBlueprint = "document-blueprint";
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ protected void DefinePlan()
To<MissingContentVersionsIndexes>("{EE288A91-531B-4995-8179-1D62D9AA3E2E}");
To<AddMainDomLock>("{2AB29964-02A1-474D-BD6B-72148D2A53A2}");


// to 8.7.0...
To<MissingDictionaryIndex>("{a78e3369-8ea3-40ec-ad3f-5f76929d2b20}");

//FINAL
}
}
Expand Down
45 changes: 45 additions & 0 deletions src/Umbraco.Core/Models/Blocks/BlockEditorData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;

namespace Umbraco.Core.Models.Blocks
{

/// <summary>
/// Convertable block data from json
/// </summary>
public class BlockEditorData
{
private readonly string _propertyEditorAlias;

public static BlockEditorData Empty { get; } = new BlockEditorData();

private BlockEditorData()
{
BlockValue = new BlockValue();
}

public BlockEditorData(string propertyEditorAlias,
IEnumerable<ContentAndSettingsReference> references,
BlockValue blockValue)
{
if (string.IsNullOrWhiteSpace(propertyEditorAlias))
throw new ArgumentException($"'{nameof(propertyEditorAlias)}' cannot be null or whitespace", nameof(propertyEditorAlias));
_propertyEditorAlias = propertyEditorAlias;
BlockValue = blockValue ?? throw new ArgumentNullException(nameof(blockValue));
References = references != null ? new List<ContentAndSettingsReference>(references) : throw new ArgumentNullException(nameof(references));
}

/// <summary>
/// Returns the layout for this specific property editor
/// </summary>
public JToken Layout => BlockValue.Layout.TryGetValue(_propertyEditorAlias, out var layout) ? layout : null;

/// <summary>
/// Returns the reference to the original BlockValue
/// </summary>
public BlockValue BlockValue { get; }

public List<ContentAndSettingsReference> References { get; } = new List<ContentAndSettingsReference>();
}
}
43 changes: 43 additions & 0 deletions src/Umbraco.Core/Models/Blocks/BlockEditorDataConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Linq;
using System.Collections.Generic;

namespace Umbraco.Core.Models.Blocks
{

/// <summary>
/// Converts the block json data into objects
/// </summary>
public abstract class BlockEditorDataConverter
{
private readonly string _propertyEditorAlias;

protected BlockEditorDataConverter(string propertyEditorAlias)
{
_propertyEditorAlias = propertyEditorAlias;
}

public BlockEditorData Deserialize(string json)
{
var value = JsonConvert.DeserializeObject<BlockValue>(json);

if (value.Layout == null)
return BlockEditorData.Empty;

var references = value.Layout.TryGetValue(_propertyEditorAlias, out var layout)
? GetBlockReferences(layout)
: Enumerable.Empty<ContentAndSettingsReference>();

return new BlockEditorData(_propertyEditorAlias, references, value);
}

/// <summary>
/// Return the collection of <see cref="IBlockReference"/> from the block editor's Layout (which could be an array or an object depending on the editor)
/// </summary>
/// <param name="jsonLayout"></param>
/// <returns></returns>
protected abstract IEnumerable<ContentAndSettingsReference> GetBlockReferences(JToken jsonLayout);

}
}
36 changes: 36 additions & 0 deletions src/Umbraco.Core/Models/Blocks/BlockEditorModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models.PublishedContent;

namespace Umbraco.Core.Models.Blocks
{
/// <summary>
/// The base class for any strongly typed model for a Block editor implementation
/// </summary>
public abstract class BlockEditorModel
{
protected BlockEditorModel(IEnumerable<IPublishedElement> contentData, IEnumerable<IPublishedElement> settingsData)
{
ContentData = contentData ?? throw new ArgumentNullException(nameof(contentData));
SettingsData = settingsData ?? new List<IPublishedContent>();
}

public BlockEditorModel()
{
}


/// <summary>
/// The content data items of the Block List editor
/// </summary>
[DataMember(Name = "contentData")]
public IEnumerable<IPublishedElement> ContentData { get; set; } = new List<IPublishedContent>();

/// <summary>
/// The settings data items of the Block List editor
/// </summary>
[DataMember(Name = "settingsData")]
public IEnumerable<IPublishedElement> SettingsData { get; set; } = new List<IPublishedContent>();
}
}
Loading

0 comments on commit c8da515

Please sign in to comment.