Several refactoring operations

This commit is contained in:
Andrea Piovanelli 2025-01-23 12:13:04 +01:00
parent 18a7f375f0
commit f0155c2698
7 changed files with 41 additions and 35 deletions

View File

@ -23,13 +23,11 @@ namespace Orchard.Core.Contents.Drivers {
if (part.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable) {
results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
if (part.ContentItem.IsPublished()) {
results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
}
}
results.Add(ContentShape("Content_UnpublishButton", unpublishButton => unpublishButton));
}
if (part.Id > 0) {
results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
results.Add(ContentShape("Content_DeleteButton", deleteButton => deleteButton));
}
return Combined(results.ToArray());

View File

@ -6,10 +6,10 @@
Parts_Contents_Publish_SummaryAdmin
-->
<!-- edit "shape" -->
<Place Content_UnpublishButton="Sidebar:25"/>
<Place Content_PublishButton="Sidebar:24"/>
<Place Content_SaveButton="Sidebar:23"/>
<Place Content_DeleteButton="Sidebar:22"/>
<Place Content_PublishButton="Sidebar:24"/>
<Place Content_UnpublishButton="Sidebar:25"/>
<Place Content_DeleteButton="Sidebar:26"/>
<Match DisplayType="Detail">
<Place Parts_Contents_Publish="Content:5"/>
</Match>

View File

@ -1,6 +1,5 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Contents;
@using Orchard.Utility.Extensions
@if (Authorizer.Authorize(Permissions.DeleteContent, (IContent)Model.ContentItem)) {
<fieldset class="delete-button">

View File

@ -1,9 +1,10 @@
@using Orchard.ContentManagement;
@using Orchard.Core.Contents;
@using Orchard.Utility.Extensions;
@{
var contentItem = Model.ContentItem as IContent;
}
@if (Authorizer.Authorize(Permissions.PublishContent, contentItem) && contentItem.IsPublished()) {
<fieldset class="unpublish-button">
<button type="submit" name="submit.Unpublish" value="submit.Unpublish">@T("Unpublish")</button>

View File

@ -1,6 +1,5 @@
using System;
using System.Linq;
using System.Reflection;
using System.Web.Mvc;
using Orchard.Blogs.Extensions;
using Orchard.Blogs.Models;

View File

@ -2,7 +2,6 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Contents.Settings;
using Orchard.Localization;
using Orchard.Utility.Extensions;
using Orchard.Widgets.Models;
@ -36,11 +35,6 @@ namespace Orchard.Widgets.Drivers {
() => shapeHelper.EditorTemplate(TemplateName: "Parts.Widgets.WidgetPart", Model: widgetPart, Prefix: Prefix))
};
if (widgetPart.Id > 0 && widgetPart.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable) {
results.Add(ContentShape("Content_UnpublishButton",
unpublishButton => unpublishButton));
}
return Combined(results.ToArray());
}

View File

@ -1126,24 +1126,27 @@ html.dyn #submit-pager, html.dyn .apply-bulk-actions-auto { display:none; }
/* Core Contents and Orchard.PublishLater */
.edit-item-sidebar fieldset {
margin:0;
padding:0;
margin: 0;
padding: 0;
clear: none;
float: left;
}
fieldset.publish-button, fieldset.delete-button, fieldset.save-button, fieldset.unpublish-button {
clear:none;
float:left;
.edit-item-sidebar fieldset:not(:first-child) {
margin-left: 12px;
}
fieldset.save-button {
clear:left;
.edit-item-sidebar fieldset:first-child {
clear: left;
}
fieldset.publish-button, fieldset.unpublish-button {
margin: 0 12px 0 0;
padding: 0 12px;
border-right:1px solid #ccc;
padding-right: 12px;
border-right: 1px solid #ccc;
}
fieldset.delete-button {
margin: 0 0 0 12px;
float: right;
}
/* Dashboard */
@ -1495,17 +1498,29 @@ html.dir-rtl {
margin-left:inherit;
margin-right:10px;
}
.dir-rtl fieldset.publish-button, fieldset.delete-button, .dir-rtl fieldset.save-button, .dir-rtl fieldset.unpublish-button {
float:right;
.dir-rtl .edit-item-sidebar fieldset {
float: right;
}
.dir-rtl fieldset.save-button {
clear:right;
.dir-rtl .edit-item-sidebar fieldset:first-child {
clear: right;
}
.dir-rtl fieldset.publish-button, .dir-rtl fieldset.unpublish-button {
margin: 0 0 0 12px ;
.dir-rtl .edit-item-sidebar fieldset:not(:first-child) {
margin-left: 0;
margin-right: 12px;
}
.dir-rtl fieldset.publish-button, fieldset.unpublish-button {
padding-right: 0;
border-right: none;
padding-left: 12px;
border-left: 1px solid #ccc;
}
.dir-rtl fieldset.delete-button {
margin: 0 12px 0 0;
float: left;
}
.content-rtl .permalink input.text {