Skip to content

Instantly share code, notes, and snippets.

@soen
Last active July 6, 2016 11:19
Show Gist options
  • Save soen/14b21513a29deae3ff84fb19be49c5d0 to your computer and use it in GitHub Desktop.
Save soen/14b21513a29deae3ff84fb19be49c5d0 to your computer and use it in GitHub Desktop.
// Decompiled with JetBrains decompiler
// Type: Sitecore.ExperienceEditor.Speak.Ribbon.Panels.PreviewDatePanel.DateAndTime
// Assembly: Sitecore.ExperienceEditor.Speak.Ribbon, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
//
// NOTE: This is not the complete implementation, only fractions of the important parts related to the date and time.
//
namespace Sitecore.ExperienceEditor.Speak.Ribbon.Panels.PreviewDatePanel
{
public class DateAndTime : RibbonComponentControlBase
{
protected DateTime CurrentDateAndTime { get; set; }
public DateAndTime()
{
this.InitializeControl();
}
protected void InitializeControl()
{
// code omitted ...
this.CurrentDateAndTime = DateUtil.ToServerTime(WebEditUtil.GetCurrentDate());
}
protected override void PreRender()
{
// code omitted ...
this.Attributes[(object) "data-sc-date"] = this.CurrentDateAndTime.ToShortDateString();
}
protected override void Render(HtmlTextWriter output)
{
// code omitted ...
this.RenderSpan("sc-chunk-datepanel-day", this.GetDay(culture), output);
this.RenderSpan("sc-chunk-datepanel-date", this.GetDate(culture), output);
output.AddAttribute(HtmlTextWriterAttribute.Class, "sc-chunk-datepanel-monthyear");
output.RenderBeginTag(HtmlTextWriterTag.Div);
this.RenderSpan("sc-chunk-datepanel-month", Translate.TextByLanguage(this.GetMonth(culture), Language.Parse(Context.User.Profile.ClientLanguage)), output);
this.RenderSpan("sc-chunk-datepanel-year", this.GetYear(culture), output);
// code omitted ...
}
// code omitted ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment