Skip to content

Commit 22b5f4f

Browse files
committed
Merge branch 'release/4.5.0' into master
The primary focus of this update is to introduce two new attribute types—`InstructionAttribute` and `IncomingRelationshipAttribute`. Neither of these persist actual attribute values to the edited topic; instead, they help fill out the instructions and the object graph for the editor by exposing information that might not otherwise be obvious by only looking at the current topic's attributes. This update also includes various user interface improvements, including stick navigation and some basic responsiveness. Finally, this includes a couple of bug fixes—most notably, a bug inherited from the underlying OnTopic Library which prevents attribute values from being deleted via the editor. New Features - Updated the _View Page_ link to open the page in a new tab (853bdd7) - Updated the `TextAreaViewComponent` to support `MinimumLength` (57edf1e) - Updated the `TextViewComponent` (06b57c9) to support `MinimumLength` (d2699bc), a regular expression `Pattern` validation (a7fa26c), and an optional `ValidationMessage` (92c147e) - Introduced the new `InstructionViewComponent`, which allows instructional text to be embedded in the editor at any point among the attributes (e8e6261) - Introduced the new `IncomingRelationshipViewComponent` (32edc40), which exposes a list of incoming relationships, optionally filted by `AttributeKey` and `AttributeValue` (407c040) Improvements - Updated style of `HtmlViewComponent` to help avoid a flash of unstyled content (FOUC) as WYSIWYG editor script is applied (bb727cd) - Updated style of `TokenizedTopicListViewComponent` so that it looks similar to the `TextViewComponent` (fa277f7) - Updated style and interaction patterns of the `RelationshipViewComponent`, make it easier to navigate the tree and select nodes (2e0ddb4) - Updated navigation and topic information callout to be sticky, while introducing basic responsive features for callouts, buttons, navigation, and title (643d856) Bug Fixes - Ensured that errors in dropdown menus (e5e2f7c) and text areas (0221298) are correctly reported in their corresponding tabs so editors can see where an error has occurred (0c4bb2d) - Fixed a bug where a deleted attribute might not get saved since deleted attributes didn't result in the `AttributeValueCollection` being marked as `IsDirty()` (7777eec) Cleanup - Deferred JavaScript resources to improve page load time (e0664a8) - Import of Twitter Bootstrap directly via SCSS, instead of via compiled CSS; this allows us to only import styles associated with components we're actually using (92822dc) - Minor improvements to code (96e9dfa), such as streamlining deleted attribute logic (7777eec), reducing some flashes of unstyled content (FOUC) (bb727cd), and removing legacy code (1052cf8, 587dc0d) - Explicitly set the `isRecursive` parameter of `ITopicRepository.Delete()` to ensure forward compatibility, as the parameter default will change in the next version of the OnTopic library (ba2acb4) - Marked the `DisplayOptionsViewComponent` (f910e53) and the `DefaultAttributeTypeViewComponent` (4f53e36) as deprecated in anticipation of OnTopic Editor 5.0.0 (def412e) - Marked a number of members on `AttributeDescriptorTopicViewModel` as deprecated, including the ill-conceived `CssClass` attribute, in anticipation of OnTopic Editor 5.0.0 (57edf1e)
2 parents 3b11cbe + 78df51f commit 22b5f4f

52 files changed

Lines changed: 787 additions & 253 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

OnTopic.Editor.AspNetCore.Host/OnTopic.Editor.AspNetCore.Host.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="OnTopic" Version="4.4.0" />
11-
<PackageReference Include="OnTopic.ViewModels" Version="4.4.0" />
12-
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.4.0" />
13-
<PackageReference Include="OnTopic.Data.Caching" Version="4.4.0" />
14-
<PackageReference Include="OnTopic.Data.Sql" Version="4.4.0" />
15-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.7" />
10+
<PackageReference Include="OnTopic" Version="4.5.0" />
11+
<PackageReference Include="OnTopic.ViewModels" Version="4.5.0" />
12+
<PackageReference Include="OnTopic.AspNetCore.Mvc" Version="4.5.0" />
13+
<PackageReference Include="OnTopic.Data.Caching" Version="4.5.0" />
14+
<PackageReference Include="OnTopic.Data.Sql" Version="4.5.0" />
15+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.8" />
1616
</ItemGroup>
1717

