Skip to content

Commit 3906c4a

Browse files
committed
Remove _Delete_ if DisableDelete
This was previously set up to disable the delete button. That's actually preferrable. That only works, however, if the _Delete_ button is an actual `<button />` element. Since this "button" is actually an `<a />` element, the `disable` attribute isn't supported. There are ways to get this to work (likely removing the `href` and any `onclick` handlers) but those are more involved. For now, a quick fix is just to get rid of the button entirely. (Which is actually how we handle the _Versions_, _Cancel_, and even the _Delete_ button in the `IsNew` state, so perhaps it's actually preferrable?)
1 parent 330fba0 commit 3906c4a

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
@{
44
Layout = null;
55
var displayGroups = Model.ContentTypeDescriptor.GetDisplayGroups();
6-
bool? disableDelete = null;
7-
if (Model.ContentTypeDescriptor.DisableDelete) {
8-
disableDelete = true;
9-
}
106
}
117

128
<div id="Toolbar" class="toolbar">
@@ -39,12 +35,11 @@
3935
<!-- /Cancel -->
4036

4137
<!-- Delete -->
42-
@if (!Model.IsNew) {
38+
@if (!Model.IsNew && !Model.ContentTypeDescriptor.DisableDelete) {
4339
<a
4440
id ="DeletePageButton"
4541
data-title ="@Model.Topic.Title?.Replace("\"", "&quot;")"
4642
href =@Url.Action("Delete", "Editor", new { path=Model.Topic.WebPath, isModal=Model.IsModal })
47-
disabled =@disableDelete
4843
class ="btn btn-default btn-sm"
4944
>Delete</a>
5045
}

0 commit comments

Comments
 (0)