Skip to content

Commit 9c46d74

Browse files
committed
Merge branch 'improvement/editor-warnings' into develop
Provided warnings in the editor if a topic is currently hidden from either the navigation or from search engines, or if it's disabled. Elevated the warnings for critical issues—such as a disabled or internal topic—to "danger", which displays them in red instead of yellow.
2 parents e21e874 + b581915 commit 9c46d74

2 files changed

Lines changed: 51 additions & 3 deletions

File tree

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Editor/Edit.cshtml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,41 @@
2121

2222
<div class="col-md-12">
2323
@if (Model.ContentTypeDescriptor.DisableDelete && !Model.IsNew) {
24-
<div class="alert alert-warning" role="alert">
24+
<div class="alert alert-danger" role="alert">
2525
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
2626
<strong>Warning:</strong> This topic is part of the OnTopic internal organizational structure and is not intended to be modified. Deletion of this Topic has been disabled.
2727
</div>
2828
}
29+
@if (Model.Topic.IsDisabled) {
30+
<div class="alert alert-danger" role="alert">
31+
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
32+
<strong>Warning:</strong> This topic is currently disabled and will not be viewable via the website. This topic can be reenabled on the <i>Navigation</i> tab.
33+
</div>
34+
}
2935
@if (!Model.IsFullyLoaded) {
30-
<div class="alert alert-warning" role="alert">
36+
<div class="alert alert-danger" role="alert">
3137
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
3238
<strong>Warning:</strong> Not all relationships were successfully loaded from the database. To prevent inadvertent deletion of relationships, any relationships that are removed won't be persisted to the database. You can still add new relationships.
3339
</div>
3440
}
41+
@if (Model.Topic.IsHidden && Model.Topic.NoIndex) {
42+
<div class="alert alert-warning" role="alert">
43+
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
44+
<strong>Note:</strong> This topic is currently hidden from both search engines and the site navigation. Customers can still access it by URL, including direct links.
45+
</div>
46+
}
47+
else if (Model.Topic.IsHidden) {
48+
<div class="alert alert-warning" role="alert">
49+
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
50+
<strong>Note:</strong> This topic is currently hidden and will not be displayed in the site navigation. Customers can still access it, and it will still show up in search results.
51+
</div>
52+
}
53+
else if (Model.Topic.NoIndex) {
54+
<div class="alert alert-warning" role="alert">
55+
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
56+
<strong>Note:</strong> This topic is currently hidden from search engines. Customers can still access it, but it won't show up in search results.
57+
</div>
58+
}
3559
@if (!String.IsNullOrWhiteSpace(Model.ContentTypeDescriptor.Description)) {
3660
<div class="alert alert-primary" role="alert">
3761
@Model.ContentTypeDescriptor.Description

OnTopic.Editor.AspNetCore/Models/EditingTopicViewModel.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,31 @@ public EditingTopicViewModel() : base() {}
4343
/// <summary>
4444
/// Provides a reference to a base topic, if one exists.
4545
/// </summary>
46-
public TopicViewModel? BaseTopic { get; set; }
46+
public TopicViewModel? BaseTopic { get; init; }
47+
48+
/*==========================================================================================================================
49+
| PROPERTY: NO INDEX?
50+
\-------------------------------------------------------------------------------------------------------------------------*/
51+
/// <summary>
52+
/// Determines if the current topic should be indexed by search engines or not.
53+
/// </summary>
54+
public bool NoIndex { get; init; }
55+
56+
/*==========================================================================================================================
57+
| PROPERTY: IS HIDDEN?
58+
\-------------------------------------------------------------------------------------------------------------------------*/
59+
/// <summary>
60+
/// Determines if the current topic is hidden or not.
61+
/// </summary>
62+
public new bool IsHidden { get; init; }
63+
64+
/*==========================================================================================================================
65+
| PROPERTY: IS DISABLED?
66+
\-------------------------------------------------------------------------------------------------------------------------*/
67+
/// <summary>
68+
/// Determines if the current topic is disabled or not.
69+
/// </summary>
70+
public bool IsDisabled { get; init; }
4771

4872
/*==========================================================================================================================
4973
| PROPERTY: ATTRIBUTES

0 commit comments

Comments
 (0)