Skip to content

Commit

Permalink
ContentsDriver: removed AdminFilter check to display delete button an…
Browse files Browse the repository at this point in the history
…d checked the content is published before showing the unpublish button.
  • Loading branch information
AndreaPiovanelli committed Nov 25, 2022
1 parent 6308517 commit e2d564e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Orchard.Web/Core/Contents/Drivers/ContentsDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Contents.Settings;
using Orchard.UI.Admin;

namespace Orchard.Core.Contents.Drivers {
public class ContentsDriver : ContentPartDriver<ContentPart> {
Expand All @@ -24,13 +23,13 @@ protected override DriverResult Editor(ContentPart part, dynamic shapeHelper) {

if (part.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable) {
results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
if (part.ContentItem.IsPublished()) {
results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
}
}

if (part.Id > 0) {
if (AdminFilter.IsApplied(System.Web.HttpContext.Current.Request.RequestContext)) {
results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
}
results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
}

return Combined(results.ToArray());
Expand Down

0 comments on commit e2d564e

Please sign in to comment.