Skip to content

Commit d4ecd7b

Browse files
committed
Merge branch 'bugfix/ui-improvements' into develop
Various user interface related fit-and-finish items. Many of these are long-standing issues that aren't critical to the functionality, but help ensure that interactive elements respond as expected, without any rough edges or surprises. This includes: - In the `ContentTypeListViewComponent`, reset the content type selection after initializing the modal (b6868cf) - In the `ContentTypeListViewComponent`, display parent content types when creating a new topic (9beeb8a) - In the `Edit` template, hide the warning regarding `DisableDelete` when creating a new topic (5ddbd26) - In the toolbar, ensure the version history dropbox is visible in normal width modal windows (780e7ed) - In the toolbar, ensure the version history dropbox is wide enough to fit the widest date format (0072c55)
2 parents 11331ea + 0072c55 commit d4ecd7b

5 files changed

Lines changed: 11 additions & 7 deletions

File tree

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Editor/Components/ContentTypeList/Default.cshtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ else if (Model.TopicList.Count > 2) {
2020
var option = $('option:selected', this);
2121
@if (Model.EnableModal?? false) {
2222
<text>
23-
initEditorModal('@Model.AttributeKey', option.text(), option.val(), @Model.OnModalClose); return false;
23+
initEditorModal('@Model.AttributeKey', option.text(), option.val(), @Model.OnModalClose);
24+
$(this).prop('selectedIndex', 0);
25+
return false;
2426
</text>
2527
}
2628
else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div id="FormArea" class="row form area">
2121

2222
<div class="col-md-12">
23-
@if (Model.ContentTypeDescriptor.DisableDelete) {
23+
@if (Model.ContentTypeDescriptor.DisableDelete && !Model.IsNew) {
2424
<div class="alert alert-warning" 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.

OnTopic.Editor.AspNetCore/Areas/Editor/Views/Shared/_Toolbar.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
@if (Model.Topic.VersionHistory.Count > 1) {
1313
<!-- Versions -->
14-
<div id="VersionsDropdown" class="dropdown d-none d-lg-inline-block" style="display:inline-block;">
14+
<div id="VersionsDropdown" class="dropdown d-none d-md-inline-block" style="display:inline-block;">
1515
<button class="btn btn-sm btn-ancillary dropdown-toggle" type="button" id="VersionsButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
1616
<span class="fa fa-history"></span>
1717
Versions
1818
<span class="caret"></span>
1919
</button>
20-
<ul class="dropdown-menu" role="menu" aria-labelledby="VersionsButton" style="left: 3px; top: 98%;">
20+
<ul class="dropdown-menu" role="menu" aria-labelledby="VersionsButton">
2121
@foreach (DateTime version in Model.Topic.VersionHistory) {
2222
<li role="presentation" class="small">
2323
<a tabindex="-1" role="menuitem" href="@Url.Action("SetVersion", "Editor", new { path=Model.Topic.WebPath, version=version.ToString("MM/dd/yyyy hh:mm:ss.fff tt"), isModal=Model.IsModal })">@version.ToString()</a>

OnTopic.Editor.AspNetCore/Components/ContentTypeListViewComponent.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ public IViewComponentResult Invoke(
100100
| Get content type
101101
>-------------------------------------------------------------------------------------------------------------------------
102102
| If the database is uninitialized, the content type won't be found. In that case, return an empty view, which will
103-
| effectively hide the component.
103+
| effectively hide the component. If the topic cannot be found, assume it is a new topic and attempt to load the parent
104+
| for context.
104105
\-----------------------------------------------------------------------------------------------------------------------*/
105106
var contentTypes = _topicRepository.GetContentTypeDescriptors();
106-
var actualTopic = _topicRepository.Load(currentTopic.Id);
107+
var actualTopic = _topicRepository.Load(currentTopic.Id)?? _topicRepository.Load(currentTopic.Parent.Id);
107108
var actualContentType = contentTypes.GetTopic(currentTopic.ContentType);
108109

109-
if (actualContentType is null) {
110+
if (actualContentType is null || actualTopic is null) {
110111
return View(viewModel);
111112
}
112113

OnTopic.Editor.AspNetCore/Shared/Styles/Layout/_layout.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ body {
7878
//----------------------------------------------------------------------------------------------
7979
.dropdown-menu {
8080
padding : 10px;
81+
min-width : 180px;
8182
li a {
8283
line-height : 1.4rem;
8384
}

0 commit comments

Comments
 (0)