internal static MvcHtmlString VersionDateTime( this HtmlHelper source, string id, string value, string valueToMerge, ArticleViewType viewType ) => source.VersionText( id, viewType == ArticleViewType.PreviewVersion ? source.FormatAsDateTime(value) : ArticleVersion.Merge(source.FormatAsDateTime(value), source.FormatAsDateTime(valueToMerge)) );
private static MvcHtmlString VersionClassifierField(this HtmlHelper source, string name, string value, Field field, Article article, ArticleVersion version = null, bool forceReadOnly = true, string valueToMerge = null) { var name1 = version?.GetAggregatedContent(value)?.Name; if (!StringComparer.InvariantCultureIgnoreCase.Equals(value, valueToMerge) && article.ViewType == ArticleViewType.CompareVersions) { var name2 = version?.VersionToMerge.GetAggregatedContent(valueToMerge)?.Name; var mergedValue = ArticleVersion.Merge(Formatter.ProtectHtml(name1), Formatter.ProtectHtml(name2)); return(source.VersionText(name, mergedValue)); } Article aggregatedArticle = null; var classifierValue = Converter.ToInt32(value, 0); if (article.ViewType != ArticleViewType.Virtual) { aggregatedArticle = version?.AggregatedArticles.SingleOrDefault(n => n.ContentId == classifierValue); } var sb = new StringBuilder(source.BeginClassifierFieldComponent(name, value, field, article, aggregatedArticle, out var _)); if (forceReadOnly) { sb.Append(source.VersionText(name, name1)); } else { var contentListHtmlAttrs = new Dictionary <string, object> { { "class", "dropDownList classifierContentList" } }; sb.Append(source.DropDownList(name, source.List(ArticleViewModel.GetAggregatableContentsForClassifier(field, value)), FieldStrings.SelectContent, contentListHtmlAttrs).ToHtmlString()); } sb.Append(EndClassifierFieldComponent()); return(MvcHtmlString.Create(sb.ToString())); }
internal static MvcHtmlString VersionTime(this HtmlHelper source, string id, string value, string valueToMerge, ArticleViewType viewType) { var resultValue = viewType == ArticleViewType.PreviewVersion ? source.FormatAsTime(value) : ArticleVersion.Merge(source.FormatAsTime(value), source.FormatAsTime(valueToMerge)); return(source.VersionText(id, resultValue)); }