From 3cdfd6848b9aa7ba03ff97dbbf0353a2dd0726d2 Mon Sep 17 00:00:00 2001 From: Daniel Stolt Date: Sun, 3 Aug 2014 01:21:42 +0200 Subject: [PATCH] Cleaned up a few uses of the DateTime shape. --- .../Orchard.AuditTrail/Views/Parts.AuditTrail.cshtml | 2 +- .../Views/CloudVideo.Edit.Jobs.cshtml | 12 +++++------- .../Views/OpenJobsTable.cshtml | 12 +++++------- .../Services/IDateLocalizationServices.txt | 2 -- 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.AuditTrail/Views/Parts.AuditTrail.cshtml b/src/Orchard.Web/Modules/Orchard.AuditTrail/Views/Parts.AuditTrail.cshtml index 3eb6d6662..91047c687 100644 --- a/src/Orchard.Web/Modules/Orchard.AuditTrail/Views/Parts.AuditTrail.cshtml +++ b/src/Orchard.Web/Modules/Orchard.AuditTrail/Views/Parts.AuditTrail.cshtml @@ -37,7 +37,7 @@ @record.CategoryDescriptor.Name @record.EventDescriptor.Name @record.Record.UserName - @Display.DateTime(DateTimeUtc: record.Record.CreatedUtc, CustomFormat: T("g")) + @Display.DateTime(DateTimeUtc: record.Record.CreatedUtc) @Display(record.SummaryShape) @record.Record.Comment @Html.ActionLink(T("Details").Text, "Detail", "Admin", new { id = record.Record.Id, area = "Orchard.AuditTrail" }, null) diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Jobs.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Jobs.cshtml index d3dce489d..ce02753b4 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Jobs.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/CloudVideo.Edit.Jobs.cshtml @@ -2,7 +2,6 @@ @using Orchard.Azure.MediaServices.Models @using Orchard.Azure.MediaServices.Models.Assets @using Orchard.Azure.MediaServices.Models.Jobs -@using Orchard.Localization.Services @{ Style.Include("cloudmedia-edit-jobs.css", "cloudmedia-edit-jobs.min.css"); Style.Include("cloudmedia-progress.css", "cloudmedia-progress.min.css"); @@ -13,11 +12,10 @@ var isUploaded = !isCreatingItem && cloudVideoPart.MezzanineAsset.UploadState.Status == AssetUploadStatus.Uploaded; var jobsToDisplay = cloudVideoPart != null ? cloudVideoPart.Jobs.Where(x => x.Status != JobStatus.Archived).ToArray() : Enumerable.Empty(); var authorizedToManageJobs = AuthorizedFor(Permissions.ManageCloudMediaJobs); - var dateTimeFormatProvider = WorkContext.Resolve(); } -@helper ShortDateTime(DateTime? value, IDateTimeFormatProvider dateTimeFormatProvider) { +@helper ShortDateTime(DateTime? value) { if (value != null) { - @Display.DateTime(DateTimeUtc: value, CustomFormat: T(dateTimeFormatProvider.ShortDateTimeFormat)) + @Display.DateTime(DateTimeUtc: value) } } @if (!isCreatingItem && jobsToDisplay.Any()) { @@ -41,7 +39,7 @@ @job.Name @job.Description - @ShortDateTime(job.CreatedUtc, dateTimeFormatProvider) + @ShortDateTime(job.CreatedUtc) @if (job.Status == JobStatus.Processing) { var percentComplete = Convert.ToInt32(job.PercentComplete); @@ -57,8 +55,8 @@ } - @ShortDateTime(job.StartedUtc, dateTimeFormatProvider) - @ShortDateTime(job.FinishedUtc, dateTimeFormatProvider) + @ShortDateTime(job.StartedUtc) + @ShortDateTime(job.FinishedUtc) @job.ErrorMessage @if (authorizedToManageJobs) { diff --git a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/OpenJobsTable.cshtml b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/OpenJobsTable.cshtml index 004a0e409..d9ff0d646 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/OpenJobsTable.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Azure.MediaServices/Views/OpenJobsTable.cshtml @@ -1,5 +1,4 @@ @using Orchard.Azure.MediaServices.Models.Jobs -@using Orchard.Localization.Services @{ Style.Include("cloudmedia-progress.css", "cloudmedia-progress.min.css"); Script.Require("ShapesBase"); @@ -7,11 +6,10 @@ Layout.Title = "Manage Microsoft Azure Media Jobs"; var jobs = (IEnumerable)Model.Jobs; - var dateTimeFormatProvider = WorkContext.Resolve(); } -@helper ShortDateTime(DateTime? value, IDateTimeFormatProvider dateTimeFormatProvider) { +@helper ShortDateTime(DateTime? value) { if (value != null) { - @Display.DateTime(DateTimeUtc: value, CustomFormat: T(dateTimeFormatProvider.ShortDateTimeFormat)) + @Display.DateTime(DateTimeUtc: value) } } @@ -42,7 +40,7 @@ - + - - + +
@job.Name @job.Description @Html.ItemEditLinkWithReturnUrl(Html.ItemDisplayText(job.CloudVideoPart).ToString(), job.CloudVideoPart)@ShortDateTime(job.CreatedUtc, dateTimeFormatProvider)@ShortDateTime(job.CreatedUtc) @if (job.Status == JobStatus.Processing) { var percentComplete = Convert.ToInt32(job.PercentComplete); @@ -57,8 +55,8 @@ @T(job.Status.ToString()) } @ShortDateTime(job.StartedUtc, dateTimeFormatProvider)@ShortDateTime(job.FinishedUtc, dateTimeFormatProvider)@ShortDateTime(job.StartedUtc)@ShortDateTime(job.FinishedUtc) @job.ErrorMessage @if (job.CanArchive) { diff --git a/src/Orchard/Localization/Services/IDateLocalizationServices.txt b/src/Orchard/Localization/Services/IDateLocalizationServices.txt index a6df3e138..ef5bbb997 100644 --- a/src/Orchard/Localization/Services/IDateLocalizationServices.txt +++ b/src/Orchard/Localization/Services/IDateLocalizationServices.txt @@ -2,11 +2,9 @@ TODO: * Test for proper handling of fraction (f) format specifier - suspect it does not work properly in current state * Add formatting and parsing of time zone information (add timezone properties to TimeParts structure) * Write unit tests for DefaultDateLocalizationServices - * Add warning message when saving unsupported combination in settings * Add support for the different Gregorian calendar types * Make sure DateTimeField, ArchiveLaterPart and PublishLaterPart handle Persian dates correctly. * Improve CultureDateTimeFormatProvider to return correct information for fa-IR culture when PersianCalendar is in use. - * Check for all uses of Display.DateTime that use a standard format string - no can do! BREAKING: * DateTokens "Date.Format:" and "Date.Local.Format:" only supports custom date/time format strings. \ No newline at end of file