Skip to content

Commit bb46923

Browse files
committed
Modified INavigationTyopicViewModel<T> to derive from ITopicViewModel
`IPageTopicViewModel` and, more broadly, `PageTopicViewModel`, bring with them a bit of overhead, such as metadata fields and body, which increase processing time and memory, with little expected benefit. Mitigated this by trimming down the `NavigationTopicViewModel` class and its associated interface.
1 parent 0f8edb1 commit bb46923

3 files changed

Lines changed: 25 additions & 6 deletions

File tree

Ignia.Topics.ViewModels/NavigationTopicViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ namespace Ignia.Topics.ViewModels {
2626
/// cref="NavigationTopicViewModel"/> class is marked as <c>sealed</c>.
2727
/// </para>
2828
/// </remarks>
29-
public sealed class NavigationTopicViewModel : PageTopicViewModel, INavigationTopicViewModel<NavigationTopicViewModel> {
29+
public sealed class NavigationTopicViewModel : TopicViewModel, INavigationTopicViewModel<NavigationTopicViewModel> {
3030

31+
public string WebPath { get; set; }
32+
public string ShortTitle { get; set; }
3133
public Collection<NavigationTopicViewModel> Children { get; set; }
3234
public bool IsSelected(string uniqueKey) => uniqueKey?.StartsWith(UniqueKey) ?? false;
3335

Ignia.Topics.Web.Mvc/Models/NavigationViewModel{T}.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ namespace Ignia.Topics.Web.Mvc.Models {
2020
/// constructed by the <see cref="LayoutController"/>.
2121
/// </para>
2222
/// <para>
23-
/// The <see cref="NavigationRoot"/> can be any view model that implements <see cref="INavigationTopicViewModelCore"/>,
23+
/// The <see cref="NavigationRoot"/> can be any view model that implements <see cref="INavigationTopicViewModel"/>,
2424
/// which provides a base level of support for properties associated with the typical <c>Page</c> content type as well as
25-
/// a method for determining if a given <see cref="INavigationTopicViewModelCore"/> instance is the currently-selected
26-
/// topic. Implementations may support additional properties, as appropriate.
25+
/// a method for determining if a given <see cref="INavigationTopicViewModel"/> instance is the currently-selected topic.
26+
/// Implementations may support additional properties, as appropriate.
2727
/// </para>
2828
/// </remarks>
29-
public class NavigationViewModel<T> where T: IPageTopicViewModel {
29+
public class NavigationViewModel<T> where T: INavigationTopicViewModel<T> {
3030

3131
public T NavigationRoot { get; set; }
3232
public string CurrentKey { get; set; }

Ignia.Topics/ViewModels/INavigationTopicViewModel{T}.cs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,24 @@ namespace Ignia.Topics.ViewModels {
1717
/// No topics are expected to have a <c>Navigation</c> content type. Instead, implementers of this view model are expected
1818
/// to manually construct instances.
1919
/// </remarks>
20-
public interface INavigationTopicViewModel<T> : IPageTopicViewModel where T: INavigationTopicViewModel<T> {
20+
public interface INavigationTopicViewModel<T> : ITopicViewModel where T: INavigationTopicViewModel<T> {
21+
22+
/*==========================================================================================================================
23+
| PROPERTY: WEBPATH
24+
\-------------------------------------------------------------------------------------------------------------------------*/
25+
/// <summary>
26+
/// Represents the HTTP routing path for the corresponding <see cref="Topic"/>.
27+
/// </summary>
28+
string WebPath { get; set; }
29+
30+
/*==========================================================================================================================
31+
| PROPERTY: SHORT TITLE
32+
\-------------------------------------------------------------------------------------------------------------------------*/
33+
/// <summary>
34+
/// In addition to the Title, a site may opt to define a Short Title used exclusively in the navigation. If present, this
35+
/// value should be used instead of Title.
36+
/// </summary>
37+
string ShortTitle { get; set; }
2138

2239
/*==========================================================================================================================
2340
| PROPERTY: CHILDREN

0 commit comments

Comments
 (0)