-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditingTopicViewModel.cs
More file actions
130 lines (115 loc) · 7.36 KB
/
EditingTopicViewModel.cs
File metadata and controls
130 lines (115 loc) · 7.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*==============================================================================================================================
| Author Ignia, LLC
| Client Ignia, LLC
| Project Topics Library
\=============================================================================================================================*/
using OnTopic.Mapping.Annotations;
namespace OnTopic.Editor.AspNetCore.Models {
/*============================================================================================================================
| CLASS: EDITING TOPIC VIEW MODEL
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Represents a model for a <see cref="Topic"/>. Since attributes are handled via the <see cref="AttributeViewModel"/>, the
/// <see cref="EditingTopicViewModel"/> needn't account for them. It only accounts for items that will be exposed to the
/// general interface of the Topic Editor.
/// </summary>
public record EditingTopicViewModel: CoreTopicViewModel {
/*==========================================================================================================================
| CONSTRUCTOR
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Initializes a new <see cref="EditingTopicViewModel"/> with an <paramref name="attributes"/> dictionary.
/// </summary>
/// <param name="attributes">An <see cref="AttributeDictionary"/> of attribute values.</param>
public EditingTopicViewModel(AttributeDictionary attributes) {
Contract.Requires(attributes, nameof(attributes));
NoIndex = attributes.GetBoolean(nameof(NoIndex))?? false;
IsHidden = attributes.GetBoolean(nameof(IsHidden))?? false;
IsDisabled = attributes.GetBoolean(nameof(IsDisabled))?? false;
IsProtected = attributes.GetBoolean(nameof(IsProtected))?? false;
}
/// <summary>
/// Initializes a new instance of the <see cref="EditingTopicViewModel"/> class.
/// </summary>
public EditingTopicViewModel() : base() {}
/*==========================================================================================================================
| PROPERTY: PARENT
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides a reference to a <see cref="Topic.Parent"/>.
/// </summary>
[MapAs(typeof(CoreTopicViewModel))]
public CoreTopicViewModel? Parent { get; init; }
/*==========================================================================================================================
| PROPERTY: BASE TOPIC
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides a reference to a <see cref="Topic.BaseTopic"/>, if one exists.
/// </summary>
[MapAs(typeof(CoreTopicViewModel))]
public CoreTopicViewModel? BaseTopic { get; init; }
/*==========================================================================================================================
| PROPERTY: VERSION HISTORY
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides a collection of <see cref="DateTime"/> instances during which the represented <see cref="Topic"/> was
/// modified.
/// </summary>
public Collection<DateTime> VersionHistory { get; init; } = new();
/*==========================================================================================================================
| PROPERTY: LAST MODIFIED
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides a reference to the <see cref="Topic.LastModified"/> date.
/// </summary>
public DateTime LastModified { get; init; }
/*==========================================================================================================================
| PROPERTY: NO INDEX?
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Determines if the current topic should be indexed by search engines or not.
/// </summary>
public bool NoIndex { get; init; }
/*==========================================================================================================================
| PROPERTY: IS HIDDEN?
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Determines if the current topic is hidden or not.
/// </summary>
public bool IsHidden { get; init; }
/*==========================================================================================================================
| PROPERTY: IS DISABLED?
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Determines if the current topic is disabled or not.
/// </summary>
public bool IsDisabled { get; init; }
/*==========================================================================================================================
| PROPERTY: IS PROTECTED?
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Determines if the current topic part of the system.
/// </summary>
/// <remarks>
/// The <see cref="IsProtected"/> operates similar to <see cref="ContentTypeDescriptorViewModel.DisableDelete"/>, except
/// that it can be assigned to an individual <see cref="Topic"/>, and not <i>just</i> a <see cref="ContentTypeDescriptor"
/// />. If the <see cref="IsProtected"/> is set, then the topic cannot be deleted or moved directly via the editor—
/// though nothing prevents these operations from being performed programmatically.
/// </remarks>
public bool IsProtected { get; init; }
/*==========================================================================================================================
| PROPERTY: ATTRIBUTES
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// A collection of attribute values, as assigned directly to the topic. Does not include inherited or derived values.
/// </summary>
public Dictionary<string, string?> Attributes { get; } = new();
/*==========================================================================================================================
| PROPERTY: INHERITED ATTRIBUTES
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// A collection of inherited attribute values, as inferred from derived or upstream topics.
/// </summary>
public Dictionary<string, string?> InheritedAttributes { get; } = new();
} // Class
} // Namespace