Resultater
Hedeselskabet er en erhvervsdrivende fond og skal bl.a. sikre et stærkt forretningsmæssigt grundlag gennem stabil, lønsom vækst. Samtidig giver vi en del af vores overskud tilbage til naturen. Hedeselskabet investerer primært i innovative, kommercielle løsninger, der kan fremme samfundets udvikling af gode natur- og miljøløsninger, samt til formål til gavn og glæde for naturen og samfundet.
Hedeselskabet har bl.a. støttet ...
- Dokumentation og formidling af stenrev (Als)
- Mad Til Milliarder – Fra havet
- Bekæmpelse af svampen Neonectria, der angriber ædelgran
- Grønt frium ved Københavns Universitet
- Snoezel- og sansehaver ved Landsbyen Sølund
- Rekreativt skovområde ved Holstebro
- Udvikling af minivådområder
- Den første firmaskov i Danmark
- Uderum ved Veteranhjem Odense
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Dalgas_Table.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using System 2 @using System.Collections.Generic 3 @using System.Linq 4 @using Dynamicweb.Content 5 @using Dynamicweb.Frontend 6 @using Dalgas.Custom.Services 7 @using Dynamicweb.Core.Json 8 @using Dynamicweb.Ecommerce.ProductCatalog 9 @using Dynamicweb.Indexing.Querying 10 @using Dynamicweb.Indexing.Querying.Faceting 11 @using Dynamicweb.Indexing.Querying.Sorting 12 @using Dynamicweb.Modules 13 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 14 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 15 16 @using System 17 @using System.Collections.Generic 18 @using System.Linq 19 @using Dalgas.Custom.ViewModels.UI 20 @using Dynamicweb.Content 21 @using Dynamicweb.Ecommerce.ProductCatalog 22 @using Dynamicweb.Frontend 23 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 24 25 @*TODO: Move these functions onto the model *@ 26 27 @functions 28 { 29 30 public string GetSectionClassList(GridRowViewModel model, string overwriteTheme = "") 31 { 32 var returnValues = new List<string> 33 { 34 $"item_{model.Item.SystemName.ToLower()}" 35 }; 36 37 if (Services.Grids.GetGridRowById(model.Id).Sort == 1) 38 { 39 returnValues.Add("dalgas-section-first-on-page"); 40 } 41 42 var sectionBackgroundTheme = model.Item.GetItem("ColorScheme")?.GetString("ColorScheme") ?? string.Empty; 43 44 if (!string.IsNullOrEmpty(overwriteTheme)) 45 { 46 sectionBackgroundTheme = overwriteTheme; 47 } 48 49 // Add theme class if it exists 50 if (!string.IsNullOrWhiteSpace(sectionBackgroundTheme)) 51 { 52 if (sectionBackgroundTheme.Contains("default")) 53 { 54 returnValues.Add("theme theme-light"); 55 } 56 else 57 { 58 returnValues.Add($"theme {sectionBackgroundTheme.Replace(" ", "").Trim().ToLower()}"); 59 } 60 } 61 62 // Determine if top padding should be removed 63 64 string removeTopPadding = model.Item.GetItem("ColorScheme")?.GetString("RemoveTopPadding"); 65 66 returnValues.Add("pb-6"); 67 if (removeTopPadding != "enable") 68 { 69 returnValues.Add("pt-6"); 70 } 71 72 return string.Join(" ", returnValues); 73 } 74 75 } 76 77 78 @{ 79 IEnumerable<HeadingViewModel> headings = ParagraphService.Instance.GetHeadingsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Headings")); 80 string text = Model.Item.GetItem("Paragraph_Text")?.GetString("Text"); 81 string lead = Model.Item.GetItem("Paragraph_Text")?.GetString("Lead"); 82 IEnumerable<ButtonViewModel> buttons = ParagraphService.Instance.GetButtonsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Buttons")); 83 84 bool hasImage = Model.Item.GetItem("Paragraph_Image")?.GetFile("Image") != null; 85 bool hasText = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Text")); 86 bool hasLead = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Lead")); 87 bool hasHeading = headings.Any(); 88 bool hasButton = buttons.Any(); 89 90 var theme = Model.Item.GetItem("ColorScheme")?.GetString("ColorScheme"); 91 var fifthElementTheme = "fifth-element-color-" + Model.Item?.GetItem("ColorScheme")?.GetString("FifthElementColor"); 92 93 var sectionClassList = GetSectionClassList(Model); 94 95 var image = string.Empty; 96 var imageParameters = new Dictionary<string, object>(); 97 98 string layout = string.Empty; 99 Boolean enableFifthElement = false; 100 if (Model?.Item != null) 101 { 102 var paragraphLayout = Model.Item.GetItem("Paragraph_Layout"); 103 104 if (paragraphLayout != null) 105 { 106 layout = paragraphLayout.GetString("Layout"); 107 108 enableFifthElement = !string.IsNullOrEmpty(paragraphLayout.GetString("Layout_FifthElement")); 109 } 110 } 111 112 if (!string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Image")?.GetFile("Image")?.Path)) 113 { 114 image = Model.Item.GetItem("Paragraph_Image").GetFile("Image").Path; 115 imageParameters.Add("alt", Model.Item.GetItem("Paragraph_Image")?.GetString("ImageAltText")); 116 int xPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromLeft ?? 50; 117 int yPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromTop ?? 50; 118 string cssPosition = $"{xPos}% {yPos}%"; 119 imageParameters.Add("style", "object-position:" + cssPosition); 120 } 121 122 LinkViewModel imageLink = new LinkViewModel(); 123 if (Model.Item?.GetItem("Paragraph_Image")?.GetItem("Link") != null && !string.IsNullOrEmpty(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link").GetString("ButtonLink"))) 124 { 125 imageLink = ParagraphService.Instance.GetLinkByItem(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link")); 126 } 127 128 string fifthElementIconPath = "/Files/Templates/Designs/Swift/Assets/Images/DalgasFifthElements/"; 129 } 130 131 132 @{ 133 } 134 135 <section id="section-@Model.Id" class="@sectionClassList" data-swift-gridrow> 136 <div class=""> 137 138 @if (!string.IsNullOrEmpty(Model.Item.GetItem("Content").GetString("Table"))) 139 { 140 <div class="container-xl"> 141 <div class="row"> 142 <div class="col-12 col-lg-10 mx-auto"> 143 <div class="row"> 144 145 <div class="col-12"> 146 147 @if (!string.IsNullOrEmpty(Model.Item.GetItem("Content").GetString("Header"))) 148 { 149 <h2 class="mb-4">@Model.Item.GetItem("Content").GetString("Header")</h2> 150 } 151 152 <div class="table-responsive"> 153 @Model.Item.GetItem("Content").GetString("Table") 154 </div> 155 </div> 156 </div> 157 </div> 158 </div> 159 </div> 160 } 161 else 162 { 163 if (Pageview.IsVisualEditorMode) 164 { 165 <div class="container-xl alert alert-danger" role="alert"> 166 This <strong>@Model.Item.SystemName</strong> is empty 167 </div> 168 } 169 } 170 </div> 171 </section> 172
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Dalgas_Accordion.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using System 2 @using System.Collections.Generic 3 @using System.Linq 4 @using Dynamicweb.Content 5 @using Dynamicweb.Frontend 6 @using Dalgas.Custom.Services 7 @using Dalgas.Custom.ViewModels.UI 8 @using Dynamicweb.Core.Json 9 @using Dynamicweb.Ecommerce.ProductCatalog 10 @using Dynamicweb.Indexing.Querying 11 @using Dynamicweb.Indexing.Querying.Faceting 12 @using Dynamicweb.Indexing.Querying.Sorting 13 @using Dynamicweb.Modules 14 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 15 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 16 17 @using System 18 @using System.Collections.Generic 19 @using System.Linq 20 @using Dalgas.Custom.ViewModels.UI 21 @using Dynamicweb.Content 22 @using Dynamicweb.Ecommerce.ProductCatalog 23 @using Dynamicweb.Frontend 24 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 25 26 @*TODO: Move these functions onto the model *@ 27 28 @functions 29 { 30 31 public string GetSectionClassList(GridRowViewModel model, string overwriteTheme = "") 32 { 33 var returnValues = new List<string> 34 { 35 $"item_{model.Item.SystemName.ToLower()}" 36 }; 37 38 if (Services.Grids.GetGridRowById(model.Id).Sort == 1) 39 { 40 returnValues.Add("dalgas-section-first-on-page"); 41 } 42 43 var sectionBackgroundTheme = model.Item.GetItem("ColorScheme")?.GetString("ColorScheme") ?? string.Empty; 44 45 if (!string.IsNullOrEmpty(overwriteTheme)) 46 { 47 sectionBackgroundTheme = overwriteTheme; 48 } 49 50 // Add theme class if it exists 51 if (!string.IsNullOrWhiteSpace(sectionBackgroundTheme)) 52 { 53 if (sectionBackgroundTheme.Contains("default")) 54 { 55 returnValues.Add("theme theme-light"); 56 } 57 else 58 { 59 returnValues.Add($"theme {sectionBackgroundTheme.Replace(" ", "").Trim().ToLower()}"); 60 } 61 } 62 63 // Determine if top padding should be removed 64 65 string removeTopPadding = model.Item.GetItem("ColorScheme")?.GetString("RemoveTopPadding"); 66 67 returnValues.Add("pb-6"); 68 if (removeTopPadding != "enable") 69 { 70 returnValues.Add("pt-6"); 71 } 72 73 return string.Join(" ", returnValues); 74 } 75 76 } 77 78 79 @{ 80 IEnumerable<HeadingViewModel> headings = ParagraphService.Instance.GetHeadingsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Headings")); 81 string text = Model.Item.GetItem("Paragraph_Text")?.GetString("Text"); 82 string lead = Model.Item.GetItem("Paragraph_Text")?.GetString("Lead"); 83 IEnumerable<ButtonViewModel> buttons = ParagraphService.Instance.GetButtonsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Buttons")); 84 85 bool hasImage = Model.Item.GetItem("Paragraph_Image")?.GetFile("Image") != null; 86 bool hasText = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Text")); 87 bool hasLead = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Lead")); 88 bool hasHeading = headings.Any(); 89 bool hasButton = buttons.Any(); 90 91 var theme = Model.Item.GetItem("ColorScheme")?.GetString("ColorScheme"); 92 var fifthElementTheme = "fifth-element-color-" + Model.Item?.GetItem("ColorScheme")?.GetString("FifthElementColor"); 93 94 var sectionClassList = GetSectionClassList(Model); 95 96 var image = string.Empty; 97 var imageParameters = new Dictionary<string, object>(); 98 99 string layout = string.Empty; 100 Boolean enableFifthElement = false; 101 if (Model?.Item != null) 102 { 103 var paragraphLayout = Model.Item.GetItem("Paragraph_Layout"); 104 105 if (paragraphLayout != null) 106 { 107 layout = paragraphLayout.GetString("Layout"); 108 109 enableFifthElement = !string.IsNullOrEmpty(paragraphLayout.GetString("Layout_FifthElement")); 110 } 111 } 112 113 if (!string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Image")?.GetFile("Image")?.Path)) 114 { 115 image = Model.Item.GetItem("Paragraph_Image").GetFile("Image").Path; 116 imageParameters.Add("alt", Model.Item.GetItem("Paragraph_Image")?.GetString("ImageAltText")); 117 int xPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromLeft ?? 50; 118 int yPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromTop ?? 50; 119 string cssPosition = $"{xPos}% {yPos}%"; 120 imageParameters.Add("style", "object-position:" + cssPosition); 121 } 122 123 LinkViewModel imageLink = new LinkViewModel(); 124 if (Model.Item?.GetItem("Paragraph_Image")?.GetItem("Link") != null && !string.IsNullOrEmpty(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link").GetString("ButtonLink"))) 125 { 126 imageLink = ParagraphService.Instance.GetLinkByItem(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link")); 127 } 128 129 string fifthElementIconPath = "/Files/Templates/Designs/Swift/Assets/Images/DalgasFifthElements/"; 130 } 131 132 133 @{ 134 IList<ItemViewModel> accordionItems = Model.Item?.GetItem("Content")?.GetItems("ContentType") ?? Enumerable.Empty<ItemViewModel>().ToList(); 135 ClassList columnClassList = new ClassList(""); 136 ClassList accordionTextClassList = new ClassList(""); 137 ClassList rowClassList = new ClassList("justify-content-between"); 138 string headingSize = "h2"; 139 if (layout == "image-left") 140 { 141 rowClassList.Add("flex-row-reverse"); 142 } 143 144 if (hasImage) 145 { 146 headingSize = "h3"; 147 columnClassList.Add("col-md-5 mb-6 mb-md-0"); 148 } 149 else 150 { 151 accordionTextClassList.Add("col-lg-8 lh-base"); 152 } 153 } 154 155 <section id="section-@Model.Id" class="@sectionClassList" data-swift-gridrow> 156 <div class=""> 157 158 @if (accordionItems.Count > 0) 159 { 160 <div class="container-xl"> 161 <div class="row"> 162 <div class="col-12 col-lg-10 mx-auto"> 163 <div class="row @rowClassList"> 164 165 <div class="col-12 @columnClassList content-container"> 166 <div class="@(hasImage ? "p-txt-container" : "") accordion accordion-flush item_@Model.Item.SystemName.ToLower()" id="accordion-@Model.Id"> 167 @if (!string.IsNullOrEmpty(Model.Item.GetItem("Content").GetString("Heading"))) 168 { 169 string headingLevelStart = $"<{headingSize} class=\"mb-5\">"; 170 string headingLevelStop = $"</{headingSize}>"; 171 @headingLevelStart 172 @Model.Item.GetItem("Content").GetString("Heading") 173 @headingLevelStop 174 } 175 <p class="lead col-12 col-lg-8 mb-5">@Model.Item.GetItem("Content").GetRawValueString("Introduction")</p> 176 @foreach (var item in accordionItems) 177 { 178 IEnumerable<ButtonViewModel> accordionItemButtons = ParagraphService.Instance.GetButtonsByItems(item.GetItems("Buttons")); 179 180 <div class="accordion-item"> 181 <h4 class="accordion-header" id="heading-@Model.Id-@item.Id"> 182 <button class="accordion-button collapsed h4 m-0 px-0 py-3 my-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-@Model.Id-@item.Id" aria-expanded="false" aria-controls="collapse-@Model.Id-@item.Id" style="box-shadow: none"> 183 <span class="@accordionTextClassList"> 184 @item.GetString("Heading") 185 </span> 186 </button> 187 </h4> 188 189 <div id="collapse-@Model.Id-@item.Id" class="accordion-collapse collapse" aria-labelledby="heading-@Model.Id-@item.Id" data-bs-parent="#accordion-@Model.Id"> 190 <div class="accordion-body px-0 pb-4 pt-0 mb-0-last-child @accordionTextClassList"> 191 <div> 192 @item.GetRawValueString("Text") 193 </div> 194 195 @if (accordionItemButtons.Any()) 196 { 197 <div class="d-flex flex-wrap gap-3 mb-4"> 198 @string.Join("", accordionItemButtons.Select(h => h.ToString())) 199 </div> 200 } 201 202 <figure class="d-flex flex-column"> 203 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = item.GetRawValueString("Image")}) 204 </figure> 205 </div> 206 </div> 207 </div> 208 } 209 <div id="@Model.Id" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 210 </div> 211 212 </div> 213 @if (hasImage) 214 { 215 <div class="col-12 col-md-6"> 216 <figure class="ratio ratio-1x1"> 217 @if (imageLink != null && !string.IsNullOrEmpty(imageLink.Url)) 218 { 219 <a href="@imageLink.Url"> 220 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = image}, imageParameters) 221 </a> 222 } 223 else 224 { 225 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = image}, imageParameters) 226 } 227 </figure> 228 </div> 229 } 230 </div> 231 </div> 232 </div> 233 </div> 234 } 235 else 236 { 237 if (Pageview.IsVisualEditorMode) 238 { 239 <div class="container-xl alert alert-danger" role="alert"> 240 This <strong>@Model.Item.SystemName</strong> is empty 241 </div> 242 } 243 } 244 </div> 245 </section> 246
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Dalgas_Accordion.cshtml" System.IO.IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32 count) at System.IO.FileStream.FlushWrite(Boolean calledFromFinalizer) at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at RazorEngine.Roslyn.CSharp.RoslynCompilerServiceBase.CompileType(TypeContext context) at RazorEngine.Templating.RazorEngineCore.CreateTemplateType(ITemplateSource razorTemplate, Type modelType) at RazorEngine.Templating.RazorEngineCore.Compile(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType) at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss) at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag) at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer) at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter) at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template) at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template) at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using System 2 @using System.Collections.Generic 3 @using System.Linq 4 @using Dynamicweb.Content 5 @using Dynamicweb.Frontend 6 @using Dalgas.Custom.Services 7 @using Dalgas.Custom.ViewModels.UI 8 @using Dynamicweb.Core.Json 9 @using Dynamicweb.Ecommerce.ProductCatalog 10 @using Dynamicweb.Indexing.Querying 11 @using Dynamicweb.Indexing.Querying.Faceting 12 @using Dynamicweb.Indexing.Querying.Sorting 13 @using Dynamicweb.Modules 14 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 15 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 16 17 @using System 18 @using System.Collections.Generic 19 @using System.Linq 20 @using Dalgas.Custom.ViewModels.UI 21 @using Dynamicweb.Content 22 @using Dynamicweb.Ecommerce.ProductCatalog 23 @using Dynamicweb.Frontend 24 @using ParagraphService = Dalgas.Custom.Services.ParagraphService 25 26 @*TODO: Move these functions onto the model *@ 27 28 @functions 29 { 30 31 public string GetSectionClassList(GridRowViewModel model, string overwriteTheme = "") 32 { 33 var returnValues = new List<string> 34 { 35 $"item_{model.Item.SystemName.ToLower()}" 36 }; 37 38 if (Services.Grids.GetGridRowById(model.Id).Sort == 1) 39 { 40 returnValues.Add("dalgas-section-first-on-page"); 41 } 42 43 var sectionBackgroundTheme = model.Item.GetItem("ColorScheme")?.GetString("ColorScheme") ?? string.Empty; 44 45 if (!string.IsNullOrEmpty(overwriteTheme)) 46 { 47 sectionBackgroundTheme = overwriteTheme; 48 } 49 50 // Add theme class if it exists 51 if (!string.IsNullOrWhiteSpace(sectionBackgroundTheme)) 52 { 53 if (sectionBackgroundTheme.Contains("default")) 54 { 55 returnValues.Add("theme theme-light"); 56 } 57 else 58 { 59 returnValues.Add($"theme {sectionBackgroundTheme.Replace(" ", "").Trim().ToLower()}"); 60 } 61 } 62 63 // Determine if top padding should be removed 64 65 string removeTopPadding = model.Item.GetItem("ColorScheme")?.GetString("RemoveTopPadding"); 66 67 returnValues.Add("pb-6"); 68 if (removeTopPadding != "enable") 69 { 70 returnValues.Add("pt-6"); 71 } 72 73 return string.Join(" ", returnValues); 74 } 75 76 } 77 78 79 @{ 80 IEnumerable<HeadingViewModel> headings = ParagraphService.Instance.GetHeadingsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Headings")); 81 string text = Model.Item.GetItem("Paragraph_Text")?.GetString("Text"); 82 string lead = Model.Item.GetItem("Paragraph_Text")?.GetString("Lead"); 83 IEnumerable<ButtonViewModel> buttons = ParagraphService.Instance.GetButtonsByItems(Model.Item?.GetItem("Paragraph_Text")?.GetItems("Buttons")); 84 85 bool hasImage = Model.Item.GetItem("Paragraph_Image")?.GetFile("Image") != null; 86 bool hasText = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Text")); 87 bool hasLead = !string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Text")?.GetString("Lead")); 88 bool hasHeading = headings.Any(); 89 bool hasButton = buttons.Any(); 90 91 var theme = Model.Item.GetItem("ColorScheme")?.GetString("ColorScheme"); 92 var fifthElementTheme = "fifth-element-color-" + Model.Item?.GetItem("ColorScheme")?.GetString("FifthElementColor"); 93 94 var sectionClassList = GetSectionClassList(Model); 95 96 var image = string.Empty; 97 var imageParameters = new Dictionary<string, object>(); 98 99 string layout = string.Empty; 100 Boolean enableFifthElement = false; 101 if (Model?.Item != null) 102 { 103 var paragraphLayout = Model.Item.GetItem("Paragraph_Layout"); 104 105 if (paragraphLayout != null) 106 { 107 layout = paragraphLayout.GetString("Layout"); 108 109 enableFifthElement = !string.IsNullOrEmpty(paragraphLayout.GetString("Layout_FifthElement")); 110 } 111 } 112 113 if (!string.IsNullOrEmpty(Model.Item?.GetItem("Paragraph_Image")?.GetFile("Image")?.Path)) 114 { 115 image = Model.Item.GetItem("Paragraph_Image").GetFile("Image").Path; 116 imageParameters.Add("alt", Model.Item.GetItem("Paragraph_Image")?.GetString("ImageAltText")); 117 int xPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromLeft ?? 50; 118 int yPos = Model.Item.GetItem("Paragraph_Image").GetFile("Image")?.FocalPositionFromTop ?? 50; 119 string cssPosition = $"{xPos}% {yPos}%"; 120 imageParameters.Add("style", "object-position:" + cssPosition); 121 } 122 123 LinkViewModel imageLink = new LinkViewModel(); 124 if (Model.Item?.GetItem("Paragraph_Image")?.GetItem("Link") != null && !string.IsNullOrEmpty(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link").GetString("ButtonLink"))) 125 { 126 imageLink = ParagraphService.Instance.GetLinkByItem(Model?.Item?.GetItem("Paragraph_Image")?.GetItem("Link")); 127 } 128 129 string fifthElementIconPath = "/Files/Templates/Designs/Swift/Assets/Images/DalgasFifthElements/"; 130 } 131 132 133 @{ 134 IList<ItemViewModel> accordionItems = Model.Item?.GetItem("Content")?.GetItems("ContentType") ?? Enumerable.Empty<ItemViewModel>().ToList(); 135 ClassList columnClassList = new ClassList(""); 136 ClassList accordionTextClassList = new ClassList(""); 137 ClassList rowClassList = new ClassList("justify-content-between"); 138 string headingSize = "h2"; 139 if (layout == "image-left") 140 { 141 rowClassList.Add("flex-row-reverse"); 142 } 143 144 if (hasImage) 145 { 146 headingSize = "h3"; 147 columnClassList.Add("col-md-5 mb-6 mb-md-0"); 148 } 149 else 150 { 151 accordionTextClassList.Add("col-lg-8 lh-base"); 152 } 153 } 154 155 <section id="section-@Model.Id" class="@sectionClassList" data-swift-gridrow> 156 <div class=""> 157 158 @if (accordionItems.Count > 0) 159 { 160 <div class="container-xl"> 161 <div class="row"> 162 <div class="col-12 col-lg-10 mx-auto"> 163 <div class="row @rowClassList"> 164 165 <div class="col-12 @columnClassList content-container"> 166 <div class="@(hasImage ? "p-txt-container" : "") accordion accordion-flush item_@Model.Item.SystemName.ToLower()" id="accordion-@Model.Id"> 167 @if (!string.IsNullOrEmpty(Model.Item.GetItem("Content").GetString("Heading"))) 168 { 169 string headingLevelStart = $"<{headingSize} class=\"mb-5\">"; 170 string headingLevelStop = $"</{headingSize}>"; 171 @headingLevelStart 172 @Model.Item.GetItem("Content").GetString("Heading") 173 @headingLevelStop 174 } 175 <p class="lead col-12 col-lg-8 mb-5">@Model.Item.GetItem("Content").GetRawValueString("Introduction")</p> 176 @foreach (var item in accordionItems) 177 { 178 IEnumerable<ButtonViewModel> accordionItemButtons = ParagraphService.Instance.GetButtonsByItems(item.GetItems("Buttons")); 179 180 <div class="accordion-item"> 181 <h4 class="accordion-header" id="heading-@Model.Id-@item.Id"> 182 <button class="accordion-button collapsed h4 m-0 px-0 py-3 my-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-@Model.Id-@item.Id" aria-expanded="false" aria-controls="collapse-@Model.Id-@item.Id" style="box-shadow: none"> 183 <span class="@accordionTextClassList"> 184 @item.GetString("Heading") 185 </span> 186 </button> 187 </h4> 188 189 <div id="collapse-@Model.Id-@item.Id" class="accordion-collapse collapse" aria-labelledby="heading-@Model.Id-@item.Id" data-bs-parent="#accordion-@Model.Id"> 190 <div class="accordion-body px-0 pb-4 pt-0 mb-0-last-child @accordionTextClassList"> 191 <div> 192 @item.GetRawValueString("Text") 193 </div> 194 195 @if (accordionItemButtons.Any()) 196 { 197 <div class="d-flex flex-wrap gap-3 mb-4"> 198 @string.Join("", accordionItemButtons.Select(h => h.ToString())) 199 </div> 200 } 201 202 <figure class="d-flex flex-column"> 203 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = item.GetRawValueString("Image")}) 204 </figure> 205 </div> 206 </div> 207 </div> 208 } 209 <div id="@Model.Id" class="user-select-none position-absolute top-0" style="scroll-margin-top:var(--header-height,150px)"></div> 210 </div> 211 212 </div> 213 @if (hasImage) 214 { 215 <div class="col-12 col-md-6"> 216 <figure class="ratio ratio-1x1"> 217 @if (imageLink != null && !string.IsNullOrEmpty(imageLink.Url)) 218 { 219 <a href="@imageLink.Url"> 220 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = image}, imageParameters) 221 </a> 222 } 223 else 224 { 225 @RenderPartial("Components/Image.cshtml", new FileViewModel {Path = image}, imageParameters) 226 } 227 </figure> 228 </div> 229 } 230 </div> 231 </div> 232 </div> 233 </div> 234 } 235 else 236 { 237 if (Pageview.IsVisualEditorMode) 238 { 239 <div class="container-xl alert alert-danger" role="alert"> 240 This <strong>@Model.Item.SystemName</strong> is empty 241 </div> 242 } 243 } 244 </div> 245 </section> 246