Created
September 13, 2023 16:36
-
-
Save MineshS/d353e8838e9fa347440dd3edf9b0325a to your computer and use it in GitHub Desktop.
Promo Block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.ComponentModel.DataAnnotations; | |
using EPiServer.Core; | |
using EPiServer.DataAnnotations; | |
using Netcel.Optimizely.Domain.Groups; | |
using Netcel.Optimizely.Domain.Models.Blocks.Base; | |
using Netcel.Optimizely.Rendering.Attributes; | |
using Netcel.Optimizely.Rendering; | |
using EPiServer.Web; | |
using EPiServer.SpecializedProperties; | |
using Netcel.Optimizely.Domain.Attributes; | |
namespace Netcel.Optimizely.Domain.Models.Blocks; | |
[ContentType( | |
DisplayName = "Promo Block", | |
Description = "Promo Block.", | |
GUID = "886B5D34-0C74-4D3B-9A0D-283AE80EC274", | |
Order = 30, | |
GroupName = ContentGroups.Content)] | |
[DefaultDisplayOption(ContentAreaDisplayOptions.Full)] | |
public class PromoBlock : SiteBaseBlockData | |
{ | |
[Display( | |
Name = "Image", | |
Description = "Image", | |
GroupName = TabsGroups.Content, | |
Order = 100)] | |
[CultureSpecific] | |
[UIHint(UIHint.Image)] | |
[ImageSize(Width = 210)] | |
[ImageSize(Width = 280)] | |
[ImageSize(Width = 335)] | |
[ImageSize(Width = 420)] | |
[ImageSize(Width = 452)] | |
[ImageSize(Width = 526)] | |
[ImageSize(Width = 550, IsDefault = true)] | |
[ImageSize(Width = 560)] | |
[ImageSize(Width = 630)] | |
[ImageSize(Width = 670)] | |
[ImageSize(Width = 840)] | |
[ImageSize(Width = 904)] | |
[ImageSize(Width = 1005)] | |
[ImageSize(Width = 1052)] | |
[ImageSize(Width = 1100)] | |
[ImageSize(Width = 1356)] | |
[ImageSize(Width = 1578)] | |
[ImageSize(Width = 1650)] | |
[ImageSizes(Sizes = "(min-width: 1280px) 550px, (min-width: 1024px) calc(100vw - 120px) / 2, (min-width: 768px) calc(100vw - 80px) / 2, calc(100vw - 40px)")] | |
[Required] | |
public virtual ContentReference PromoImage { get; set; } | |
[Required] | |
[Display( | |
Name = "Title", | |
Description = "Title", | |
GroupName = TabsGroups.Content, | |
Order = 200)] | |
[CultureSpecific] | |
public virtual String Title { get; set; } | |
[Display( | |
Name = "Subtitle", | |
Description = "Subtitle", | |
GroupName = TabsGroups.Content, | |
Order = 300)] | |
[CultureSpecific] | |
public virtual String Subtitle { get; set; } | |
[Display( | |
Name = "Summary", | |
Description = "Summary", | |
GroupName = TabsGroups.Content, | |
Order = 400)] | |
[CultureSpecific] | |
[UIHint(UIHint.Textarea)] | |
public virtual String Summary { get; set; } | |
[Display( | |
Name = "Link", | |
Description = "Link", | |
GroupName = TabsGroups.Content, | |
Order = 500)] | |
[CultureSpecific] | |
public virtual LinkItem Link { get; set; } | |
[Display( | |
Name = "Image to the right", | |
Description = "Image to the right", | |
GroupName = TabsGroups.Content, | |
Order = 600)] | |
[CultureSpecific] | |
public virtual bool ImageToTheRight { get; set; } | |
/// <summary> | |
/// Set this to provide block level styles. Override in each block, if block is | |
/// not suppose to have any block specific style set this to empty string | |
/// </summary> | |
public override string CustomCss => ImageToTheRight | |
? $"promoBlock reverse" | |
: $"promoBlock "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment