#16998: Publish Later UI now much less confusing with 3 buttons: Save, Publish Now, and Publish Later.

This also moves some publish-later specific css from the admin css to the publish later css, and makes the _Archive_ Later UI look better when active.

--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-12-10 11:12:29 -08:00
parent ce506d2bf9
commit 625880f9e1
5 changed files with 40 additions and 27 deletions

View File

@@ -2,6 +2,7 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.Core.Common.Services;
using Orchard.Mvc;
using Orchard.PublishLater.Models;
using Orchard.PublishLater.Services;
using Orchard.PublishLater.ViewModels;
@@ -58,22 +59,24 @@ namespace Orchard.PublishLater.Drivers {
updater.TryUpdateModel(model, Prefix, null, null);
if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) && !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) {
DateTime scheduled;
string parseDateTime = String.Concat(model.ScheduledPublishDate, " ", model.ScheduledPublishTime);
if (Services.WorkContext.Resolve<IHttpContextAccessor>().Current().Request.Form["submit.Save"] == "submit.PublishLater") {
if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) && !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) {
DateTime scheduled;
string parseDateTime = String.Concat(model.ScheduledPublishDate, " ", model.ScheduledPublishTime);
// use an english culture as it is the one used by jQuery.datepicker by default
if (DateTime.TryParse(parseDateTime, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out scheduled)) {
model.ScheduledPublishUtc = part.ScheduledPublishUtc.Value = scheduled.ToUniversalTime();
_publishLaterService.Publish(model.ContentItem, model.ScheduledPublishUtc.Value);
// use an english culture as it is the one used by jQuery.datepicker by default
if (DateTime.TryParse(parseDateTime, CultureInfo.GetCultureInfo("en-US"), DateTimeStyles.AssumeLocal, out scheduled)) {
model.ScheduledPublishUtc = part.ScheduledPublishUtc.Value = scheduled.ToUniversalTime();
_publishLaterService.Publish(model.ContentItem, model.ScheduledPublishUtc.Value);
}
else {
updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime));
}
}
else {
updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime));
else if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) || !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) {
updater.AddModelError(Prefix, T("Both the date and time need to be specified for when this is to be published. If you don't want to schedule publishing then click Save or Publish Now."));
}
}
else if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) || !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) {
updater.AddModelError(Prefix, T("Both the date and time need to be specified for when this is to be published. If you don't want to schedule publishing then clear both the date and time fields."));
}
return ContentShape("Parts_PublishLater_Edit",
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));

View File

@@ -7,7 +7,7 @@
-->
<!-- edit shape just get default placement -->
<!-- edit "shape" -->
<Place Parts_PublishLater_Edit="Sidebar:22"/><!-- immediately following the contents module's save button -->
<Place Parts_PublishLater_Edit="Sidebar:25"/><!-- immediately following the contents module's Publish Now button -->
<!-- default positioning -->
<Match DisplayType="SummaryAdmin">
<Place Parts_PublishLater_Metadata_SummaryAdmin="Meta:1"/>

View File

@@ -6,9 +6,25 @@ html.dyn input.hinted {
color:#ccc;
font-style:italic;
}
fieldset.publish-later-datetime {
float:left;
clear:none;
white-space: nowrap;
vertical-align: middle;
}
fieldset.publish-later-datetime legend {
display:none;
}
fieldset.publish-later-datetime input {
padding:1px;
text-align:center;
color:#666;
}
input#PublishLater_ScheduledPublishDate {
width:49%;
width:39%;
}
input#PublishLater_ScheduledPublishTime {
width:43%;
}
width:33%;
}

View File

@@ -12,6 +12,7 @@
@Html.EditorFor(m => m.ScheduledPublishDate)
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")">@T("Time")</label>
@Html.EditorFor(m => m.ScheduledPublishTime)
<button type="submit" name="submit.Save" value="submit.PublishLater">@T("Publish Later")</button>
</fieldset>
@using(Script.Foot()) {
<script type="text/javascript">

View File

@@ -868,6 +868,9 @@ fieldset.publish-button, fieldset.delete-button, fieldset.save-button {
clear:none;
float:left;
}
fieldset.save-button {
clear:left;
}
fieldset.publish-button {
margin: 0 12px;
padding: 0 12px;
@@ -876,17 +879,7 @@ fieldset.publish-button {
fieldset.delete-button {
margin: 0 0 0 12px;
}
fieldset.publish-later-datetime {
float:left;
}
fieldset.publish-later-datetime legend {
display:none;
}
fieldset.publish-later-datetime input {
padding:1px;
text-align:center;
color:#666;
}
/* Fields
***************************************************************/