1818
<ItemGroup>

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

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@ else if (Model.TopicList.Count > 2) {
1414
</select>
1515

1616
<script>
17-
(function ($) {
18-
$("#@($"ContentTypesFor_{Model.AttributeKey}")").change(function () {
19-
var option = $('option:selected', this);
20-
@if (Model.EnableModal?? false) {
21-
<text>
22-
initEditorModal('@Model.AttributeKey', option.text(), option.val(), @Model.OnModalClose); return false;
23-
</text>
24-
}
25-
else {
26-
<text>
27-
window.location.href = option.val();
28-
</text>
29-
}
30-
});
31-
})(jQuery);
17+
window.addEventListener('DOMContentLoaded', function () {
18+
(function($) {
19+
$("#@($"ContentTypesFor_{Model.AttributeKey}")").change(function () {
20+
var option = $('option:selected', this);
21+
@if (Model.EnableModal?? false) {
22+
<text>
23+
initEditorModal('@Model.AttributeKey', option.text(), option.val(), @Model.OnModalClose); return false;
24+
</text>
25+
}
26+
else {
27+
<text>
28+
window.location.href = option.val();
29+
</text>
30+
}
31+
});
32+
})(jQuery);
33+
});
3234
</script>
3335

3436
}

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

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,32 @@
1616
/>
1717

