File tree Expand file tree Collapse file tree
OnTopic.Editor.AspNetCore.Attributes
OnTopic.Editor.AspNetCore/Models Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,12 +30,7 @@ public MetadataListAttributeDescriptorViewModel(AttributeDictionary attributes):
3030 /// Initializes a new instance of a <see cref="MetadataListAttributeDescriptorViewModel"/>
3131 /// </summary>
3232 public MetadataListAttributeDescriptorViewModel ( ) : base ( ) {
33-
34- /*------------------------------------------------------------------------------------------------------------------------
35- | Customize values
36- \-----------------------------------------------------------------------------------------------------------------------*/
3733 RelativeTopicPath = "LookupList" ;
38-
3934 }
4035
4136 } //Class
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public record NumberAttributeDescriptorViewModel: AttributeDescriptorViewModel {
2525 public NumberAttributeDescriptorViewModel ( AttributeDictionary attributes ) : base ( attributes ) {
2626 Contract . Requires ( attributes , nameof ( attributes ) ) ;
2727 MinimumValue = attributes . GetInteger ( nameof ( MinimumValue ) ) ?? MinimumValue ;
28+ MaximumValue = attributes . GetInteger ( nameof ( MaximumValue ) ) ?? MaximumValue ;
2829 }
2930
3031 /// <summary>
Original file line number Diff line number Diff line change @@ -18,10 +18,33 @@ public record RelationshipAttributeDescriptorViewModel: QueryableTopicListAttrib
1818 /*==========================================================================================================================
1919 | CONSTRUCTOR
2020 \-------------------------------------------------------------------------------------------------------------------------*/
21+ /// <summary>
22+ /// Initializes a new <see cref="RelationshipAttributeDescriptorViewModel"/> with an <paramref name="attributes"/> dictionary.
23+ /// </summary>
24+ /// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
25+ public RelationshipAttributeDescriptorViewModel ( AttributeDictionary attributes ) : base ( attributes ) {
26+ Contract . Requires ( attributes , nameof ( attributes ) ) ;
27+ ShowRoot = attributes . GetBoolean ( nameof ( ShowRoot ) ) ;
28+ ExpandRelated = attributes . GetBoolean ( nameof ( ExpandRelated ) ) ;
29+ CheckAscendants = attributes . GetBoolean ( nameof ( CheckAscendants ) ) ;
30+ RegisterResources ( ) ;
31+ }
32+
2133 /// <summary>
2234 /// Initializes a new instance of a <see cref="RelationshipAttributeDescriptorViewModel"/>
2335 /// </summary>
2436 public RelationshipAttributeDescriptorViewModel ( ) {
37+ RegisterResources ( ) ;
38+ }
39+
40+ /*==========================================================================================================================
41+ | REGISTER RESOURCES
42+ \-------------------------------------------------------------------------------------------------------------------------*/
43+ /// <summary>
44+ /// Derived classes may optionally override this method in order to register resources, as an alternative to setting these
45+ /// in the constructor.
46+ /// </summary>
47+ protected void RegisterResources ( ) {
2548 Scripts . Register ( GetNamespacedUri ( "/Shared/Scripts/SelectableTreeView.js" ) ) ;
2649 }
2750
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public TopicListAttributeDescriptorViewModel(AttributeDictionary attributes): ba
2929 DefaultLabel = attributes . GetValue ( nameof ( DefaultLabel ) ) ?? DefaultLabel ;
3030 RelativeTopicBase = attributes . GetValue ( nameof ( RelativeTopicBase ) ) ;
3131 RelativeTopicPath = attributes . GetValue ( nameof ( RelativeTopicPath ) ) ;
32- ValueProperty = attributes . GetValue ( nameof ( ValueProperty ) ) ?? ValueProperty ;
32+ ValueProperty = attributes . GetValue ( nameof ( ValueProperty ) ) ?? ValueProperty ;
3333 }
3434
3535 /// <summary>
Original file line number Diff line number Diff line change @@ -33,12 +33,7 @@ public TopicReferenceAttributeDescriptorViewModel(AttributeDictionary attributes
3333 /// Initializes a new instance of a <see cref="TopicReferenceAttributeDescriptorViewModel"/>
3434 /// </summary>
3535 public TopicReferenceAttributeDescriptorViewModel ( ) : base ( ) {
36-
37- /*------------------------------------------------------------------------------------------------------------------------
38- | Restrict token limit
39- \-----------------------------------------------------------------------------------------------------------------------*/
40- TokenLimit = 1 ;
41-
36+ TokenLimit = 1 ;
4237 }
4338
4439 /*==========================================================================================================================
Original file line number Diff line number Diff line change @@ -15,14 +15,6 @@ namespace OnTopic.Editor.AspNetCore.Models.Components {
1515 /// </summary>
1616 public record ContentTypeListViewModel {
1717
18- /*==========================================================================================================================
19- | CONSTRUCTOR
20- \-------------------------------------------------------------------------------------------------------------------------*/
21- /// <summary>
22- /// Initializes a new instance of the <see cref="ContentTypeListViewModel"/> class.
23- /// </summary>
24- public ContentTypeListViewModel ( ) { }
25-
2618 /*==========================================================================================================================
2719 | PROPERTY: CURRENT TOPIC
2820 \-------------------------------------------------------------------------------------------------------------------------*/
Original file line number Diff line number Diff line change 66using System . ComponentModel . DataAnnotations ;
77using OnTopic . Attributes ;
88using OnTopic . Editor . AspNetCore . Models . ClientResources ;
9+ using OnTopic . Mapping . Annotations ;
910
1011namespace OnTopic . Editor . AspNetCore . Models . Metadata {
1112
@@ -145,6 +146,7 @@ public AttributeDescriptorViewModel(): base() { }
145146 /// This is kept separate from <see cref="IsRequired"/> so that the attribute labels can still be marked as required in
146147 /// the interface; this should be used to disable <c>required</c> on the associated <c>Value</c> field, however.
147148 /// </remarks>
149+ [ DisableMapping ]
148150 public bool IsValueRequired => IsRequired && String . IsNullOrEmpty ( DefaultValue ) ;
149151
150152 /*==========================================================================================================================
@@ -169,6 +171,7 @@ public AttributeDescriptorViewModel(): base() { }
169171 /// <summary>
170172 /// Provides a list of client-side stylesheets associated with this <see cref="AttributeDescriptorViewModel"/>.
171173 /// </summary>
174+ [ DisableMapping ]
172175 public StyleSheetCollection StyleSheets { get ; } = new ( ) ;
173176
174177 /*==========================================================================================================================
@@ -177,6 +180,7 @@ public AttributeDescriptorViewModel(): base() { }
177180 /// <summary>
178181 /// Provides a list of client-side scripts associated with this <see cref="AttributeDescriptorViewModel"/>.
179182 /// </summary>
183+ [ DisableMapping ]
180184 public ScriptCollection Scripts { get ; } = new ( ) ;
181185
182186 /*==========================================================================================================================
Original file line number Diff line number Diff line change @@ -17,14 +17,6 @@ namespace OnTopic.Editor.AspNetCore.Models.Metadata {
1717 /// </summary>
1818 public record PermittedContentTypeViewModel {
1919
20- /*==========================================================================================================================
21- | CONSTRUCTOR
22- \-------------------------------------------------------------------------------------------------------------------------*/
23- /// <summary>
24- /// Initializes a new instance of the <see cref="PermittedContentTypeViewModel"/> class.
25- /// </summary>
26- public PermittedContentTypeViewModel ( ) : base ( ) { }
27-
2820 /*==========================================================================================================================
2921 | PROPERTY: KEY
3022 \-------------------------------------------------------------------------------------------------------------------------*/
You can’t perform that action at this time.
0 commit comments