Skip to content

Commit

Permalink
Merge branch 'release/5.2.0' into master
Browse files Browse the repository at this point in the history
OnTopic Editor 5.2.0 is a very minor update, which doesn't introduce any new public-facing features, but does make a number of performance improvements, such as reducing the amount of mapping that needs to be performed for each topic by relying on the new lightweight `PermittedContentType` view model (#50) and supporting the new `AttributeDictionary` constructor for view models (#49). In addition, it also includes a number of internal code improvements, such as adoption of new C# 10 capabilities (#52), including global using directives (#53).

See Pull Request #57 for details.
  • Loading branch information
JeremyCaney committed Jun 26, 2022
2 parents 3b468d3 + 12ea593 commit ef23c1f
Show file tree
Hide file tree
Showing 113 changed files with 9,207 additions and 7,602 deletions.
5 changes: 3 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<Project>

<PropertyGroup>
<LangVersion>9.0</LangVersion>
<LangVersion>10.0</LangVersion>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<Nullable>enable</Nullable>
<AnalysisLevel>latest</AnalysisLevel>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>NU5118</NoWarn>
</PropertyGroup>

<PropertyGroup>
<Product>OnTopic</Product>
<Authors>Ignia</Authors>
<Company>Ignia</Company>
<Copyright2021 Ignia, LLC</Copyright>
<Copyright2022 Ignia, LLC</Copyright>
<PackageProjectUrl>https://github.com/Ignia/Topic-Editor-MVC/</PackageProjectUrl>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<UseFullSemVerForNuGet>true</UseFullSemVerForNuGet>
Expand Down
1 change: 0 additions & 1 deletion OnTopic.Editor.AspNetCore.All/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System;
using System.Runtime.InteropServices;

/*==============================================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Models;

namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {

Expand All @@ -15,6 +14,19 @@ namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {
/// </summary>
public record BooleanAttributeDescriptorViewModel: AttributeDescriptorViewModel {

/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="BooleanAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public BooleanAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) { }

/// <summary>
/// Initializes a new instance of the <see cref="BooleanAttributeDescriptorViewModel"/> class.
/// </summary>
public BooleanAttributeDescriptorViewModel(): base() {}

} //Class
} //Namespace
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System;
using System.Diagnostics.CodeAnalysis;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using Microsoft.AspNetCore.Mvc;
using OnTopic.AspNetCore.Mvc.Components;
using OnTopic.Editor.AspNetCore.Models;

namespace OnTopic.Editor.AspNetCore.Attributes.BooleanAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.DateTimeAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.DateTimeAttribute {

Expand All @@ -15,6 +14,27 @@ namespace OnTopic.Editor.AspNetCore.Attributes.DateTimeAttribute {
/// </summary>
public record DateTimeAttributeDescriptorViewModel: AttributeDescriptorViewModel {

/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="DateTimeAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public DateTimeAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) {
Contract.Requires(attributes, nameof(attributes));
IncludeDatePicker = attributes.GetBoolean(nameof(IncludeDatePicker));
IncludeTimePicker = attributes.GetBoolean(nameof(IncludeTimePicker));
DateTimeOffset = attributes.GetInteger(nameof(DateTimeOffset));
DateTimeOffsetUnits = attributes.GetValue(nameof(DateTimeOffsetUnits))?? DateTimeOffsetUnits;

}

/// <summary>
/// Initializes a new instance of the <see cref="DateTimeAttributeDescriptorViewModel"/> class.
/// </summary>
public DateTimeAttributeDescriptorViewModel() : base() { }

/*==========================================================================================================================
| INCLUDE DATE PICKER?
\-------------------------------------------------------------------------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System;
using System.Globalization;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.DateTimeAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using Microsoft.AspNetCore.Mvc;
using OnTopic.AspNetCore.Mvc.Components;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Internal.Diagnostics;

namespace OnTopic.Editor.AspNetCore.Attributes.DateTimeAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FileListAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FileListAttribute {

Expand All @@ -15,6 +14,26 @@ namespace OnTopic.Editor.AspNetCore.Attributes.FileListAttribute {
/// </summary>
public record FileListAttributeDescriptorViewModel: AttributeDescriptorViewModel {

/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="FileListAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public FileListAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) {
Contract.Requires(attributes, nameof(attributes));
Path = attributes.GetValue(nameof(Path));
Extension = attributes.GetValue(nameof(Extension));
Filter = attributes.GetValue(nameof(Filter));
IncludeSubdirectories = attributes.GetBoolean(nameof(IncludeSubdirectories))?? false;
}

/// <summary>
/// Initializes a new instance of the <see cref="FileListAttributeDescriptorViewModel"/> class.
/// </summary>
public FileListAttributeDescriptorViewModel() : base() { }

/*==========================================================================================================================
| PROPERTY: PATH
\-------------------------------------------------------------------------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc.Rendering;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FileListAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System;
using System.Collections.ObjectModel;
using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Internal.Diagnostics;

namespace OnTopic.Editor.AspNetCore.Attributes.FileListAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FilePathAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FilePathAttribute {

Expand All @@ -16,6 +14,26 @@ namespace OnTopic.Editor.AspNetCore.Attributes.FilePathAttribute {
/// </summary>
public record FilePathAttributeDescriptorViewModel: AttributeDescriptorViewModel {

/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="FilePathAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public FilePathAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) {
Contract.Requires(attributes, nameof(attributes));
InheritValue = attributes.GetBoolean(nameof(InheritValue))?? InheritValue;
RelativeToTopicPath = attributes.GetBoolean(nameof(RelativeToTopicPath))?? RelativeToTopicPath;
BaseTopicPath = attributes.GetValue(nameof(BaseTopicPath))?? BaseTopicPath;
IncludeCurrentTopic = attributes.GetBoolean(nameof(IncludeCurrentTopic))?? IncludeCurrentTopic;
}

/// <summary>
/// Initializes a new instance of the <see cref="FilePathAttributeDescriptorViewModel"/> class.
/// </summary>
public FilePathAttributeDescriptorViewModel() : base() { }

/*==========================================================================================================================
| PROPERTY: INHERIT VALUE
\-------------------------------------------------------------------------------------------------------------------------*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
| Project Topics Library
\=============================================================================================================================*/
using System.ComponentModel.DataAnnotations;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Editor.AspNetCore.Models.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.FilePathAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using OnTopic.AspNetCore.Mvc;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Internal.Diagnostics;
using OnTopic.Repositories;

namespace OnTopic.Editor.AspNetCore.Attributes.FilePathAttribute {
Expand Down Expand Up @@ -203,7 +198,7 @@ public string GetPath(string attributeKey, FilePathAttributeDescriptorViewModel
foreach (var truncationTopic in truncatePathAtTopic) {
var truncateTopicLocation = relativePath?.IndexOf(truncationTopic, StringComparison.OrdinalIgnoreCase);
if (truncateTopicLocation >= 0) {
relativePath = relativePath?.Substring(0, truncateTopicLocation.Value + truncationTopic.Length + 1);
relativePath = relativePath?[..(truncateTopicLocation.Value + truncationTopic.Length + 1)];
}
}
}
Expand All @@ -216,7 +211,7 @@ public string GetPath(string attributeKey, FilePathAttributeDescriptorViewModel
/*------------------------------------------------------------------------------------------------------------------------
| Replace path slashes with backslashes if the resulting file path value uses a UNC or basic file path format
\-----------------------------------------------------------------------------------------------------------------------*/
if (filePath.Contains("\\", StringComparison.Ordinal)) {
if (filePath.Contains('\\', StringComparison.Ordinal)) {
filePath = filePath.Replace("/", "\\", StringComparison.Ordinal);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.HtmlAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,34 @@ public record HtmlAttributeDescriptorViewModel: TextAreaAttributeDescriptorViewM
/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="HtmlAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public HtmlAttributeDescriptorViewModel(AttributeDictionary attributes): base(attributes) {
Contract.Requires(attributes, nameof(attributes));
Height = attributes.GetInteger(nameof(Height));
Rows = 20;
RegisterResources();
}

/// <summary>
/// Initializes a new instance of a <see cref="HtmlAttributeDescriptorViewModel"/>
/// </summary>
public HtmlAttributeDescriptorViewModel() {
Scripts.Register(new("https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"), true, false);
Rows = 20;
RegisterResources();
}

/*==========================================================================================================================
| REGISTER RESOURCES
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Derived classes may optionally override this method in order to register resources, as an alternative to setting these
/// in the constructor.
/// </summary>
protected void RegisterResources() {
Scripts.Register(new("https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js"), true, false);
}

/*==========================================================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using Microsoft.AspNetCore.Mvc;
using OnTopic.Editor.AspNetCore.Models;
using OnTopic.Internal.Diagnostics;

namespace OnTopic.Editor.AspNetCore.Attributes.HtmlAttribute {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Metadata;

namespace OnTopic.Editor.AspNetCore.Attributes.IncomingRelationshipAttribute {

Expand Down
Loading

0 comments on commit ef23c1f

Please sign in to comment.