Skip to content

Commit 7b00274

Browse files
committed
Merged AttributeDescriptor and AttributeTypeDescriptor
OnTopic Editor 4.0.0 formalized the idea of attribute types as content types, thus allowing each attribute type to have its own data model in the Editor. Prior to this, attribute type specific configuration values had to be configured via a single text attribute which was parsed and applied by each `{AttributeType}ViewModel` (or, prior to that, `{AttributeType}.ascx`). To continue supporting **OnTopic-Editor-WebForms**. the `AttributeDescriptor`'s `EditorType` and `ModelType` necessited complex logic, which was moved to a `ConfigurableAttributeDescriptor` in the **OnTopic-WebForms** project. As a result, the `AttributeDescriptor` acted as an abstract base class for both `ConfigurableAttributeDescriptor` as well as a simplified `AttributeTypeDescriptor` for the **OnTopic-Editor-AspNetCore** classes. Since we're no longer supporting .NET Framework (422e6ed), there's no need to maintain this abstraction. Instead, we can merge the simplified `AttributeTypeDescriptor` logic into `AttributeDescriptor` and use that as the base class for all of the `OnTopic.Metadata.AttributeTypes` base clases (which represent the strongly typed attribute descriptors, and map to their corresponding content types).
1 parent 6d086d0 commit 7b00274

18 files changed

+21
-19
lines changed

OnTopic.Tests/ViewModels/Metadata/TextAttributeTopicViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using OnTopic.Metadata;
67
using OnTopic.Metadata.AttributeTypes;
78

89
namespace OnTopic.Tests.ViewModels.Metadata {
@@ -11,7 +12,7 @@ namespace OnTopic.Tests.ViewModels.Metadata {
1112
| VIEW MODEL: TEXT ATTRIBUTE (DESCRIPTOR)
1213
\---------------------------------------------------------------------------------------------------------------------------*/
1314
/// <summary>
14-
/// Provides a dummy implementation of a view model for an <see cref="AttributeTypeDescriptor"/> view model, in order to
15+
/// Provides a dummy implementation of a view model for an <see cref="AttributeDescriptor"/> view model, in order to
1516
/// allow the dynamic resolution of mapping <see cref="TextAttribute"/> topics to view models.
1617
/// </summary>
1718
/// <remarks>

OnTopic.Tests/ViewModels/Metadata/TopicReferenceAttributeTopicViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
| Client Ignia, LLC
44
| Project Topics Library
55
\=============================================================================================================================*/
6+
using OnTopic.Metadata;
67
using OnTopic.Metadata.AttributeTypes;
78

89
namespace OnTopic.Tests.ViewModels.Metadata {
@@ -11,7 +12,7 @@ namespace OnTopic.Tests.ViewModels.Metadata {
1112
| VIEW MODEL: TOPIC REFERENCE ATTRIBUTE (DESCRIPTOR)
1213
\---------------------------------------------------------------------------------------------------------------------------*/
1314
/// <summary>
14-
/// Provides a dummy implementation of a view model for an <see cref="AttributeTypeDescriptor"/> view model, in order to
15+
/// Provides a dummy implementation of a view model for an <see cref="AttributeDescriptor"/> view model, in order to
1516
/// allow the dynamic resolution of mapping <see cref="TopicReferenceAttribute"/> topics to view models.
1617
/// </summary>
1718
/// <remarks>

OnTopic/Metadata/AttributeDescriptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ protected AttributeDescriptor(
8888
/// reduces these down into a single type based on how they're exposed in the Topic Library, not based on how they're
8989
/// exposed in the editor.
9090
/// </remarks>
91-
public abstract ModelType ModelType { get; }
91+
public virtual ModelType ModelType => ModelType.ScalarValue;
9292

9393
/*==========================================================================================================================
9494
| PROPERTY: EDITOR TYPE
@@ -109,7 +109,7 @@ protected AttributeDescriptor(
109109
/// !value.Contains(" ") &amp;&amp; !value.Contains("/")
110110
/// </requires>
111111
[AttributeSetter]
112-
public abstract string? EditorType { get; }
112+
public virtual string EditorType => GetType().Name.Replace("Attribute", "", StringComparison.OrdinalIgnoreCase);
113113

114114
/*==========================================================================================================================
115115
| PROPERTY: DISPLAY GROUP

OnTopic/Metadata/AttributeTypes/BooleanAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class BooleanAttribute : AttributeTypeDescriptor {
20+
public class BooleanAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/DateTimeAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class DateTimeAttribute : AttributeTypeDescriptor {
20+
public class DateTimeAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/FileListAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class FileListAttribute : AttributeTypeDescriptor {
20+
public class FileListAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/FilePathAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class FilePathAttribute : AttributeTypeDescriptor {
20+
public class FilePathAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/HtmlAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class HtmlAttribute : AttributeTypeDescriptor {
20+
public class HtmlAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/IncomingRelationshipAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1717
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1818
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1919
/// </remarks>
20-
public class IncomingRelationshipAttribute : AttributeTypeDescriptor {
20+
public class IncomingRelationshipAttribute : AttributeDescriptor {
2121

2222
/*==========================================================================================================================
2323
| CONSTRUCTOR

OnTopic/Metadata/AttributeTypes/InstructionAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace OnTopic.Metadata.AttributeTypes {
1616
/// This class is primarily used by the Topic Editor interface to determine how attributes are displayed as part of the
1717
/// CMS; except in very specific scenarios, it is not typically used elsewhere in the Topic Library itself.
1818
/// </remarks>
19-
public class InstructionAttribute : AttributeTypeDescriptor {
19+
public class InstructionAttribute : AttributeDescriptor {
2020

2121
/*==========================================================================================================================
2222
| CONSTRUCTOR

0 commit comments

Comments
 (0)