1818
<script>
19-
$(function() {
19+
window.addEventListener('DOMContentLoaded', function() {
20+
(function($) {
2021
21-
//Instantiate date and/or time picker
22-
$('#@Html.IdFor(m => m.Value)')
23-
.@(includeDatePicker? "date" : "")@(includeTimePicker? "time" : "")picker({
24-
@if (includeDatePicker) {
25-
<text>
26-
dateFormat : '@Model.AttributeDescriptor.DateFormat',
27-
defaultDate : '@Model.GetDefaultDate()',
28-
</text>
29-
}
30-
@if (includeDatePicker && includeTimePicker) {
31-
<text>
32-
separator : '@Model.AttributeDescriptor.DateTimeSeparator',
33-
</text>
34-
}
35-
@if (includeTimePicker) {
36-
<text>
37-
timeFormat : '@Model.AttributeDescriptor.TimeFormat',
38-
defaultTime : '@Model.GetDefaultTime()',
39-
</text>
40-
}
41-
defaultValue : '@Model.GetDefaultDate() @Model.GetDefaultTime()'
42-
});
22+
//Instantiate date and/or time picker
23+
$('#@Html.IdFor(m => m.Value)')
24+
.@(includeDatePicker? "date" : "")@(includeTimePicker? "time" : "")picker({
25+
@if (includeDatePicker) {
26+
<text>
27+
dateFormat : '@Model.AttributeDescriptor.DateFormat',
28+
defaultDate : '@Model.GetDefaultDate()',
29+
</text>
30+
}
31+
@if (includeDatePicker && includeTimePicker) {
32+
<text>
33+
separator : '@Model.AttributeDescriptor.DateTimeSeparator',
34+
</text>
35+
}
36+
@if (includeTimePicker) {
37+
<text>
38+
timeFormat : '@Model.AttributeDescriptor.TimeFormat',
39+
defaultTime : '@Model.GetDefaultTime()',
40+
</text>
41+
}
42+
defaultValue : '@Model.GetDefaultDate() @Model.GetDefaultTime()'
43+
});
4344
45+
})(jQuery);
4446
});
4547
</script>

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

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,16 @@
1919
asp-for ="Value"
2020
rows =@Model.AttributeDescriptor.Rows
2121
columns =@Model.AttributeDescriptor.Columns
22-
class =@Model.AttributeDescriptor.CssClass
22+
class ="@Model.AttributeDescriptor.CssClass form-control"
2323
placeholder =@Model.InheritedValue
2424
disabled =@(!Model.AttributeDescriptor.IsEnabled)
2525
required =@Model.AttributeDescriptor.IsRequired
2626
></textarea>
2727

2828
<script type="text/javascript">
29-
(function ($) {
30-
31-
var textareaId = '@Html.IdFor(m => m.Value)';
32-
33-
$('[id*="EditorModal"]').on('shown.bs.modal', function(e) {
34-
$('.Modal [id*="@Html.IdFor(m => m.Value)"]').attr('id', '@Html.IdFor(m => m.Value)_Modal');
35-
console.log('new id: ' + $('[id*="@Html.IdFor(m => m.Value)"]').attr('id'));
36-
textareaId = '@Html.IdFor(m => m.Value)_Modal';
37-
setEditorInstance(textareaId);
38-
console.log(textareaId);
39-
return;
40-
});
41-
42-
setEditorInstance(textareaId);
43-
44-
})(jQuery);
45-
46-
function setEditorInstance(textareaId) {
47-
CKEDITOR.replace(textareaId, {
48-
height : '@Model.AttributeDescriptor.Height',
49-
resize_maxHeight : '@(Model.AttributeDescriptor.Height+300)',
50-
customConfig : '/_content/OnTopic.Editor.AspNetCore/Shared/Scripts/CkEditor/customConfig.js'
51-
});
52-
}
29+
CKEDITOR.replace(@Html.IdFor(m => m.Value), {
30+
height : '@Model.AttributeDescriptor.Height',
31+
resize_maxHeight : '@(Model.AttributeDescriptor.Height+300)',
32+
customConfig : '/_content/OnTopic.Editor.AspNetCore/Shared/Scripts/CkEditor/customConfig.js'
33+
});
5334
</script>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@model IncomingRelationshipAttributeViewModel
2+
3+
@{
4+
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
5+
}
6+
7+
<ul>
8+
@foreach(var relatedTopic in Model.RelatedTopics) {
9+
<li><a href="@Url.Action("Edit", new { path = relatedTopic.WebPath })">@relatedTopic.Title</a></li>
10+
}
11+
</ul>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@model AttributeViewModel<InstructionAttributeTopicViewModel>
2+
3+
@{
4+
Layout = "~/Areas/Editor/Views/Editor/Components/_Layout.cshtml";
5+
}
6+
7+
<div class="label">
8+
<div class="alert alert-warning" role="alert">
9+
@Html.Raw(@Model.AttributeDescriptor.Instructions)
10+
</div>
11+
</div>
12+
13+
<input type="hidden" asp-for="Value" />

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

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,39 @@
1414
<div id="@containerName"></div>
1515

1616
<script type="text/javascript">
17+
1718
var @($"{treeName}");
1819

19-
Ext.onReady(function () {
20-
21-
@($"{treeName}") = new OnTopic.NestedTopics('@Model.UniqueKey', {
22-
dataUrl : '/OnTopic/Json/@Model.WebPath/@attributeKey?ShowAll=true',
23-
listeners : {
24-
click : function (n) {
25-
var targetUrl = "@($"{Url.Action("Edit")}/{attributeKey}/")" + n.attributes.key;
26-
@if (Model.AttributeDescriptor.EnableModal?? true) {
27-
<text>
28-
initEditorModal('@attributeKey', n.attributes.text, targetUrl + '?IsModal=true', @($"{treeName}.refresh"));return false;
29-
</text>
30-
}
31-
else {
32-
<text>
33-
location.href = targetUrl;
34-
</text>
20+
window.addEventListener('DOMContentLoaded', function () {
21+
(function($) {
22+
23+
Ext.onReady(function () {
24+
25+
@($"{treeName}") = new OnTopic.NestedTopics('@Model.UniqueKey', {
26+
dataUrl : '/OnTopic/Json/@Model.WebPath/@attributeKey?ShowAll=true',
27+
listeners : {
28+
click : function (n) {
29+
var targetUrl = "@($"{Url.Action("Edit")}/{attributeKey}/")" + n.attributes.key;
30+
@if (Model.AttributeDescriptor.EnableModal?? true) {
31+
<text>
32+
initEditorModal('@attributeKey', n.attributes.text, targetUrl + '?IsModal=true', @($"{treeName}.refresh"));
33+
return false;
34+
</text>
35+
}
36+
else {
37+
<text>
38+
location.href = targetUrl;
39+
</text>
40+
}
41+
}
3542
}
36-
}
37-
}
38-
});
43+
});
44+
45+
@($"{treeName}").render('@containerName');
3946

40-
@($"{treeName}").render('@containerName');
47+
});
4148

49+
})(jQuery);
4250
});
4351

4452
</script>
@@ -50,10 +58,10 @@
5058
values =@Model.AttributeDescriptor.PermittedContentTypes>
5159
</vc:content-type-list>
5260

53-
<div id="@($"EditorModal_{attributeKey}")" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
54-
<div class="modal-dialog modal-lg">
61+
<div id="@($"EditorModal_{attributeKey}")" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" role="dialog" aria-hidden="true">
62+
<div class="modal-dialog modal-lg" role="document">
5563
<div class="modal-header page title">
56-
<h2 id="@($"ModalTitle_{attributeKey}")"><!-- determined by modal open script caller --></h2>
64+
<h2 id="@($"ModalTitle_{attributeKey}")" class="modal-title"><!-- determined by modal open script caller --></h2>
5765
</div>
5866
<div class="modal-content">
5967
<iframe id="@($"EditorFrame_{attributeKey}")" src="" width="100%" marginheight="0" frameborder="0">
@@ -64,10 +72,12 @@
6472
</div>
6573

6674
<script>
67-
$(function() {
68-
$('[id^="EditorModal"]').on('hide.bs.modal', function (e) {
69-
@($"{treeName}.refresh")();
70-
});
75+
window.addEventListener('DOMContentLoaded', function () {
76+
(function($) {
77+
$('[id^="EditorModal"]').on('hide.bs.modal', function(e) {
78+
@($"{treeName}.refresh")();
79+
});
80+
})(jQuery);
7181
});
7282
</script>
7383

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414
<div id="@containerName"></div>
1515

1616
<script type="text/javascript">
17-
Ext.onReady(function(){
18-
var tree = new OnTopic.SelectableTreeView({
19-
dataUrl : '/OnTopic/Json/@rootTopicKey?ShowRoot=@descriptor.ShowRoot&ShowAll=true&RelatedNamespace=@descriptor.Key&RelatedTopicID=@Model.CurrentTopic.Id&AttributeName=@descriptor.AttributeKey&AttributeValue=@descriptor.AttributeValue&ExpandRelated=@descriptor.ExpandRelated',
20-
checkAscendants : @((descriptor.CheckAscendants is true).ToString().ToLower()),
21-
backingField : '@Html.IdFor(m => m.Value)'
22-
});
23-
tree.render('@containerName');
17+
window.addEventListener('DOMContentLoaded', function () {
18+
(function($) {
19+
Ext.onReady(function () {
20+
var tree = new OnTopic.SelectableTreeView({
21+
dataUrl: '/OnTopic/Json/@rootTopicKey?ShowRoot=@descriptor.ShowRoot&ShowAll=true&RelatedNamespace=@descriptor.Key&RelatedTopicID=@Model.CurrentTopic.Id&AttributeName=@descriptor.AttributeKey&AttributeValue=@descriptor.AttributeValue&ExpandRelated=@descriptor.ExpandRelated',
22+
checkAscendants: @((descriptor.CheckAscendants is true).ToString().ToLower()),
23+
backingField: '@Html.IdFor(m => m.Value)'
24+
});
25+
tree.render('@containerName');
26+
});
27+
})(jQuery);
2428
});
2529
</script>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
<input
88
type =@Model.AttributeDescriptor.InputType
99
asp-for =@Model.Value
10+
minlength =@Model.AttributeDescriptor.MinimumLength
1011
maxlength =@Model.AttributeDescriptor.MaximumLength
1112
class ="@Model.AttributeDescriptor.CssClass form-control"
13+
title =@Model.AttributeDescriptor.ValidationMessage
14+
pattern =@Model.AttributeDescriptor.Pattern
1215
placeholder =@Model.InheritedValue
1316
disabled =@(!Model.AttributeDescriptor.IsEnabled)
1417
required =@Model.AttributeDescriptor.IsRequired

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
asp-for ="Value"
99
rows =@Model.AttributeDescriptor.Rows
1010
cols =@Model.AttributeDescriptor.Columns
11+
minlength =@Model.AttributeDescriptor.MinimumLength
1112
maxlength =@Model.AttributeDescriptor.MaximumLength
1213
class ="@Model.AttributeDescriptor.CssClass form-control"
1314
placeholder =@Model.InheritedValue

0 commit comments

Comments
 (0)