diff --git a/src/Foundation/Features/Blocks/PageListBlock/PageListBlock.cs b/src/Foundation/Features/Blocks/PageListBlock/PageListBlock.cs index 46c8ff56d..b5b60f27f 100644 --- a/src/Foundation/Features/Blocks/PageListBlock/PageListBlock.cs +++ b/src/Foundation/Features/Blocks/PageListBlock/PageListBlock.cs @@ -50,7 +50,10 @@ public class PageListBlock : FoundationBlockData [Display(Name = "Include all levels", GroupName = SystemTabNames.Content, Order = 90)] public virtual bool Recursive { get; set; } - [Display(Name = "Template of pages listing", GroupName = SystemTabNames.Content, Order = 100)] + [Display(Name = "Page Listing Display Style", + Description = "Display template to use for page list", + GroupName = SystemTabNames.Content, + Order = 100)] [SelectOne(SelectionFactoryType = typeof(TemplateListSelectionFactory))] public virtual string Template { get; set; } @@ -58,11 +61,18 @@ public class PageListBlock : FoundationBlockData [SelectOne(SelectionFactoryType = typeof(PreviewOptionSelectionFactory))] public virtual string PreviewOption { get; set; } - [Display(Name = "Overlay color (only for Card template)", Description = "Apply for Card template", GroupName = SystemTabNames.Content, Order = 120)] + [Display(Name = "Bootstrap Card Image Display Ratio (Bootstrap Card Group display only)", + Description = "Display ratio for card image when using Bootstrap Card Group template", + GroupName = SystemTabNames.Content, + Order = 115)] + [SelectOne(SelectionFactoryType = typeof(BootstrapCardRatioSelectionFactory))] + public virtual string BootstrapCardRatioOption { get; set; } + + [Display(Name = "Overlay color (non-Bootstrap Card template only)", Description = "Apply for non-Bootstrap Card template", GroupName = SystemTabNames.Content, Order = 120)] [ClientEditor(ClientEditingClass = "foundation/Editors/ColorPicker")] public virtual string OverlayColor { get; set; } - [Display(Name = "Overlay text color (only for Card template)", Description = "Apply for Card template", GroupName = SystemTabNames.Content, Order = 130)] + [Display(Name = "Overlay text color (non-Bootstrap Card template only)", Description = "Apply for non-Bootstrap Card template", GroupName = SystemTabNames.Content, Order = 130)] [ClientEditor(ClientEditingClass = "foundation/Editors/ColorPicker")] public virtual string OverlayTextColor { get; set; } @@ -75,6 +85,7 @@ public override void SetDefaultValues(ContentType contentType) IncludePublishDate = false; Template = TemplateSelections.Grid; PreviewOption = PreviewOptions.Full; + BootstrapCardRatioOption = BootstrapCardRatioSelections.FourThree; SortOrder = FilterSortOrder.PublishedDescending; OverlayColor = "black"; OverlayTextColor = "white"; diff --git a/src/Foundation/Features/Blocks/PageListBlock/PageListBlockViewModel.cs b/src/Foundation/Features/Blocks/PageListBlock/PageListBlockViewModel.cs index 4214a6c91..c5368cd22 100644 --- a/src/Foundation/Features/Blocks/PageListBlock/PageListBlockViewModel.cs +++ b/src/Foundation/Features/Blocks/PageListBlock/PageListBlockViewModel.cs @@ -9,6 +9,7 @@ public PageListBlockViewModel(PageListBlock block) : base(block) ShowPublishDate = block.IncludePublishDate; Padding = block.Padding; SetPreviewOptionValue(block.PreviewOption); + BootstrapCardRatio = block.BootstrapCardRatioOption; } public string Heading { get; set; } @@ -27,6 +28,7 @@ private void SetPreviewOptionValue(string option) else if (option.Equals("1")) PreviewOption = 12; } + public string BootstrapCardRatio { get; set; } } public class PageListPreviewViewModel @@ -47,5 +49,6 @@ public PageListPreviewViewModel(PageData page, PageListBlock block) ShowIntroduction = block.IncludeTeaserText; ShowPublishDate = block.IncludePublishDate; } + public string BootstrapCardRatio { get; set; } } } diff --git a/src/Foundation/Features/Blocks/PageListBlock/Views/PageListBlock.cshtml b/src/Foundation/Features/Blocks/PageListBlock/Views/PageListBlock.cshtml index 206847ddd..1a6099724 100644 --- a/src/Foundation/Features/Blocks/PageListBlock/Views/PageListBlock.cshtml +++ b/src/Foundation/Features/Blocks/PageListBlock/Views/PageListBlock.cshtml @@ -16,6 +16,10 @@ { switch (Model.CurrentBlock.Template) { + case TemplateSelections.BootstrapCardGroup: + @await Html.PartialAsync("/Features/Blocks/PageListBlock/Views/Templates/_BootstrapCardGroupTemplate.cshtml", Model) + break; + case TemplateSelections.Grid: @await Html.PartialAsync("/Features/Blocks/PageListBlock/Views/Templates/_GridTemplate.cshtml", Model) break; diff --git a/src/Foundation/Features/Blocks/PageListBlock/Views/Templates/_BootstrapCardGroupTemplate.cshtml b/src/Foundation/Features/Blocks/PageListBlock/Views/Templates/_BootstrapCardGroupTemplate.cshtml new file mode 100644 index 000000000..71affcc97 --- /dev/null +++ b/src/Foundation/Features/Blocks/PageListBlock/Views/Templates/_BootstrapCardGroupTemplate.cshtml @@ -0,0 +1,47 @@ +@model PageListBlockViewModel +@using EPiServer.Core.Html +@using Foundation.Features.Blocks.PageListBlock +@using Foundation.Features.Shared.SelectionFactories + +@{ + int col = 12/Model.PreviewOption; +} + +@if (Model.Pages != null && Model.Pages.Any()) +{ +