Skip to content

Commit e9ccb06

Browse files
committed
Merge branch 'feature/ContentList-indexing' into develop
Exposed a new `IsIndexed` and `IndexLabel` property on the `ContentListTopicViewModel`. This provides optional support for editors to configure a topic to include a table of contents of either categories and/or items. It is up to the implementor as to whether this functionality is exposed on the `ContentList` content type or any of its derived types, as well as how it will be exposed within any templates. It is a common enough requirement, however, that including it on the model provides a lot of flexibility for expected implementations.
2 parents b303f13 + a87eeaf commit e9ccb06

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

OnTopic.ViewModels/ContentListTopicViewModel.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,36 @@ public class ContentListTopicViewModel: PageTopicViewModel {
3636
/// </summary>
3737
public TopicViewModelCollection<TopicViewModel> Categories { get; } = new();
3838

39+
/*==========================================================================================================================
40+
| IS INDEXED?
41+
\-------------------------------------------------------------------------------------------------------------------------*/
42+
/// <summary>
43+
/// Provides a flag determining whether or not the content list should be indexed.
44+
/// </summary>
45+
/// <remarks>
46+
/// The <see cref="IsIndexed"/> property, if set, requests that the view provides a list of <see cref="ContentItems"/> or
47+
/// <see cref="Categories"/> at the top, with links to each one. This is entirely up to the discretion of the view as to
48+
/// how to implement—or even whether it's appropriate. For instance, it might not make sense on views rendering as an
49+
/// accordion or a searchable list. Nevertheless, it's a common enough feature that having it exposed as a first-party
50+
/// option helps implementors account for common scenarios. As with other properties, it won't be set if there isn't a
51+
/// corresponding attribute, and so this can easily be hidden or disabled globally via the editor.
52+
/// </remarks>
53+
/// <returns>True if the content list should be indexed; false otherwise.</returns>
54+
public bool IsIndexed { get; set; }
55+
56+
/*==========================================================================================================================
57+
| INDEX LABEL
58+
\-------------------------------------------------------------------------------------------------------------------------*/
59+
/// <summary>
60+
/// Assuming <see cref="IsIndexed"/>, determines the label to display. Defaults to <i>Contents</i>.
61+
/// </summary>
62+
/// <remarks>
63+
/// Often, if an indexed list of links is provided on a view, it will be preceded with a lable. The <see cref=
64+
/// "IndexLabel"/> allows that to be optionally set on a per topic basis. The default value is "Contents", though it is up
65+
/// to view implementors and editor configurations as to whether this option is exposed or honored.
66+
/// </remarks>
67+
/// <returns>Returns the value set; defaults to "Contents".</returns>
68+
public string IndexLabel { get; set; } = "Contents";
69+
3970
} //Class
4071
} //Namespace

0 commit comments

Comments
 (0)