@using DR.Web.UI.Model
@using DR.Web.UI.ViewConfig
@using System.Text.RegularExpressions
@model DR.Web.UI.Model.Article
@Model.Title.ToUnsafeString()
@if (Model.EmbeddedMediaLink != null)
{
@:
var imageUrl = !string.IsNullOrEmpty(Model.EmbeddedMediaLink.Image.Uri) ? Model.EmbeddedMediaLink.Image.Uri : (Model.LargeWideAspectImage != null) ? Model.LargeWideAspectImage.ImageUrl : string.Empty;
if (!string.IsNullOrEmpty(imageUrl))
{
}
else
{
}
if (!string.IsNullOrEmpty(Model.EmbeddedMediaLink.Image.AlternateText))
{
@Model.EmbeddedMediaLink.Image.AlternateText
}
@:
}
else if (Model.LargeWideAspectImage != null || Model.CodeComponents.Any())
{
if (Model.CodeComponents.Any())
{
foreach (var codeComponent in Model.CodeComponents)
{
@Html.Partial("ArticleComponents/code-component", codeComponent)
}
}
else
{
if (!String.IsNullOrEmpty(Model.LargeWideAspectImage.ImageText))
{
var image = Model.LargeWideAspectImage;
var caption = image.ImageText;
//Logic for creating copyright notice. THE MOST ADVANCED EVER. But it's easier to fucking read like this!
var constituents = new List
();
if (!string.IsNullOrEmpty(image.Photographer))
{
constituents.Add(" Foto:");
constituents.Add(image.Photographer.Replace("Foto: ", string.Empty));
}
if (!string.IsNullOrEmpty(image.CopyrightNotice))
{
constituents.Add(" ©");
constituents.Add(image.CopyrightNotice);
}
if (constituents.Count > 0)
{
var str = string.Format("{0}", string.Join(" ", constituents.ToArray()));
caption += str;
}
@Html.PartialWithViewData("image-wrap", image, new ImageWrapViewConf { Caption = caption })
}
else
{
@Html.Partial("image-wrap", Model.LargeWideAspectImage)
}
}
}