Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model TextOverImage.Models.ImageWithText
- @{
- // Use this code to render this partial in your template. Replace "banner" with whatever your property name is
- // Make sure to include @using TextOverImage.Models at the top of your template
- //@if(Model.Content.HasProperty("banner") && Model.Content.HasValue("banner"))
- //{
- // @Html.Partial("TextOverImagePartial", Model.Content.GetPropertyValue<ImageWithText>("banner")
- //}
- // You could use banner.Media.GetCropUrl(width,height) here instead if you want to set it!
- var imageUrl = Model.Media != null ? Model.Media.Url : string.Empty;
- // Only render the style tag if the image url exists
- var style = !string.IsNullOrEmpty(imageUrl) ? MvcHtmlString.Create(" style=\"background: url(" + imageUrl + ") no-repeat center center; background-size: cover;\"") : MvcHtmlString.Empty;
- }
- <div class="banner banner--@Model.Height"@style>
- <div class="banner--inner banner--@Model.Position">
- <h1>@Model.Headline</h1>
- <h2>@Model.Subheadline</h2>
- @if (Model.Link != null)
- {
- <a href="@Model.Link.Url" target="@Model.Link.Target" class="button">@Model.Link.Name</a>
- }
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement