mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Updating the content item edit's publishing controls.
- if the content item is not "Draftable" there is a single save button that saves and publishes - if the content item is "Draftable" there is still the save button, which saves a draft, and a publish now button for immediate publishing - if there's a part on the content item that handles scheduling (like Orchard.PublishLater) then the draft saved should be scheduled for publishing --HG-- branch : dev
This commit is contained in:
@@ -8,6 +8,7 @@ using Orchard.ContentManagement;
|
|||||||
using Orchard.ContentManagement.Aspects;
|
using Orchard.ContentManagement.Aspects;
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
|
using Orchard.ContentManagement.Records;
|
||||||
using Orchard.Core.Common.Models;
|
using Orchard.Core.Common.Models;
|
||||||
using Orchard.Core.Contents.Settings;
|
using Orchard.Core.Contents.Settings;
|
||||||
using Orchard.Core.Contents.ViewModels;
|
using Orchard.Core.Contents.ViewModels;
|
||||||
@@ -67,12 +68,14 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
|
|
||||||
switch (model.Options.OrderBy) {
|
switch (model.Options.OrderBy) {
|
||||||
case ContentsOrder.Modified:
|
case ContentsOrder.Modified:
|
||||||
|
//query = query.OrderByDescending<ContentPartRecord, int>(ci => ci.ContentItemRecord.Versions.Single(civr => civr.Latest).Id);
|
||||||
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.ModifiedUtc);
|
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.ModifiedUtc);
|
||||||
break;
|
break;
|
||||||
case ContentsOrder.Published:
|
case ContentsOrder.Published:
|
||||||
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.PublishedUtc);
|
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.PublishedUtc);
|
||||||
break;
|
break;
|
||||||
case ContentsOrder.Created:
|
case ContentsOrder.Created:
|
||||||
|
//query = query.OrderByDescending<ContentPartRecord, int>(ci => ci.Id);
|
||||||
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.CreatedUtc);
|
query = query.OrderByDescending<CommonPartRecord, DateTime?>(cr => cr.CreatedUtc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -189,24 +192,39 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("Create")]
|
||||||
|
[FormValueRequired("submit.Save")]
|
||||||
|
public ActionResult CreatePOST(string id) {
|
||||||
|
return CreatePOST(id, contentItem => {
|
||||||
|
if (!contentItem.Has<IPublishingControlAspect>() && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
|
||||||
|
_contentManager.Publish(contentItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost, ActionName("Create")]
|
[HttpPost, ActionName("Create")]
|
||||||
public ActionResult CreatePOST(string id) {
|
[FormValueRequired("submit.Publish")]
|
||||||
|
public ActionResult CreateAndPublishPOST(string id) {
|
||||||
|
return CreatePOST(id, contentItem => _contentManager.Publish(contentItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ActionResult CreatePOST(string id, Action<ContentItem> conditionallyPublish) {
|
||||||
var contentItem = _contentManager.New(id);
|
var contentItem = _contentManager.New(id);
|
||||||
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't create content")))
|
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't create content")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
var isDraftable = contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable;
|
||||||
var model = _contentManager.UpdateEditor(contentItem, this);
|
_contentManager.Create(
|
||||||
|
contentItem,
|
||||||
|
isDraftable ? VersionOptions.Draft : VersionOptions.Published);
|
||||||
|
|
||||||
|
var model = _contentManager.UpdateEditor(contentItem, this);
|
||||||
if (!ModelState.IsValid) {
|
if (!ModelState.IsValid) {
|
||||||
_transactionManager.Cancel();
|
_transactionManager.Cancel();
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!contentItem.Has<IPublishingControlAspect>())
|
conditionallyPublish(contentItem);
|
||||||
_contentManager.Publish(contentItem);
|
|
||||||
|
|
||||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
||||||
? T("Your content has been created.")
|
? T("Your content has been created.")
|
||||||
@@ -229,7 +247,21 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, ActionName("Edit")]
|
[HttpPost, ActionName("Edit")]
|
||||||
|
[FormValueRequired("submit.Save")]
|
||||||
public ActionResult EditPOST(int id, string returnUrl) {
|
public ActionResult EditPOST(int id, string returnUrl) {
|
||||||
|
return EditPOST(id, returnUrl, contentItem => {
|
||||||
|
if (!contentItem.Has<IPublishingControlAspect>() && !contentItem.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
|
||||||
|
_contentManager.Publish(contentItem);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("Edit")]
|
||||||
|
[FormValueRequired("submit.Publish")]
|
||||||
|
public ActionResult EditAndPublishPOST(int id, string returnUrl) {
|
||||||
|
return EditPOST(id, returnUrl, contentItem => _contentManager.Publish(contentItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
private ActionResult EditPOST(int id, string returnUrl, Action<ContentItem> conditionallyPublish) {
|
||||||
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
|
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
|
||||||
|
|
||||||
if (contentItem == null)
|
if (contentItem == null)
|
||||||
@@ -244,9 +276,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
return View("Edit", model);
|
return View("Edit", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
//need to go about this differently - to know when to publish (IPlublishableAspect ?)
|
conditionallyPublish(contentItem);
|
||||||
if (!contentItem.Has<IPublishingControlAspect>())
|
|
||||||
_contentManager.Publish(contentItem);
|
|
||||||
|
|
||||||
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
|
||||||
? T("Your content has been saved.")
|
? T("Your content has been saved.")
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
using Orchard.ContentManagement;
|
using System.Collections.Generic;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Drivers;
|
using Orchard.ContentManagement.Drivers;
|
||||||
|
using Orchard.Core.Contents.Settings;
|
||||||
|
|
||||||
namespace Orchard.Core.Contents.Drivers {
|
namespace Orchard.Core.Contents.Drivers {
|
||||||
public class ContentsDriver : ContentPartDriver<ContentPart> {
|
public class ContentsDriver : ContentPartDriver<ContentPart> {
|
||||||
@@ -13,5 +15,18 @@ namespace Orchard.Core.Contents.Drivers {
|
|||||||
() => shapeHelper.Parts_Contents_Publish_SummaryAdmin(ContentPart: part))
|
() => shapeHelper.Parts_Contents_Publish_SummaryAdmin(ContentPart: part))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override DriverResult Editor(ContentPart part, dynamic shapeHelper) {
|
||||||
|
var results = new List<DriverResult> { ContentShape("Content_SaveButton", saveButton => saveButton) };
|
||||||
|
|
||||||
|
if (part.TypeDefinition.Settings.GetModel<ContentTypeSettings>().Draftable)
|
||||||
|
results.Add(ContentShape("Content_PublishButton", publishButton => publishButton));
|
||||||
|
|
||||||
|
return Combined(results.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DriverResult Editor(ContentPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||||
|
return Editor(part, updater);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -4,6 +4,9 @@
|
|||||||
Parts_Contents_Publish
|
Parts_Contents_Publish
|
||||||
Parts_Contents_Publish_SummaryAdmin
|
Parts_Contents_Publish_SummaryAdmin
|
||||||
-->
|
-->
|
||||||
|
<!-- edit "shape" -->
|
||||||
|
<Place Content_PublishButton="Sidebar:20"/>
|
||||||
|
<Place Content_SaveButton="Sidebar:22"/>
|
||||||
<Match DisplayType="Detail">
|
<Match DisplayType="Detail">
|
||||||
<Place Parts_Contents_Publish="Content:5"/>
|
<Place Parts_Contents_Publish="Content:5"/>
|
||||||
</Match>
|
</Match>
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
<fieldset class="publish-button">
|
||||||
|
<button type="submit" name="submit.Publish" value="submit.Publish">@T("Publish Now")</button>
|
||||||
|
</fieldset>
|
@@ -0,0 +1,3 @@
|
|||||||
|
<fieldset class="save-button">
|
||||||
|
<button class="primaryAction" type="submit" name="submit.Save" value="submit.Save">@T("Save")</button>
|
||||||
|
</fieldset>
|
@@ -4,9 +4,5 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="secondary">
|
<div class="secondary">
|
||||||
@Display(Model.Sidebar)
|
@Display(Model.Sidebar)
|
||||||
@* todo: (heskew) remove when the CommonPart is adding the save button *@
|
|
||||||
<fieldset>
|
|
||||||
<button class="primaryAction" type="submit" name="submit.Save" value="submit.Save">@T("Save")</button>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@@ -274,12 +274,8 @@
|
|||||||
<Content Include="Settings\Views\Admin\Index.cshtml" />
|
<Content Include="Settings\Views\Admin\Index.cshtml" />
|
||||||
<Content Include="Settings\Views\Admin\Culture.cshtml" />
|
<Content Include="Settings\Views\Admin\Culture.cshtml" />
|
||||||
<Content Include="Contents\Views\Items\Content.Edit.cshtml" />
|
<Content Include="Contents\Views\Items\Content.Edit.cshtml" />
|
||||||
<Content Include="Routable\Placement.info">
|
<Content Include="Routable\Placement.info" />
|
||||||
<SubType>Designer</SubType>
|
<Content Include="Settings\Placement.info" />
|
||||||
</Content>
|
|
||||||
<Content Include="Settings\Placement.info">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Settings\Views\DisplayTemplates\CurrentCulture.cshtml" />
|
<Content Include="Settings\Views\DisplayTemplates\CurrentCulture.cshtml" />
|
||||||
<Content Include="Settings\Views\DisplayTemplates\RemovableCulture.cshtml" />
|
<Content Include="Settings\Views\DisplayTemplates\RemovableCulture.cshtml" />
|
||||||
<Content Include="Shapes\Module.txt" />
|
<Content Include="Shapes\Module.txt" />
|
||||||
@@ -358,18 +354,16 @@
|
|||||||
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
<Content Include="Contents\Views\Content.ControlWrapper.cshtml" />
|
||||||
<Content Include="Contents\Views\Item\Display.cshtml" />
|
<Content Include="Contents\Views\Item\Display.cshtml" />
|
||||||
<Content Include="Localization\Placement.info" />
|
<Content Include="Localization\Placement.info" />
|
||||||
<Content Include="Messaging\Placement.info">
|
<Content Include="Messaging\Placement.info" />
|
||||||
<SubType>Designer</SubType>
|
<Content Include="Navigation\Placement.info" />
|
||||||
</Content>
|
|
||||||
<Content Include="Navigation\Placement.info">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Routable\Views\Parts\RoutableTitle.cshtml" />
|
<Content Include="Routable\Views\Parts\RoutableTitle.cshtml" />
|
||||||
<Content Include="Routable\Views\Item\Display.cshtml" />
|
<Content Include="Routable\Views\Item\Display.cshtml" />
|
||||||
<Content Include="Routable\Views\Routable.HomePage.cshtml" />
|
<Content Include="Routable\Views\Routable.HomePage.cshtml" />
|
||||||
<Content Include="Localization\Views\Parts\Localization.ContentTranslations.SummaryAdmin.cshtml" />
|
<Content Include="Localization\Views\Parts\Localization.ContentTranslations.SummaryAdmin.cshtml" />
|
||||||
<Content Include="Contents\Views\Items\Content.Summary.cshtml" />
|
<Content Include="Contents\Views\Items\Content.Summary.cshtml" />
|
||||||
<Content Include="Shapes\Views\Pager.cshtml" />
|
<Content Include="Shapes\Views\Pager.cshtml" />
|
||||||
|
<Content Include="Contents\Views\Content.SaveButton.cshtml" />
|
||||||
|
<Content Include="Contents\Views\Content.PublishButton.cshtml" />
|
||||||
<Content Include="Shapes\Scripts\Web.config">
|
<Content Include="Shapes\Scripts\Web.config">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
|
@@ -7,7 +7,6 @@ using Orchard.PublishLater.Services;
|
|||||||
using Orchard.PublishLater.ViewModels;
|
using Orchard.PublishLater.ViewModels;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using Orchard.Core.Localization.Services;
|
|
||||||
|
|
||||||
namespace Orchard.PublishLater.Drivers {
|
namespace Orchard.PublishLater.Drivers {
|
||||||
public class PublishLaterPartDriver : ContentPartDriver<PublishLaterPart> {
|
public class PublishLaterPartDriver : ContentPartDriver<PublishLaterPart> {
|
||||||
@@ -49,8 +48,8 @@ namespace Orchard.PublishLater.Drivers {
|
|||||||
// date and time are formatted using the same patterns as DateTimePicker is, preventing other cultures issues
|
// date and time are formatted using the same patterns as DateTimePicker is, preventing other cultures issues
|
||||||
var model = new PublishLaterViewModel(part) {
|
var model = new PublishLaterViewModel(part) {
|
||||||
ScheduledPublishUtc = part.ScheduledPublishUtc.Value,
|
ScheduledPublishUtc = part.ScheduledPublishUtc.Value,
|
||||||
ScheduledPublishDate = part.ScheduledPublishUtc.Value.HasValue ? part.ScheduledPublishUtc.Value.Value.ToLocalTime().ToString(DatePattern, CultureInfo.InvariantCulture) : String.Empty,
|
ScheduledPublishDate = part.ScheduledPublishUtc.Value.HasValue && !part.IsPublished() ? part.ScheduledPublishUtc.Value.Value.ToLocalTime().ToString(DatePattern, CultureInfo.InvariantCulture) : String.Empty,
|
||||||
ScheduledPublishTime = part.ScheduledPublishUtc.Value.HasValue ? part.ScheduledPublishUtc.Value.Value.ToLocalTime().ToString(TimePattern, CultureInfo.InvariantCulture) : String.Empty
|
ScheduledPublishTime = part.ScheduledPublishUtc.Value.HasValue && !part.IsPublished() ? part.ScheduledPublishUtc.Value.Value.ToLocalTime().ToString(TimePattern, CultureInfo.InvariantCulture) : String.Empty
|
||||||
};
|
};
|
||||||
|
|
||||||
return ContentShape("Parts_PublishLater_Edit",
|
return ContentShape("Parts_PublishLater_Edit",
|
||||||
@@ -60,27 +59,24 @@ namespace Orchard.PublishLater.Drivers {
|
|||||||
var model = new PublishLaterViewModel(part);
|
var model = new PublishLaterViewModel(part);
|
||||||
|
|
||||||
updater.TryUpdateModel(model, Prefix, null, null);
|
updater.TryUpdateModel(model, Prefix, null, null);
|
||||||
switch (model.Command) {
|
|
||||||
case "PublishNow":
|
|
||||||
_commonService.Publish(model.ContentItem);
|
|
||||||
break;
|
|
||||||
case "PublishLater":
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
updater.AddModelError(Prefix, T("{0} is an invalid date and time", parseDateTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
if (!string.IsNullOrWhiteSpace(model.ScheduledPublishDate) && !string.IsNullOrWhiteSpace(model.ScheduledPublishTime)) {
|
||||||
case "SaveDraft":
|
DateTime scheduled;
|
||||||
break;
|
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);
|
||||||
|
}
|
||||||
|
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 clear both the date and time fields."));
|
||||||
|
}
|
||||||
|
|
||||||
return ContentShape("Parts_PublishLater_Edit",
|
return ContentShape("Parts_PublishLater_Edit",
|
||||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
-->
|
-->
|
||||||
<!-- edit shape just get default placement -->
|
<!-- edit shape just get default placement -->
|
||||||
<!-- edit "shape" -->
|
<!-- edit "shape" -->
|
||||||
<Place Parts_PublishLater_Edit="Sidebar:1"/>
|
<Place Parts_PublishLater_Edit="Sidebar:23"/><!-- immediately following the contents module's save button -->
|
||||||
<!-- default positioning -->
|
<!-- default positioning -->
|
||||||
<Match DisplayType="SummaryAdmin">
|
<Match DisplayType="SummaryAdmin">
|
||||||
<Place Parts_PublishLater_Metadata_SummaryAdmin="Meta:1"/>
|
<Place Parts_PublishLater_Metadata_SummaryAdmin="Meta:1"/>
|
||||||
|
@@ -7,8 +7,8 @@ html.dyn input.hinted {
|
|||||||
font-style:italic;
|
font-style:italic;
|
||||||
}
|
}
|
||||||
input#PublishLater_ScheduledPublishDate {
|
input#PublishLater_ScheduledPublishDate {
|
||||||
width:50%;
|
width:49%;
|
||||||
}
|
}
|
||||||
input#PublishLater_ScheduledPublishTime {
|
input#PublishLater_ScheduledPublishTime {
|
||||||
width:36%;
|
width:43%;
|
||||||
}
|
}
|
@@ -11,7 +11,6 @@ namespace Orchard.PublishLater.ViewModels {
|
|||||||
_publishLaterPart = publishLaterPart;
|
_publishLaterPart = publishLaterPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Command { get; set; }
|
|
||||||
public ContentItem ContentItem { get { return _publishLaterPart.ContentItem; } }
|
public ContentItem ContentItem { get { return _publishLaterPart.ContentItem; } }
|
||||||
|
|
||||||
public bool IsPublished {
|
public bool IsPublished {
|
||||||
|
@@ -4,48 +4,36 @@
|
|||||||
Script.Require("jQueryUI_DatePicker");
|
Script.Require("jQueryUI_DatePicker");
|
||||||
Style.Require("PublishLater_DatePicker");
|
Style.Require("PublishLater_DatePicker");
|
||||||
Style.Require("jQueryUtils_TimePicker");
|
Style.Require("jQueryUtils_TimePicker");
|
||||||
Style.Require("jQueryUI_DatePicker");
|
Style.Require("jQueryUI_DatePicker");
|
||||||
}
|
}
|
||||||
<fieldset>
|
<fieldset class="publish-later-datetime">
|
||||||
<legend>@T("Publish Settings")</legend>
|
<legend>@T("Publish Settings")</legend>
|
||||||
<div>
|
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishDate")">@T("Date")</label>
|
||||||
@Html.RadioButton("Command", "SaveDraft", Model.ContentItem.VersionRecord == null || !Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft") })
|
@Html.EditorFor(m => m.ScheduledPublishDate)
|
||||||
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_SaveDraft")">@T("Save Draft")</label>
|
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")">@T("Time")</label>
|
||||||
</div>
|
@Html.EditorFor(m => m.ScheduledPublishTime)
|
||||||
<div>
|
|
||||||
@Html.RadioButton("Command", "PublishNow", Model.ContentItem.VersionRecord != null && Model.ContentItem.VersionRecord.Published, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow") })
|
|
||||||
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishNow")">@T("Publish Now")</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
@Html.RadioButton("Command", "PublishLater", Model.ScheduledPublishUtc != null, new { id = ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater") })
|
|
||||||
<label class="forcheckbox" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")">@T("Publish Later")</label>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishDate")">@T("Date")</label>
|
|
||||||
@Html.EditorFor(m => m.ScheduledPublishDate)
|
|
||||||
<label class="forpicker" for="@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")">@T("Time")</label>
|
|
||||||
@Html.EditorFor(m => m.ScheduledPublishTime)
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@using(Script.Foot()) {
|
@using(Script.Foot()) {
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
$(function () {
|
$(function () {
|
||||||
|
var clearHint = function ($this) { if ($this.val() == $this.data("hint")) { $this.removeClass("hinted").val("") } };
|
||||||
|
var resetHint = function ($this) { setTimeout(function () { if (!$this.val()) { $this.addClass("hinted").val($this.data("hint")) } }, 300) };
|
||||||
@* todo: (heskew) make a plugin *@
|
@* todo: (heskew) make a plugin *@
|
||||||
$("label.forpicker").each(function () {
|
$("label.forpicker").each(function () {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var pickerInput = $("#" + $this.attr("for"));
|
var pickerInput = $("#" + $this.attr("for"));
|
||||||
pickerInput.data("hint", $this.text());
|
|
||||||
if (!pickerInput.val()) {
|
if (!pickerInput.val()) {
|
||||||
|
pickerInput.data("hint", $this.text());
|
||||||
pickerInput.addClass("hinted")
|
pickerInput.addClass("hinted")
|
||||||
.val(pickerInput.data("hint"))
|
.val(pickerInput.data("hint"))
|
||||||
.focus(function () { var $this = $(this); if ($this.val() == $this.data("hint")) { $this.removeClass("hinted").val("") } })
|
.focus(function() {clearHint($(this));})
|
||||||
.blur(function () { var $this = $(this); setTimeout(function () { if (!$this.val()) { $this.addClass("hinted").val($this.data("hint")) } }, 300) });
|
.blur(function() {resetHint($(this));});
|
||||||
|
$this.closest("form").submit(function() {clearHint(pickerInput); pickerInput = 0;});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishDate")').datepicker({ showAnim: "" }).focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")').attr("checked", "checked") });
|
$('#@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishDate")').datepicker({ showAnim: "" }).focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")').attr("checked", "checked") });
|
||||||
$('#@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")').timepickr().focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")').attr("checked", "checked") });
|
$('#@ViewData.TemplateInfo.GetFullHtmlFieldId("ScheduledPublishTime")').timepickr().focus(function () { $('#@ViewData.TemplateInfo.GetFullHtmlFieldId("Command_PublishLater")').attr("checked", "checked") });
|
||||||
|
|
||||||
})
|
})
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
|
@@ -19,6 +19,6 @@
|
|||||||
@Display(Model.User)
|
@Display(Model.User)
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input class="button primaryAction" type="submit" value="@T("Save") " />
|
<button class="primaryAction" type="submit">@T("Save")</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
}
|
}
|
||||||
|
@@ -128,13 +128,13 @@ number of columns: 24; actual width: 946; column width: 26; gutter width:14
|
|||||||
.sections .primary {
|
.sections .primary {
|
||||||
display:inline;
|
display:inline;
|
||||||
float:left;
|
float:left;
|
||||||
width:74.543%;
|
width:69.452%;
|
||||||
}
|
}
|
||||||
.sections .secondary {
|
.sections .secondary {
|
||||||
display:inline;
|
display:inline;
|
||||||
float:left;
|
float:left;
|
||||||
margin-left:1.71%;
|
margin-left:1.71%;
|
||||||
width:23.629%;
|
width:28.721%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Headings and defaults
|
/* Headings and defaults
|
||||||
@@ -842,6 +842,29 @@ table .button {
|
|||||||
.settings legend {
|
.settings legend {
|
||||||
margin:0 0 -.4em 0;
|
margin:0 0 -.4em 0;
|
||||||
}
|
}
|
||||||
|
/* Core Contents and Orchard.PublishLater */
|
||||||
|
fieldset.save-button {
|
||||||
|
clear:none;
|
||||||
|
float:left;
|
||||||
|
padding-right:0;
|
||||||
|
width:auto;
|
||||||
|
}
|
||||||
|
fieldset.publish-later-datetime {
|
||||||
|
clear:none;
|
||||||
|
float:left;
|
||||||
|
min-width:13.6em;
|
||||||
|
padding-left:6px;
|
||||||
|
padding-right:0;
|
||||||
|
width:68%;
|
||||||
|
}
|
||||||
|
fieldset.publish-later-datetime legend {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
fieldset.publish-later-datetime input {
|
||||||
|
padding:1px;
|
||||||
|
text-align:center;
|
||||||
|
color:#666;
|
||||||
|
}
|
||||||
|
|
||||||
/* Fields
|
/* Fields
|
||||||
----------------------------------------------------------*/
|
----------------------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user