• All-in-one e-commerce
  • Volledig ontzorgd
  • Vaste prijs per maand
  • Binnen 2 maanden up & running
Error executing template "Designs/CaaS_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_ddf53009d74d450fb6014062f6e3b8dd.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\BluedeskCorporate_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 91 { 92 <section class="cta-paragraph__content @centerContent @noImageClass"> 93 94 <article class="cta-paragraph__content-container @centerTextClass @noImageClass"> 95 96 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <header class="cta-paragraph__header @centerTextClass"> 99 @if (SubHeader != null)100 {101 @SubHeader.HeaderFormatted("cta-paragraph__subheader")102 }103 @Header.HeaderFormatted("cta-paragraph__header")104 </header>105 }106107 @if (!string.IsNullOrWhiteSpace(Content.Text))108 {109 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>110 }111112 </article>113114 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))115 {116 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">117 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>118 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>119 </a>120 }121122 </section>123124 }125126 }127128129 @if (amountColumns > 0)130 {131 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">132 <div class="@classFullWidth">@RenderContentArea(_data)</div>133 </div>134 }135136 @helper RenderContentArea(Carousel _data)137 {138 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user139 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";140141 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";142143 /* Specific for Carousel */144145 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen146147 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page148 bool infiniteLoop = _data.Infinite;149 bool autoPlay = _data.AutoPlay;150 bool controls = _data.AddControls;151 bool duration = _data.Duration;152 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page153 int colAmount = 1;154155 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)156157 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))158 {159 <header class="multicolumn__header-wrapper">160 @_data.Header.HeaderFormatted("multicolumn__header")161 </header>162 }163164 string carouselHeight = "auto";165166 if (imagesOnlyBool && _data.ImageHeight != 0)167 {168 carouselHeight = _data.ImageHeight.ToString() + "px";169 }170171 if ((colDisplay <= amountColumns) && (colDisplay != 0))172 {173 string flexBasis = 100 / @colDisplay + "%";174175 <section class="carousel multicolumn"176 data-columns="@colAmount"177 data-dots="@showDots"178 data-loop="@infiniteLoop"179 data-autoplay="@autoPlay"180 data-controls="@controls"181 data-duration="@duration"182 style="height: @carouselHeight;">183184 @foreach (var column in _data.CarouselItems)185 {186187 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());188189 string image = column.Image.Image;190 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";191 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";192 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";193194 string coverImage = "";195196 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;197 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";198 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";199200 if (!imagesOnlyBool)201 {202 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";203 }204205 /*This is work around created by Alla to enable cover mode for stand alone pictures*/206 if (!hasContent && column.Image.BackgroundSize == "bg-cover")207 {208 coverImage = "height:100%;";209 }210211 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">212213 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">214 @{215 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";216217 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;218 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";219220 double ColumnAmount = colDisplay;221 double ColumnWidthSize = 1/ColumnAmount;222 }223224 @CTAParagraphImage(225 column.Image,226 false,227 null,228 false,229 _data.Fullwidth,230 imagesHeight,231 ColumnWidthSize232 )233 @CTAParagraphContent(234 column.Header,235 null,236 column.Content,237 column.Button,238 column.Image,239 false240 )241242 @if (clickableBlock)243 {244 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>245 }246 </section>247248 </div>249 }250 </section>251 }252 else if (colDisplay > amountColumns)253 {254 <div>Error: you cant display columns more than you filled in the backend</div>255 }256 }257258 @functions{259 // Check if this carousel contains only images (logo slider)260 bool checkOnlyImages(Carousel _data)261 {262263 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user264 int emptyColumn = 0;265266 // Loop through all the columns267 foreach (var column in _data.CarouselItems)268 {269 // If button is empty AND content is empty AND header is empty => this is img only270 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))271 {272 emptyColumn++;273 }274 }275276 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;277278 return emptyColumnResult;279280 }281 }282
Error executing template "Designs/CaaS_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_ddf53009d74d450fb6014062f6e3b8dd.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\BluedeskCorporate_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 91 { 92 <section class="cta-paragraph__content @centerContent @noImageClass"> 93 94 <article class="cta-paragraph__content-container @centerTextClass @noImageClass"> 95 96 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <header class="cta-paragraph__header @centerTextClass"> 99 @if (SubHeader != null)100 {101 @SubHeader.HeaderFormatted("cta-paragraph__subheader")102 }103 @Header.HeaderFormatted("cta-paragraph__header")104 </header>105 }106107 @if (!string.IsNullOrWhiteSpace(Content.Text))108 {109 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>110 }111112 </article>113114 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))115 {116 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">117 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>118 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>119 </a>120 }121122 </section>123124 }125126 }127128129 @if (amountColumns > 0)130 {131 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">132 <div class="@classFullWidth">@RenderContentArea(_data)</div>133 </div>134 }135136 @helper RenderContentArea(Carousel _data)137 {138 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user139 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";140141 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";142143 /* Specific for Carousel */144145 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen146147 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page148 bool infiniteLoop = _data.Infinite;149 bool autoPlay = _data.AutoPlay;150 bool controls = _data.AddControls;151 bool duration = _data.Duration;152 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page153 int colAmount = 1;154155 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)156157 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))158 {159 <header class="multicolumn__header-wrapper">160 @_data.Header.HeaderFormatted("multicolumn__header")161 </header>162 }163164 string carouselHeight = "auto";165166 if (imagesOnlyBool && _data.ImageHeight != 0)167 {168 carouselHeight = _data.ImageHeight.ToString() + "px";169 }170171 if ((colDisplay <= amountColumns) && (colDisplay != 0))172 {173 string flexBasis = 100 / @colDisplay + "%";174175 <section class="carousel multicolumn"176 data-columns="@colAmount"177 data-dots="@showDots"178 data-loop="@infiniteLoop"179 data-autoplay="@autoPlay"180 data-controls="@controls"181 data-duration="@duration"182 style="height: @carouselHeight;">183184 @foreach (var column in _data.CarouselItems)185 {186187 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());188189 string image = column.Image.Image;190 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";191 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";192 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";193194 string coverImage = "";195196 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;197 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";198 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";199200 if (!imagesOnlyBool)201 {202 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";203 }204205 /*This is work around created by Alla to enable cover mode for stand alone pictures*/206 if (!hasContent && column.Image.BackgroundSize == "bg-cover")207 {208 coverImage = "height:100%;";209 }210211 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">212213 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">214 @{215 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";216217 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;218 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";219220 double ColumnAmount = colDisplay;221 double ColumnWidthSize = 1/ColumnAmount;222 }223224 @CTAParagraphImage(225 column.Image,226 false,227 null,228 false,229 _data.Fullwidth,230 imagesHeight,231 ColumnWidthSize232 )233 @CTAParagraphContent(234 column.Header,235 null,236 column.Content,237 column.Button,238 column.Image,239 false240 )241242 @if (clickableBlock)243 {244 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>245 }246 </section>247248 </div>249 }250 </section>251 }252 else if (colDisplay > amountColumns)253 {254 <div>Error: you cant display columns more than you filled in the backend</div>255 }256 }257258 @functions{259 // Check if this carousel contains only images (logo slider)260 bool checkOnlyImages(Carousel _data)261 {262263 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user264 int emptyColumn = 0;265266 // Loop through all the columns267 foreach (var column in _data.CarouselItems)268 {269 // If button is empty AND content is empty AND header is empty => this is img only270 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))271 {272 emptyColumn++;273 }274 }275276 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;277278 return emptyColumnResult;279280 }281 }282
Error executing template "Designs/CaaS_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_ddf53009d74d450fb6014062f6e3b8dd.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\BluedeskCorporate_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 91 { 92 <section class="cta-paragraph__content @centerContent @noImageClass"> 93 94 <article class="cta-paragraph__content-container @centerTextClass @noImageClass"> 95 96 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <header class="cta-paragraph__header @centerTextClass"> 99 @if (SubHeader != null)100 {101 @SubHeader.HeaderFormatted("cta-paragraph__subheader")102 }103 @Header.HeaderFormatted("cta-paragraph__header")104 </header>105 }106107 @if (!string.IsNullOrWhiteSpace(Content.Text))108 {109 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>110 }111112 </article>113114 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))115 {116 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">117 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>118 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>119 </a>120 }121122 </section>123124 }125126 }127128129 @if (amountColumns > 0)130 {131 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">132 <div class="@classFullWidth">@RenderContentArea(_data)</div>133 </div>134 }135136 @helper RenderContentArea(Carousel _data)137 {138 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user139 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";140141 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";142143 /* Specific for Carousel */144145 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen146147 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page148 bool infiniteLoop = _data.Infinite;149 bool autoPlay = _data.AutoPlay;150 bool controls = _data.AddControls;151 bool duration = _data.Duration;152 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page153 int colAmount = 1;154155 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)156157 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))158 {159 <header class="multicolumn__header-wrapper">160 @_data.Header.HeaderFormatted("multicolumn__header")161 </header>162 }163164 string carouselHeight = "auto";165166 if (imagesOnlyBool && _data.ImageHeight != 0)167 {168 carouselHeight = _data.ImageHeight.ToString() + "px";169 }170171 if ((colDisplay <= amountColumns) && (colDisplay != 0))172 {173 string flexBasis = 100 / @colDisplay + "%";174175 <section class="carousel multicolumn"176 data-columns="@colAmount"177 data-dots="@showDots"178 data-loop="@infiniteLoop"179 data-autoplay="@autoPlay"180 data-controls="@controls"181 data-duration="@duration"182 style="height: @carouselHeight;">183184 @foreach (var column in _data.CarouselItems)185 {186187 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());188189 string image = column.Image.Image;190 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";191 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";192 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";193194 string coverImage = "";195196 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;197 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";198 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";199200 if (!imagesOnlyBool)201 {202 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";203 }204205 /*This is work around created by Alla to enable cover mode for stand alone pictures*/206 if (!hasContent && column.Image.BackgroundSize == "bg-cover")207 {208 coverImage = "height:100%;";209 }210211 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">212213 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">214 @{215 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";216217 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;218 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";219220 double ColumnAmount = colDisplay;221 double ColumnWidthSize = 1/ColumnAmount;222 }223224 @CTAParagraphImage(225 column.Image,226 false,227 null,228 false,229 _data.Fullwidth,230 imagesHeight,231 ColumnWidthSize232 )233 @CTAParagraphContent(234 column.Header,235 null,236 column.Content,237 column.Button,238 column.Image,239 false240 )241242 @if (clickableBlock)243 {244 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>245 }246 </section>247248 </div>249 }250 </section>251 }252 else if (colDisplay > amountColumns)253 {254 <div>Error: you cant display columns more than you filled in the backend</div>255 }256 }257258 @functions{259 // Check if this carousel contains only images (logo slider)260 bool checkOnlyImages(Carousel _data)261 {262263 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user264 int emptyColumn = 0;265266 // Loop through all the columns267 foreach (var column in _data.CarouselItems)268 {269 // If button is empty AND content is empty AND header is empty => this is img only270 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))271 {272 emptyColumn++;273 }274 }275276 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;277278 return emptyColumnResult;279280 }281 }282
Error executing template "Designs/CaaS_generated/Paragraph/Carousel.cshtml"System.NullReferenceException: Object reference not set to an instance of an object.at CompiledRazorTemplates.Dynamic.RazorEngine_ddf53009d74d450fb6014062f6e3b8dd.Execute() in D:\virtual_hosts\bluedeskCorporate\files\Templates\Designs\BluedeskCorporate_generated\Paragraph\Carousel.cshtml:line 17at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)at Dynamicweb.Rendering.Template.RenderRazorTemplate() in E:\Agent\_work\169\s\06 - Dynamicweb Host\Dynamicweb\Dynamicweb-9.9\Dynamicweb\Rendering\Template.cs:line 902
1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using Dynamicweb; 3 @using Dynamicweb.Content.Items; 4 @using Bluedesk.DynamicWeb.ItemTypes; 5 @using Bluedesk.DynamicWeb.ItemTypes.Pages; 6 @using Bluedesk.Tools.DynamicWeb.ExtensionMethods; 7 @using Bluedesk.Tools.Generic.ExtensionMethods 8 @using System.Linq; 9 @using Dynamicweb.Content; 10 11 <!-- FIX NEEDED: behaviour when all the items are full height images (for instance logo slider)?? --> 12 13 @{ 14 Carousel _data = ItemManager.Storage.GetById<Carousel>(Pageview.CurrentParagraph.ItemId ?? "0"); 15 16 var paragraphID = Pageview.CurrentParagraph.ID; 17 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user 18 var classFullWidth = !_data.Fullwidth ? "container" : "w-full"; // If slider or multicolumn has to be in container or full width of the page 19 } 20 21 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 22 @using Dynamicweb; 23 @using Dynamicweb.Content.Items; 24 @using Bluedesk.DynamicWeb.ItemTypes; 25 26 27 @{ 28 string fullWidthContainerClass = _data.Fullwidth ? "" : "container"; 29 30 string backgroundClass = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundClass) ? string.Format("bg-{0}", _data.BackgroundConfiguration.BackgroundClass) : ""; 31 string backgroundStyle = !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundColor) ? $"background-color: {_data.BackgroundConfiguration.BackgroundColor}; " : ""; 32 backgroundStyle += !string.IsNullOrWhiteSpace(_data.BackgroundConfiguration.BackgroundImage) ? $"background-image: url({_data.BackgroundConfiguration.BackgroundImage}); " : ""; 33 } 34 35 36 @functions { 37 string getbackgroundclass(string backgroundClass) 38 { 39 return !string.IsNullOrWhiteSpace(backgroundClass) ? string.Format("bg-{0}" ,backgroundClass) : ""; 40 } 41 } 42 43 @helper CTAParagraphImage(ParagraphImageResizable Image, bool ImageAsBackground, string ImagePosition, bool ParallaxImage, bool Fullwidth, string imagesHeight, double ColumnWidthSize) 44 { 45 if (!string.IsNullOrWhiteSpace(Image.Image)) 46 { 47 48 string image = !string.IsNullOrWhiteSpace(Image.Image) ? Image.Image : null; 49 imagesHeight = !string.IsNullOrWhiteSpace(imagesHeight) ? "height: " + imagesHeight + ";" : ""; 50 51 string imageParrallax = ParallaxImage ? "rellax" : ""; 52 string imageAsBackground = ImageAsBackground ? "cta-paragraph__image--is-background" : ""; 53 double imageWidth = 2000; 54 55 imageWidth = Fullwidth ? imageWidth : 1200; 56 imageWidth = imageWidth*ColumnWidthSize; 57 58 string strImageWidth = imageWidth + "px"; 59 string strImageWidthSize = imageWidth + "w"; 60 61 string ImageUrl = "/Admin/Public/GetImage.ashx?Image=" + image + "&Crop=0&Compression=80"; 62 63 if (!string.IsNullOrWhiteSpace(Image.Image)) 64 { 65 <figure class="cta-paragraph__image-container @imageAsBackground @Image.PositionY @Image.PositionX" style="@imagesHeight"> 66 67 <picture class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 68 <source media="(max-width: 400px)" srcset="@ImageUrl&Width=400"> 69 <source media="(max-width: 994px)" srcset="@ImageUrl&Width=994"> 70 <img src="@ImageUrl&Width=@imageWidth" alt="@Image.ImageAlt" class="cta-paragraph__image @Image.BackgroundSize @imageParrallax"> 71 </picture> 72 73 </figure> 74 } 75 } 76 } 77 78 79 @helper CTAParagraphContent(ParagraphHeader Header, ParagraphHeader SubHeader, ParagraphContent Content, CTAButton Button, ParagraphImage Image, bool strCenterVertical) 80 { 81 82 bool hasImage = !string.IsNullOrWhiteSpace(Image.Image) ? true : false; 83 string noImageClass = hasImage ? "" : "no-image"; 84 85 string centerTextClass = strCenterVertical ? "text-center" : ""; 86 string centerContent = !string.IsNullOrWhiteSpace(Image.Image) ? "" : "cta-paragraph__content--center"; 87 88 string buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right"; 89 90 if (!string.IsNullOrWhiteSpace(Button.ButtonText) || !string.IsNullOrWhiteSpace(Content.Text) || !string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 91 { 92 <section class="cta-paragraph__content @centerContent @noImageClass"> 93 94 <article class="cta-paragraph__content-container @centerTextClass @noImageClass"> 95 96 @if (!string.IsNullOrWhiteSpace(Header.HeaderFormatted("cta-paragraph__header"))) 97 { 98 <header class="cta-paragraph__header @centerTextClass"> 99 @if (SubHeader != null)100 {101 @SubHeader.HeaderFormatted("cta-paragraph__subheader")102 }103 @Header.HeaderFormatted("cta-paragraph__header")104 </header>105 }106107 @if (!string.IsNullOrWhiteSpace(Content.Text))108 {109 <div class="cta-paragraph__text @centerTextClass">@Content.Text</div>110 }111112 </article>113114 @if (!string.IsNullOrWhiteSpace(Button.ButtonLink) && !string.IsNullOrWhiteSpace(Button.ButtonText))115 {116 <a href="@Button.ButtonLink" class="btn cta-paragraph__btn @Button.Configuration.ButtonClass">117 <span class="btn__text cta-paragraph__btn-label">@Button.ButtonText</span>118 <i class="btn__icon cta-paragraph__btn-icon @buttonIconClass"></i>119 </a>120 }121122 </section>123124 }125126 }127128129 @if (amountColumns > 0)130 {131 <div class="multicolumn overflow-hidden @backgroundClass @_data.CssClass" data-paragraphid="@paragraphID" id="@paragraphID">132 <div class="@classFullWidth">@RenderContentArea(_data)</div>133 </div>134 }135136 @helper RenderContentArea(Carousel _data)137 {138 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user139 var buttonIconClass = Pageview.Area.Item["Global_button_icon"] != null ? Pageview.Area.Item["Global_button_icon"].ToString().Replace("+", " ") : "fal fa-arrow-right";140141 string centerTextClass = _data.CenterText ? "items-center text-center" : "items-start text-left";142143 /* Specific for Carousel */144145 int colDisplay = _data.ColumnsDisplay; // Amount of displayed column within one screen146147 bool fullWidth = _data.Fullwidth; // If slider or multicolumn has to be in container or full widthof the page148 bool infiniteLoop = _data.Infinite;149 bool autoPlay = _data.AutoPlay;150 bool controls = _data.AddControls;151 bool duration = _data.Duration;152 bool showDots = _data.ShowDots; // If slider or multicolumn has to be in container or full widthof the page153 int colAmount = 1;154155 bool imagesOnlyBool = checkOnlyImages(_data); // Check if this carousel contains only images (logo slider)156157 if (!string.IsNullOrWhiteSpace(@_data.Header.HeaderFormatted()))158 {159 <header class="multicolumn__header-wrapper">160 @_data.Header.HeaderFormatted("multicolumn__header")161 </header>162 }163164 string carouselHeight = "auto";165166 if (imagesOnlyBool && _data.ImageHeight != 0)167 {168 carouselHeight = _data.ImageHeight.ToString() + "px";169 }170171 if ((colDisplay <= amountColumns) && (colDisplay != 0))172 {173 string flexBasis = 100 / @colDisplay + "%";174175 <section class="carousel multicolumn"176 data-columns="@colAmount"177 data-dots="@showDots"178 data-loop="@infiniteLoop"179 data-autoplay="@autoPlay"180 data-controls="@controls"181 data-duration="@duration"182 style="height: @carouselHeight;">183184 @foreach (var column in _data.CarouselItems)185 {186187 bool hasContent = !string.IsNullOrWhiteSpace(column.Button.ButtonText) || !string.IsNullOrWhiteSpace(column.Content.Text) || !string.IsNullOrWhiteSpace(column.Header.HeaderFormatted());188189 string image = column.Image.Image;190 string imagesHeight = _data.ImageHeight == 0 ? "auto" : _data.ImageHeight.ToString() + "px";191 string ImageContainerFixed = hasContent ? "cta-paragraph__image-container--fixed" : "";192 string ImageAsBackground = (column.BackgroundConfiguration.ConfigurationName == "Image as Background") ? "cta-paragraph__image--is-background" : "";193194 string coverImage = "";195196 string figureHeight = !hasContent ? "flex-grow:1" : "height:" + imagesHeight;197 string TempClass = imagesOnlyBool ? "imageOnly" : "hasContent";198 string ImageOnlyImageHeight = imagesOnlyBool ? "height:" + imagesHeight + ";" : "height:auto;";199200 if (!imagesOnlyBool)201 {202 imagesHeight = hasContent ? imagesHeight : imagesHeight = "100%";203 }204205 /*This is work around created by Alla to enable cover mode for stand alone pictures*/206 if (!hasContent && column.Image.BackgroundSize == "bg-cover")207 {208 coverImage = "height:100%;";209 }210211 <div class="carousel-cell-wrap" style="display: flex; min-height:100%; @ImageOnlyImageHeight width: @flexBasis; @coverImage">212213 <section class="cta-paragraph carousel-cell" style="min-height: @imagesHeight; @ImageOnlyImageHeight">214 @{215 string newWindow = column.Button.NewWindow ? "target='_blank'" : "";216217 bool clickableBlock = !string.IsNullOrWhiteSpace(column.Button.ButtonLink) && _data.Clickable;218 string clickableClass = clickableBlock ? "cta-paragraph__container--clickable" : "";219220 double ColumnAmount = colDisplay;221 double ColumnWidthSize = 1/ColumnAmount;222 }223224 @CTAParagraphImage(225 column.Image,226 false,227 null,228 false,229 _data.Fullwidth,230 imagesHeight,231 ColumnWidthSize232 )233 @CTAParagraphContent(234 column.Header,235 null,236 column.Content,237 column.Button,238 column.Image,239 false240 )241242 @if (clickableBlock)243 {244 <a href="@column.Button.ButtonLink" class="cta-paragraph__clickable" @newWindow></a>245 }246 </section>247248 </div>249 }250 </section>251 }252 else if (colDisplay > amountColumns)253 {254 <div>Error: you cant display columns more than you filled in the backend</div>255 }256 }257258 @functions{259 // Check if this carousel contains only images (logo slider)260 bool checkOnlyImages(Carousel _data)261 {262263 int amountColumns = _data.CarouselItems.Count; // Amount of the columns in backend, filled by user264 int emptyColumn = 0;265266 // Loop through all the columns267 foreach (var column in _data.CarouselItems)268 {269 // If button is empty AND content is empty AND header is empty => this is img only270 if (string.IsNullOrWhiteSpace(column.Button.ButtonText) && string.IsNullOrWhiteSpace(column.Content.Text) && string.IsNullOrWhiteSpace(column.Header.HeaderFormatted()))271 {272 emptyColumn++;273 }274 }275276 bool emptyColumnResult = emptyColumn == amountColumns ? true : false;277278 return emptyColumnResult;279280 }281 }282
Naar boven