Kontakt

Har du spørgsmål til Hedeselskabet eller vores relaterede aktiviteter, er du velkommen til at kontakte os.

Hedeselskabet

Det danske Hedeselskab A/S
Klostermarken 12
DK-8800 Viborg

CVR 42344613

+45 87 28 10 00

Bankforbindelse: Nordea 
Kontonummer: 2783-4371450713

Har du spørgsmål til Hedeselskabet generelt, bedes du skrive til Hedeselskabets infomail: info@hedeselskabet.dk

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_Contact.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 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 2 @using System 3 @using System.Collections.Generic 4 @using System.Linq 5 @using System.Text.RegularExpressions 6 @using Dalgas.Custom.Extensions 7 @using Dalgas.Custom.Models.Content 8 @using Dalgas.Custom.Services 9 @using Dalgas.Custom.ViewModels.UI 10 @using Dynamicweb.Core.Encoders 11 @using Dynamicweb.Core.Json 12 @using Dynamicweb.Ecommerce.ProductCatalog 13 @using Dynamicweb.Frontend 14 @using Dynamicweb.Security.UserManagement 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 QueryResult queryResult = new QueryResult(); 134 int numberOfPersons = Convert.ToInt32(Model.Item.GetItem("Paragraph_Layout").GetString("NumberOfPersons")); 135 bool showForm = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowForm"); 136 bool showFacets = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowFacets"); 137 bool showSearch = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowSearch"); 138 139 string cardInformationLayout = Model.Item.GetItem("Paragraph_Layout").GetString("Layout"); 140 141 bool allowAllQueryItems = showFacets || showSearch; 142 int formParagraphId = Pageview.AreaSettings.GetLink("FormGetContacted").PageId; 143 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 144 145 string formType = Model.Item.GetItem("Paragraph_Layout").GetString("FormType"); //Default or Microsoft 146 string formBlockId = Model.Item.GetItem("Paragraph_Layout").GetString("FormId"); // Microsoft form 147 string formContainerId = Model.Item.GetItem("Paragraph_Layout").GetString("ContainerId"); // Microsoft form 148 149 ButtonViewModel btnOpenForm = new ButtonViewModel 150 { 151 Id = "formParagraphId_" + formParagraphId, 152 Text = Translate("Contact me"), 153 Type = ButtonType.Button, 154 DisplayType = ButtonDisplayType.Primary, 155 Classes = new ClassList("js-show-paragraph-form") 156 }; 157 158 IList<UserViewModel> contactPersonListItems = Model.Item?.GetItem("Paragraph_Layout")?.GetUsers("ContactPersonSelector") ?? Enumerable.Empty<UserViewModel>().ToList(); 159 bool hasContactPersonListItems = contactPersonListItems.Any(); 160 List<User> users = new List<User>(); 161 List<string> userIds = new List<string>(); 162 163 if (hasContactPersonListItems) 164 { 165 userIds.AddRange(contactPersonListItems.Select(cp => cp.ID.ToString())); 166 allowAllQueryItems = false; 167 showFacets = false; 168 showSearch = false; 169 } 170 else 171 { 172 if (showFacets) 173 { 174 numberOfPersons = 12; 175 queryResult = ContentRelationService.Instance.GetAllContacts(numberOfPersons); 176 } 177 else 178 { 179 queryResult = ContentRelationService.Instance.GetRelatedContactsByCurrentPage(numberOfPersons); 180 } 181 182 userIds.AddRange(queryResult.Results.Select(qrr => qrr["UserID"]?.ToString())); 183 } 184 185 bool showPersons = Model.Item.GetItem("Paragraph_Layout").GetBoolean("showPersons") && userIds.Any(); 186 int pageNum = int.TryParse(Dynamicweb.Context.Current.Request["PageNum"], out int pageNumResult) ? pageNumResult : 1; 187 string searchTerm = Dynamicweb.Context.Current.Request["q"]; 188 List<FacetOption> selectedFacetOptions = new List<FacetOption>(); 189 int totaleCount = 0; 190 bool enableShowZeroResultMsg = true; 191 192 bool showAlternativeLayout = false; 193 194 if (showFacets && showSearch || showPersons && numberOfPersons >= 2 && userIds.Count >= 2 && showForm || showPersons && numberOfPersons >= 3 && userIds.Count >= 3 && !showForm) 195 { 196 showAlternativeLayout = true; 197 } 198 } 199 200 201 @if (queryResult.FacetGroups.Any() || hasContactPersonListItems || showForm) 202 { 203 <section id="section-@Model.Id" class="@sectionClassList item_@Model.Item.SystemName.ToLower()" data-swift-gridrow> 204 <div class=""> 205 206 <div class="container-xl"> 207 <div class="row justify-content-center"> 208 <div class="col-12"> 209 <div class="row"> 210 211 <div 212 class="col-12 @(showAlternativeLayout ? "flex-column flex-lg-row mb-5" : "col-lg-4 flex-column") d-flex justify-content-between"> 213 <div 214 class="js-content-container content-container col-12 @(showAlternativeLayout ? "col-lg-5" : string.Empty)"> 215 216 <span> 217 @string.Join("", headings.Select(h => h.ToString())) 218 </span> 219 220 @if (!string.IsNullOrEmpty(lead)) 221 { 222 <p class="lead">@lead</p> 223 } 224 225 @text 226 227 </div> 228 <div 229 class="js-content-container content-container @(showAlternativeLayout ? "col-lg-5 d-inline-flex justify-content-lg-end align-items-end" : string.Empty)"> 230 <div 231 class="d-flex flex-wrap gap-3 @(showAlternativeLayout ? "mb-4" : "mb-4 mb-lg-0")"> 232 @foreach (ButtonViewModel button in buttons) 233 { 234 @button 235 } 236 </div> 237 </div> 238 </div> 239 240 <div class="col"> 241 <div 242 class="position-relative g-4 js-card-person-container js-dalgas-queryresult-container" 243 id="@($"query-result-{Model.Id}")"> 244 245 @if (allowAllQueryItems) 246 { 247 totaleCount = queryResult.TotalCount; 248 } 249 250 <form method="post" action="@Pageview.SearchFriendlyUrl" 251 data-response-target-element="content" tabindex="-1" aria-hidden="false" 252 class="d-flex js-dalgas-facets-form dalgas-facets-form" 253 data-total-count="@totaleCount" data-page-size="@numberOfPersons"> 254 <input type="hidden" name="LayoutTemplate" 255 value="Designs/Swift/Swift_PageClean.cshtml"/> 256 <input type="hidden" name="PageNum" value="@pageNum"/> 257 @if (showFacets) 258 { 259 foreach (FacetGroup facetGroup in queryResult.FacetGroups) 260 { 261 foreach (Facet facet in facetGroup.Facets) 262 { 263 string showClass = " show"; 264 string ariaExpanded = "true"; 265 string facetGroupId = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", string.Empty); 266 267 268 if (facet.Options.Any()) 269 { 270 int selectedFacetsInGroup = 0; 271 272 foreach (FacetOption option in facet.Options) 273 { 274 if (option.Selected) 275 { 276 selectedFacetsInGroup++; 277 } 278 } 279 280 string label = selectedFacetsInGroup > 0 ? Translate(facet.Name) + "<span style=\"padding: 0.3em 0.6em\" class=\"badge ms-2\">" + selectedFacetsInGroup + "</span>" : Translate(facet.Name); 281 282 <div class="dropdown js-facets-selector"> 283 <button class="btn dropdown-toggle" type="button" 284 id="FacetGroup_@facetGroupId" 285 data-bs-toggle="dropdown" aria-expanded="false"> 286 @label 287 </button> 288 <div data-lenis-prevent class="dropdown-menu p-3" 289 aria-labelledby="FacetGroup_@facetGroupId" 290 style="min-width: 280px"> 291 @foreach (FacetOption facetOption in facet.Options.OrderBy(fo => fo.Label)) 292 { 293 string facetLabel = HtmlEncoder.HtmlEncode(facetOption.Label); 294 string disabled = facetOption.Count <= 0 ? "disabled" : string.Empty; 295 string selected = facetOption.Selected ? "checked" : string.Empty; 296 string facetValue = Uri.UnescapeDataString(facetOption.Value); 297 string optionValue = $"[{facetValue}]"; 298 299 facetLabel = facetLabel.ToLower() == "true" ? facetLabel = Translate("Yes") : facetLabel; 300 facetLabel = facetLabel.ToLower() == "false" ? facetLabel = Translate("No") : facetLabel; 301 302 <label class="form-check mt-1" @disabled> 303 <input type="checkbox" 304 onclick="window.onFacetChange(event)" 305 class="form-check-input" 306 name="@facet.QueryParameter" 307 value="@optionValue" 308 data-filter-value="@facetLabel" 309 @selected> 310 <span 311 class="form-check-label d-flex align-items-center"> 312 <span class="flex-fill">@facetLabel </span> 313 <small 314 class="opacity-85">@facetOption.Count</small> 315 </span> 316 </label> 317 318 if (facetOption.Selected) 319 { 320 FacetOption selectFacetOption = facetOption; 321 selectFacetOption.Name = facet.QueryParameter; 322 selectedFacetOptions.Add(selectFacetOption); 323 } 324 } 325 </div> 326 </div> 327 } 328 } 329 } 330 331 if (!string.IsNullOrEmpty(searchTerm)) 332 { 333 selectedFacetOptions.Add(new FacetOption() 334 { 335 Count = 1, 336 Label = searchTerm, 337 Name = "q", 338 Selected = true, 339 Value = searchTerm 340 }); 341 } 342 } 343 344 @if (showSearch) 345 { 346 <div class="type-ahead-dropdown"> 347 <div class="position-relative suggest-form"> 348 <span 349 class="position-absolute top-0 end-0 icon-3 px-3 d-flex align-items-center h-100 search-icon"> 350 @ReadFile(iconPath + "search.svg") 351 </span> 352 353 <input id="searchField_@Model.Id" 354 class="form-control custom-header-searchbar js-custom-facets-search-field pe-5 ps-3 js-" 355 type="search" 356 placeholder="@Translate("Enter postcode or name of person")" 357 autocomplete="off" 358 maxlength="255" 359 name="q" 360 minlength="3" 361 value="@searchTerm" 362 data-original="@searchTerm"> 363 364 <button type="button" 365 onclick="custom.QueryResult.clearSearchField(event)" 366 class="btn h-100 icon-2 reset-search" 367 aria-label="@Translate("Clear search")" 368 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;"> 369 @ReadFile(iconPath + "x.svg") 370 </button> 371 </div> 372 </div> 373 <input type="submit" onclick="custom.QueryResult.update(event)" 374 class="btn btn-primary col-md-2" 375 value="@Translate("Search", "Search")"> 376 } 377 </form> 378 379 @if (showFacets && selectedFacetOptions.Any()) 380 { 381 <div 382 class="mt-3 d-flex gap-3 mb-4 js-dalgas-queryresult-selectedfacets-container dalgas-queryresult-selectedfacets-container"> 383 @foreach (FacetOption facetOption in selectedFacetOptions) 384 { 385 string facetValue = Uri.UnescapeDataString(facetOption.Value); 386 string optionValue = $"[{facetValue}]"; 387 <input class="visually-hidden" 388 id="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)" 389 name="@facetOption.Name" 390 onclick="custom.QueryResult.deselectFacetOption(event)" 391 type="checkbox" value="@optionValue" title="@facetOption.Label" 392 checked> 393 <label class="badge theme border border-dark" 394 for="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)"> 395 <span class="text-nowrap">@(facetOption.Label)</span> 396 <span class="icon-2 ms-2"> 397 @ReadFile(iconPath + "x.svg") 398 </span> 399 </label> 400 } 401 402 @if (selectedFacetOptions.Count >= 3) 403 { 404 <input class="visually-hidden" id="ClearAll" name="ClearAll" 405 onclick="custom.QueryResult.clearAll(event)" type="checkbox" 406 value="" title="" checked> 407 <label class="badge text-nowrap dalgas-btn-clear-all" for="ClearAll"> 408 <span class="text-nowrap">@Translate("Clear all")</span> 409 <span class="icon-2 ms-2"> 410 @ReadFile(iconPath + "x.svg") 411 </span> 412 </label> 413 } 414 </div> 415 } 416 417 @if (showFacets && selectedFacetOptions.Any() == false && string.IsNullOrEmpty(searchTerm)) 418 { 419 enableShowZeroResultMsg = false; 420 userIds = new List<string>(); 421 } 422 423 @if (showFacets && enableShowZeroResultMsg && userIds.Any() == false) 424 { 425 <div class="mt-4">@Translate("Your search returned no results...")</div> 426 } 427 428 429 @if (showPersons && userIds.Any() || showPersons && hasContactPersonListItems) 430 { 431 <div 432 class="row @(showAlternativeLayout ? "g-4" : "mt-3") js-dalgas-queryresult-itemlist dalgas-queryresult-itemlist"> 433 434 @foreach (string userId in userIds) 435 { 436 if (!int.TryParse(userId, out int intUserId)) 437 { 438 continue; 439 } 440 441 //UserViewModel result = new UserViewModel(); 442 443 User result = User.GetUserByID(intUserId); 444 445 if (result == null) 446 { 447 continue; 448 } 449 450 UserViewModel resultViewModel = result.ToViewModel(); 451 452 <div 453 class="col-12 js-col-card-person col-lg @(showAlternativeLayout ? "col-lg-4" : "")"> 454 455 @{ 456 FileViewModel imageFile = ViewModelFactory.CreateFieldFileValueView(result.Image); 457 } 458 459 <div class="theme theme-light h-100"> 460 <div class="p-img-container d-flex"> 461 <figure 462 class="ratio ratio-1x1 @(!string.IsNullOrEmpty(result.Image) ? "has-image" : string.Empty)"> 463 @RenderPartial("Components/Image.cshtml", imageFile ?? new FileViewModel()) 464 </figure> 465 <figure class="ratio ratio-1x1"> 466 <span 467 class="fifth-element @fifthElementTheme opacity-50"> 468 @ReadFile(fifthElementIconPath + "canopy.svg") 469 </span> 470 </figure> 471 </div> 472 <div class="p-txt-container p-4 pt-5"> 473 <h4>@resultViewModel.Name</h4> 474 475 @if (cardInformationLayout == "title-and-description") 476 { 477 string linkedIn = resultViewModel.GetCustomFieldValue<string>("AccessUser_LinkedIn"); 478 479 <div class="small d-flex flex-column mb-3 opacity-75"> 480 <span>@resultViewModel.GetJobTitle()</span> 481 482 @if (!string.IsNullOrEmpty(linkedIn)) 483 { 484 <a href="@linkedIn" class="mt-1" 485 target="_blank">LinkedIn</a> 486 } 487 488 @if (!string.IsNullOrEmpty(resultViewModel.GetDescription())) 489 { 490 <span 491 class="mt-3">@resultViewModel.GetDescription()</span> 492 } 493 </div> 494 } 495 else 496 { 497 <div class="small d-flex flex-column mb-3 opacity-75"> 498 <span>@resultViewModel.GetJobTitle()</span> 499 <span>@Translate("Contact Department", "Afdeling"): @resultViewModel.GetDepartment()</span> 500 501 @if (resultViewModel.GetLocations().Any()) 502 { 503 <span> 504 <span>@Translate("Office", "Kontor"): </span> 505 @foreach (Location location in resultViewModel.GetLocations()) 506 { 507 <span>@location.Text</span> 508 } 509 </span> 510 } 511 512 <span>@resultViewModel.GetComment()</span> 513 </div> 514 515 516 if (!string.IsNullOrEmpty(resultViewModel.GetContactEmail())) 517 { 518 <div class="d-flex gap-3 small opacity-75"> 519 <span>E.</span> 520 <a style="font-size: 1em" 521 class="text-decoration-none" 522 href="mailto:@resultViewModel.GetContactEmail()">@resultViewModel.GetContactEmail().ToLower()</a> 523 </div> 524 } 525 526 if (!string.IsNullOrEmpty(resultViewModel.Phone)) 527 { 528 <div class="d-flex gap-3 small opacity-75"> 529 <span>T.</span> 530 <span>@resultViewModel.Phone</span> 531 </div> 532 } 533 } 534 </div> 535 </div> 536 537 </div> 538 } 539 @if (showForm) 540 { 541 <div class="col-12 js-col-card-person col-lg"> 542 543 <div class="h-100 contact-person-card js-contact-person-card"> 544 545 <div class="card-front theme theme-light "> 546 <div class="p-img-container d-none d-lg-flex"> 547 <figure class="ratio ratio-1x1"> 548 @* Empty space *@ 549 </figure> 550 <figure class="ratio ratio-1x1"> 551 <span 552 class="fifth-element @fifthElementTheme opacity-50"> 553 @ReadFile(fifthElementIconPath + "canopy.svg") 554 </span> 555 </figure> 556 </div> 557 <div class="p-txt-container p-4 pt-6"> 558 <h4>@Translate("Get Contacted")</h4> 559 560 <div class="small d-flex flex-column mb-3 opacity-75"> 561 @Translate("Dalgas - Get Contacted - Card Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo.") 562 </div> 563 564 @RenderModel(btnOpenForm) 565 </div> 566 </div> 567 <div class="card-back theme theme-light "> 568 569 @if (formParagraphId != null) 570 { 571 <div 572 class="contact-person-form-container js-contact-person-form-container theme p-4"> 573 574 575 @if (formType == "microsoft") 576 { 577 <div 578 class="js-remove-microsoft-form-styling microsoft-form-container"> 579 <script 580 src="https://cxppusa1formui01cdnsa01-endpoint.azureedge.net/eur/FormLoader/FormLoader.bundle.js" 581 crossorigin="anonymous" defer></script> 582 <div 583 data-cached-form-url="https://assets-eur.mkt.dynamics.com/@formBlockId/digitalassets/forms/@formContainerId" 584 data-form-api-url="https://public-eur.mkt.dynamics.com/api/v1.0/orgs/@formBlockId/landingpageforms" 585 data-form-id="@formContainerId"></div> 586 </div> 587 } 588 else 589 { 590 @RenderParagraphContent(formParagraphId) 591 } 592 593 594 </div> 595 } 596 597 </div> 598 599 </div> 600 </div> 601 } 602 </div> 603 604 if (allowAllQueryItems && totaleCount > numberOfPersons) 605 { 606 <div class="row mt-4"> 607 <div class="col-12 text-center"> 608 <button onclick="custom.QueryResult.getNextPage(event)" 609 class="btn btn-primary">@Translate("Vis flere")</button> 610 </div> 611 </div> 612 } 613 } 614 else 615 { 616 if (showForm) 617 { 618 <div class="col-12 col-lg"> 619 620 @if (formParagraphId != null) 621 { 622 if (formType == "microsoft") 623 { 624 if (Pageview.IsVisualEditorMode) 625 { 626 <div class="container-xl alert alert-danger" role="alert"> 627 <h4>Use the "Microsoft Form" Paragraph instead</h4> 628 <p>Due to technical limitations within Microsoft Form 629 Markup & Styling, we prefer that you use the 630 "Microsoft Form" item instead, when you have no 631 contact persons attatched this Contact 632 Paragraph.</p> 633 <p>We are showing the default form in the frontend.</p> 634 </div> 635 } 636 else 637 { 638 @RenderParagraphContent(formParagraphId) 639 } 640 } 641 else 642 { 643 @RenderParagraphContent(formParagraphId) 644 } 645 } 646 </div> 647 } 648 } 649 </div> 650 </div> 651 </div> 652 </div> 653 </div> 654 </div> 655 </div> 656 </section> 657 } 658 else 659 { 660 if (Pageview.IsVisualEditorMode) 661 { 662 <div class="container-xl alert alert-danger" role="alert"> 663 This <strong>@Model.Item.SystemName</strong> is empty 664 </div> 665 } 666 } 667 668 669 <script> 670 window.onFacetChange = (event) =>{ 671 custom.QueryResult.update(event); 672 window.dataLayer.push({ 673 event: 'contact_filter_change', 674 filter_name: event.target.name, 675 filter_value: event.target.value 676 }); 677 } 678 </script> 679
Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Dalgas_Contact.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 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 2 @using System 3 @using System.Collections.Generic 4 @using System.Linq 5 @using System.Text.RegularExpressions 6 @using Dalgas.Custom.Extensions 7 @using Dalgas.Custom.Models.Content 8 @using Dalgas.Custom.Services 9 @using Dalgas.Custom.ViewModels.UI 10 @using Dynamicweb.Core.Encoders 11 @using Dynamicweb.Core.Json 12 @using Dynamicweb.Ecommerce.ProductCatalog 13 @using Dynamicweb.Frontend 14 @using Dynamicweb.Security.UserManagement 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 QueryResult queryResult = new QueryResult(); 134 int numberOfPersons = Convert.ToInt32(Model.Item.GetItem("Paragraph_Layout").GetString("NumberOfPersons")); 135 bool showForm = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowForm"); 136 bool showFacets = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowFacets"); 137 bool showSearch = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowSearch"); 138 139 string cardInformationLayout = Model.Item.GetItem("Paragraph_Layout").GetString("Layout"); 140 141 bool allowAllQueryItems = showFacets || showSearch; 142 int formParagraphId = Pageview.AreaSettings.GetLink("FormGetContacted").PageId; 143 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 144 145 string formType = Model.Item.GetItem("Paragraph_Layout").GetString("FormType"); //Default or Microsoft 146 string formBlockId = Model.Item.GetItem("Paragraph_Layout").GetString("FormId"); // Microsoft form 147 string formContainerId = Model.Item.GetItem("Paragraph_Layout").GetString("ContainerId"); // Microsoft form 148 149 ButtonViewModel btnOpenForm = new ButtonViewModel 150 { 151 Id = "formParagraphId_" + formParagraphId, 152 Text = Translate("Contact me"), 153 Type = ButtonType.Button, 154 DisplayType = ButtonDisplayType.Primary, 155 Classes = new ClassList("js-show-paragraph-form") 156 }; 157 158 IList<UserViewModel> contactPersonListItems = Model.Item?.GetItem("Paragraph_Layout")?.GetUsers("ContactPersonSelector") ?? Enumerable.Empty<UserViewModel>().ToList(); 159 bool hasContactPersonListItems = contactPersonListItems.Any(); 160 List<User> users = new List<User>(); 161 List<string> userIds = new List<string>(); 162 163 if (hasContactPersonListItems) 164 { 165 userIds.AddRange(contactPersonListItems.Select(cp => cp.ID.ToString())); 166 allowAllQueryItems = false; 167 showFacets = false; 168 showSearch = false; 169 } 170 else 171 { 172 if (showFacets) 173 { 174 numberOfPersons = 12; 175 queryResult = ContentRelationService.Instance.GetAllContacts(numberOfPersons); 176 } 177 else 178 { 179 queryResult = ContentRelationService.Instance.GetRelatedContactsByCurrentPage(numberOfPersons); 180 } 181 182 userIds.AddRange(queryResult.Results.Select(qrr => qrr["UserID"]?.ToString())); 183 } 184 185 bool showPersons = Model.Item.GetItem("Paragraph_Layout").GetBoolean("showPersons") && userIds.Any(); 186 int pageNum = int.TryParse(Dynamicweb.Context.Current.Request["PageNum"], out int pageNumResult) ? pageNumResult : 1; 187 string searchTerm = Dynamicweb.Context.Current.Request["q"]; 188 List<FacetOption> selectedFacetOptions = new List<FacetOption>(); 189 int totaleCount = 0; 190 bool enableShowZeroResultMsg = true; 191 192 bool showAlternativeLayout = false; 193 194 if (showFacets && showSearch || showPersons && numberOfPersons >= 2 && userIds.Count >= 2 && showForm || showPersons && numberOfPersons >= 3 && userIds.Count >= 3 && !showForm) 195 { 196 showAlternativeLayout = true; 197 } 198 } 199 200 201 @if (queryResult.FacetGroups.Any() || hasContactPersonListItems || showForm) 202 { 203 <section id="section-@Model.Id" class="@sectionClassList item_@Model.Item.SystemName.ToLower()" data-swift-gridrow> 204 <div class=""> 205 206 <div class="container-xl"> 207 <div class="row justify-content-center"> 208 <div class="col-12"> 209 <div class="row"> 210 211 <div 212 class="col-12 @(showAlternativeLayout ? "flex-column flex-lg-row mb-5" : "col-lg-4 flex-column") d-flex justify-content-between"> 213 <div 214 class="js-content-container content-container col-12 @(showAlternativeLayout ? "col-lg-5" : string.Empty)"> 215 216 <span> 217 @string.Join("", headings.Select(h => h.ToString())) 218 </span> 219 220 @if (!string.IsNullOrEmpty(lead)) 221 { 222 <p class="lead">@lead</p> 223 } 224 225 @text 226 227 </div> 228 <div 229 class="js-content-container content-container @(showAlternativeLayout ? "col-lg-5 d-inline-flex justify-content-lg-end align-items-end" : string.Empty)"> 230 <div 231 class="d-flex flex-wrap gap-3 @(showAlternativeLayout ? "mb-4" : "mb-4 mb-lg-0")"> 232 @foreach (ButtonViewModel button in buttons) 233 { 234 @button 235 } 236 </div> 237 </div> 238 </div> 239 240 <div class="col"> 241 <div 242 class="position-relative g-4 js-card-person-container js-dalgas-queryresult-container" 243 id="@($"query-result-{Model.Id}")"> 244 245 @if (allowAllQueryItems) 246 { 247 totaleCount = queryResult.TotalCount; 248 } 249 250 <form method="post" action="@Pageview.SearchFriendlyUrl" 251 data-response-target-element="content" tabindex="-1" aria-hidden="false" 252 class="d-flex js-dalgas-facets-form dalgas-facets-form" 253 data-total-count="@totaleCount" data-page-size="@numberOfPersons"> 254 <input type="hidden" name="LayoutTemplate" 255 value="Designs/Swift/Swift_PageClean.cshtml"/> 256 <input type="hidden" name="PageNum" value="@pageNum"/> 257 @if (showFacets) 258 { 259 foreach (FacetGroup facetGroup in queryResult.FacetGroups) 260 { 261 foreach (Facet facet in facetGroup.Facets) 262 { 263 string showClass = " show"; 264 string ariaExpanded = "true"; 265 string facetGroupId = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", string.Empty); 266 267 268 if (facet.Options.Any()) 269 { 270 int selectedFacetsInGroup = 0; 271 272 foreach (FacetOption option in facet.Options) 273 { 274 if (option.Selected) 275 { 276 selectedFacetsInGroup++; 277 } 278 } 279 280 string label = selectedFacetsInGroup > 0 ? Translate(facet.Name) + "<span style=\"padding: 0.3em 0.6em\" class=\"badge ms-2\">" + selectedFacetsInGroup + "</span>" : Translate(facet.Name); 281 282 <div class="dropdown js-facets-selector"> 283 <button class="btn dropdown-toggle" type="button" 284 id="FacetGroup_@facetGroupId" 285 data-bs-toggle="dropdown" aria-expanded="false"> 286 @label 287 </button> 288 <div data-lenis-prevent class="dropdown-menu p-3" 289 aria-labelledby="FacetGroup_@facetGroupId" 290 style="min-width: 280px"> 291 @foreach (FacetOption facetOption in facet.Options.OrderBy(fo => fo.Label)) 292 { 293 string facetLabel = HtmlEncoder.HtmlEncode(facetOption.Label); 294 string disabled = facetOption.Count <= 0 ? "disabled" : string.Empty; 295 string selected = facetOption.Selected ? "checked" : string.Empty; 296 string facetValue = Uri.UnescapeDataString(facetOption.Value); 297 string optionValue = $"[{facetValue}]"; 298 299 facetLabel = facetLabel.ToLower() == "true" ? facetLabel = Translate("Yes") : facetLabel; 300 facetLabel = facetLabel.ToLower() == "false" ? facetLabel = Translate("No") : facetLabel; 301 302 <label class="form-check mt-1" @disabled> 303 <input type="checkbox" 304 onclick="window.onFacetChange(event)" 305 class="form-check-input" 306 name="@facet.QueryParameter" 307 value="@optionValue" 308 data-filter-value="@facetLabel" 309 @selected> 310 <span 311 class="form-check-label d-flex align-items-center"> 312 <span class="flex-fill">@facetLabel </span> 313 <small 314 class="opacity-85">@facetOption.Count</small> 315 </span> 316 </label> 317 318 if (facetOption.Selected) 319 { 320 FacetOption selectFacetOption = facetOption; 321 selectFacetOption.Name = facet.QueryParameter; 322 selectedFacetOptions.Add(selectFacetOption); 323 } 324 } 325 </div> 326 </div> 327 } 328 } 329 } 330 331 if (!string.IsNullOrEmpty(searchTerm)) 332 { 333 selectedFacetOptions.Add(new FacetOption() 334 { 335 Count = 1, 336 Label = searchTerm, 337 Name = "q", 338 Selected = true, 339 Value = searchTerm 340 }); 341 } 342 } 343 344 @if (showSearch) 345 { 346 <div class="type-ahead-dropdown"> 347 <div class="position-relative suggest-form"> 348 <span 349 class="position-absolute top-0 end-0 icon-3 px-3 d-flex align-items-center h-100 search-icon"> 350 @ReadFile(iconPath + "search.svg") 351 </span> 352 353 <input id="searchField_@Model.Id" 354 class="form-control custom-header-searchbar js-custom-facets-search-field pe-5 ps-3 js-" 355 type="search" 356 placeholder="@Translate("Enter postcode or name of person")" 357 autocomplete="off" 358 maxlength="255" 359 name="q" 360 minlength="3" 361 value="@searchTerm" 362 data-original="@searchTerm"> 363 364 <button type="button" 365 onclick="custom.QueryResult.clearSearchField(event)" 366 class="btn h-100 icon-2 reset-search" 367 aria-label="@Translate("Clear search")" 368 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;"> 369 @ReadFile(iconPath + "x.svg") 370 </button> 371 </div> 372 </div> 373 <input type="submit" onclick="custom.QueryResult.update(event)" 374 class="btn btn-primary col-md-2" 375 value="@Translate("Search", "Search")"> 376 } 377 </form> 378 379 @if (showFacets && selectedFacetOptions.Any()) 380 { 381 <div 382 class="mt-3 d-flex gap-3 mb-4 js-dalgas-queryresult-selectedfacets-container dalgas-queryresult-selectedfacets-container"> 383 @foreach (FacetOption facetOption in selectedFacetOptions) 384 { 385 string facetValue = Uri.UnescapeDataString(facetOption.Value); 386 string optionValue = $"[{facetValue}]"; 387 <input class="visually-hidden" 388 id="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)" 389 name="@facetOption.Name" 390 onclick="custom.QueryResult.deselectFacetOption(event)" 391 type="checkbox" value="@optionValue" title="@facetOption.Label" 392 checked> 393 <label class="badge theme border border-dark" 394 for="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)"> 395 <span class="text-nowrap">@(facetOption.Label)</span> 396 <span class="icon-2 ms-2"> 397 @ReadFile(iconPath + "x.svg") 398 </span> 399 </label> 400 } 401 402 @if (selectedFacetOptions.Count >= 3) 403 { 404 <input class="visually-hidden" id="ClearAll" name="ClearAll" 405 onclick="custom.QueryResult.clearAll(event)" type="checkbox" 406 value="" title="" checked> 407 <label class="badge text-nowrap dalgas-btn-clear-all" for="ClearAll"> 408 <span class="text-nowrap">@Translate("Clear all")</span> 409 <span class="icon-2 ms-2"> 410 @ReadFile(iconPath + "x.svg") 411 </span> 412 </label> 413 } 414 </div> 415 } 416 417 @if (showFacets && selectedFacetOptions.Any() == false && string.IsNullOrEmpty(searchTerm)) 418 { 419 enableShowZeroResultMsg = false; 420 userIds = new List<string>(); 421 } 422 423 @if (showFacets && enableShowZeroResultMsg && userIds.Any() == false) 424 { 425 <div class="mt-4">@Translate("Your search returned no results...")</div> 426 } 427 428 429 @if (showPersons && userIds.Any() || showPersons && hasContactPersonListItems) 430 { 431 <div 432 class="row @(showAlternativeLayout ? "g-4" : "mt-3") js-dalgas-queryresult-itemlist dalgas-queryresult-itemlist"> 433 434 @foreach (string userId in userIds) 435 { 436 if (!int.TryParse(userId, out int intUserId)) 437 { 438 continue; 439 } 440 441 //UserViewModel result = new UserViewModel(); 442 443 User result = User.GetUserByID(intUserId); 444 445 if (result == null) 446 { 447 continue; 448 } 449 450 UserViewModel resultViewModel = result.ToViewModel(); 451 452 <div 453 class="col-12 js-col-card-person col-lg @(showAlternativeLayout ? "col-lg-4" : "")"> 454 455 @{ 456 FileViewModel imageFile = ViewModelFactory.CreateFieldFileValueView(result.Image); 457 } 458 459 <div class="theme theme-light h-100"> 460 <div class="p-img-container d-flex"> 461 <figure 462 class="ratio ratio-1x1 @(!string.IsNullOrEmpty(result.Image) ? "has-image" : string.Empty)"> 463 @RenderPartial("Components/Image.cshtml", imageFile ?? new FileViewModel()) 464 </figure> 465 <figure class="ratio ratio-1x1"> 466 <span 467 class="fifth-element @fifthElementTheme opacity-50"> 468 @ReadFile(fifthElementIconPath + "canopy.svg") 469 </span> 470 </figure> 471 </div> 472 <div class="p-txt-container p-4 pt-5"> 473 <h4>@resultViewModel.Name</h4> 474 475 @if (cardInformationLayout == "title-and-description") 476 { 477 string linkedIn = resultViewModel.GetCustomFieldValue<string>("AccessUser_LinkedIn"); 478 479 <div class="small d-flex flex-column mb-3 opacity-75"> 480 <span>@resultViewModel.GetJobTitle()</span> 481 482 @if (!string.IsNullOrEmpty(linkedIn)) 483 { 484 <a href="@linkedIn" class="mt-1" 485 target="_blank">LinkedIn</a> 486 } 487 488 @if (!string.IsNullOrEmpty(resultViewModel.GetDescription())) 489 { 490 <span 491 class="mt-3">@resultViewModel.GetDescription()</span> 492 } 493 </div> 494 } 495 else 496 { 497 <div class="small d-flex flex-column mb-3 opacity-75"> 498 <span>@resultViewModel.GetJobTitle()</span> 499 <span>@Translate("Contact Department", "Afdeling"): @resultViewModel.GetDepartment()</span> 500 501 @if (resultViewModel.GetLocations().Any()) 502 { 503 <span> 504 <span>@Translate("Office", "Kontor"): </span> 505 @foreach (Location location in resultViewModel.GetLocations()) 506 { 507 <span>@location.Text</span> 508 } 509 </span> 510 } 511 512 <span>@resultViewModel.GetComment()</span> 513 </div> 514 515 516 if (!string.IsNullOrEmpty(resultViewModel.GetContactEmail())) 517 { 518 <div class="d-flex gap-3 small opacity-75"> 519 <span>E.</span> 520 <a style="font-size: 1em" 521 class="text-decoration-none" 522 href="mailto:@resultViewModel.GetContactEmail()">@resultViewModel.GetContactEmail().ToLower()</a> 523 </div> 524 } 525 526 if (!string.IsNullOrEmpty(resultViewModel.Phone)) 527 { 528 <div class="d-flex gap-3 small opacity-75"> 529 <span>T.</span> 530 <span>@resultViewModel.Phone</span> 531 </div> 532 } 533 } 534 </div> 535 </div> 536 537 </div> 538 } 539 @if (showForm) 540 { 541 <div class="col-12 js-col-card-person col-lg"> 542 543 <div class="h-100 contact-person-card js-contact-person-card"> 544 545 <div class="card-front theme theme-light "> 546 <div class="p-img-container d-none d-lg-flex"> 547 <figure class="ratio ratio-1x1"> 548 @* Empty space *@ 549 </figure> 550 <figure class="ratio ratio-1x1"> 551 <span 552 class="fifth-element @fifthElementTheme opacity-50"> 553 @ReadFile(fifthElementIconPath + "canopy.svg") 554 </span> 555 </figure> 556 </div> 557 <div class="p-txt-container p-4 pt-6"> 558 <h4>@Translate("Get Contacted")</h4> 559 560 <div class="small d-flex flex-column mb-3 opacity-75"> 561 @Translate("Dalgas - Get Contacted - Card Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo.") 562 </div> 563 564 @RenderModel(btnOpenForm) 565 </div> 566 </div> 567 <div class="card-back theme theme-light "> 568 569 @if (formParagraphId != null) 570 { 571 <div 572 class="contact-person-form-container js-contact-person-form-container theme p-4"> 573 574 575 @if (formType == "microsoft") 576 { 577 <div 578 class="js-remove-microsoft-form-styling microsoft-form-container"> 579 <script 580 src="https://cxppusa1formui01cdnsa01-endpoint.azureedge.net/eur/FormLoader/FormLoader.bundle.js" 581 crossorigin="anonymous" defer></script> 582 <div 583 data-cached-form-url="https://assets-eur.mkt.dynamics.com/@formBlockId/digitalassets/forms/@formContainerId" 584 data-form-api-url="https://public-eur.mkt.dynamics.com/api/v1.0/orgs/@formBlockId/landingpageforms" 585 data-form-id="@formContainerId"></div> 586 </div> 587 } 588 else 589 { 590 @RenderParagraphContent(formParagraphId) 591 } 592 593 594 </div> 595 } 596 597 </div> 598 599 </div> 600 </div> 601 } 602 </div> 603 604 if (allowAllQueryItems && totaleCount > numberOfPersons) 605 { 606 <div class="row mt-4"> 607 <div class="col-12 text-center"> 608 <button onclick="custom.QueryResult.getNextPage(event)" 609 class="btn btn-primary">@Translate("Vis flere")</button> 610 </div> 611 </div> 612 } 613 } 614 else 615 { 616 if (showForm) 617 { 618 <div class="col-12 col-lg"> 619 620 @if (formParagraphId != null) 621 { 622 if (formType == "microsoft") 623 { 624 if (Pageview.IsVisualEditorMode) 625 { 626 <div class="container-xl alert alert-danger" role="alert"> 627 <h4>Use the "Microsoft Form" Paragraph instead</h4> 628 <p>Due to technical limitations within Microsoft Form 629 Markup & Styling, we prefer that you use the 630 "Microsoft Form" item instead, when you have no 631 contact persons attatched this Contact 632 Paragraph.</p> 633 <p>We are showing the default form in the frontend.</p> 634 </div> 635 } 636 else 637 { 638 @RenderParagraphContent(formParagraphId) 639 } 640 } 641 else 642 { 643 @RenderParagraphContent(formParagraphId) 644 } 645 } 646 </div> 647 } 648 } 649 </div> 650 </div> 651 </div> 652 </div> 653 </div> 654 </div> 655 </div> 656 </section> 657 } 658 else 659 { 660 if (Pageview.IsVisualEditorMode) 661 { 662 <div class="container-xl alert alert-danger" role="alert"> 663 This <strong>@Model.Item.SystemName</strong> is empty 664 </div> 665 } 666 } 667 668 669 <script> 670 window.onFacetChange = (event) =>{ 671 custom.QueryResult.update(event); 672 window.dataLayer.push({ 673 event: 'contact_filter_change', 674 filter_name: event.target.name, 675 filter_value: event.target.value 676 }); 677 } 678 </script> 679

Presserum

Find pressemeddelelser og andet relevant materiale i vores presserum.

Kongenshus

Gå på opdagelse i et af landets største sammenhængende hedearealer, hvor du kan fornemme noget af tidligere tiders ødemark med vidt udsyn til alle sider.

Error executing template "/Designs/Swift/Grid/Page/RowTemplates/Dalgas_Contact.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 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.GridRowViewModel> 2 @using System 3 @using System.Collections.Generic 4 @using System.Linq 5 @using System.Text.RegularExpressions 6 @using Dalgas.Custom.Extensions 7 @using Dalgas.Custom.Models.Content 8 @using Dalgas.Custom.Services 9 @using Dalgas.Custom.ViewModels.UI 10 @using Dynamicweb.Core.Encoders 11 @using Dynamicweb.Core.Json 12 @using Dynamicweb.Ecommerce.ProductCatalog 13 @using Dynamicweb.Frontend 14 @using Dynamicweb.Security.UserManagement 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 QueryResult queryResult = new QueryResult(); 134 int numberOfPersons = Convert.ToInt32(Model.Item.GetItem("Paragraph_Layout").GetString("NumberOfPersons")); 135 bool showForm = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowForm"); 136 bool showFacets = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowFacets"); 137 bool showSearch = Model.Item.GetItem("Paragraph_Layout").GetBoolean("ShowSearch"); 138 139 string cardInformationLayout = Model.Item.GetItem("Paragraph_Layout").GetString("Layout"); 140 141 bool allowAllQueryItems = showFacets || showSearch; 142 int formParagraphId = Pageview.AreaSettings.GetLink("FormGetContacted").PageId; 143 string iconPath = "/Files/Templates/Designs/Swift/Assets/icons/"; 144 145 string formType = Model.Item.GetItem("Paragraph_Layout").GetString("FormType"); //Default or Microsoft 146 string formBlockId = Model.Item.GetItem("Paragraph_Layout").GetString("FormId"); // Microsoft form 147 string formContainerId = Model.Item.GetItem("Paragraph_Layout").GetString("ContainerId"); // Microsoft form 148 149 ButtonViewModel btnOpenForm = new ButtonViewModel 150 { 151 Id = "formParagraphId_" + formParagraphId, 152 Text = Translate("Contact me"), 153 Type = ButtonType.Button, 154 DisplayType = ButtonDisplayType.Primary, 155 Classes = new ClassList("js-show-paragraph-form") 156 }; 157 158 IList<UserViewModel> contactPersonListItems = Model.Item?.GetItem("Paragraph_Layout")?.GetUsers("ContactPersonSelector") ?? Enumerable.Empty<UserViewModel>().ToList(); 159 bool hasContactPersonListItems = contactPersonListItems.Any(); 160 List<User> users = new List<User>(); 161 List<string> userIds = new List<string>(); 162 163 if (hasContactPersonListItems) 164 { 165 userIds.AddRange(contactPersonListItems.Select(cp => cp.ID.ToString())); 166 allowAllQueryItems = false; 167 showFacets = false; 168 showSearch = false; 169 } 170 else 171 { 172 if (showFacets) 173 { 174 numberOfPersons = 12; 175 queryResult = ContentRelationService.Instance.GetAllContacts(numberOfPersons); 176 } 177 else 178 { 179 queryResult = ContentRelationService.Instance.GetRelatedContactsByCurrentPage(numberOfPersons); 180 } 181 182 userIds.AddRange(queryResult.Results.Select(qrr => qrr["UserID"]?.ToString())); 183 } 184 185 bool showPersons = Model.Item.GetItem("Paragraph_Layout").GetBoolean("showPersons") && userIds.Any(); 186 int pageNum = int.TryParse(Dynamicweb.Context.Current.Request["PageNum"], out int pageNumResult) ? pageNumResult : 1; 187 string searchTerm = Dynamicweb.Context.Current.Request["q"]; 188 List<FacetOption> selectedFacetOptions = new List<FacetOption>(); 189 int totaleCount = 0; 190 bool enableShowZeroResultMsg = true; 191 192 bool showAlternativeLayout = false; 193 194 if (showFacets && showSearch || showPersons && numberOfPersons >= 2 && userIds.Count >= 2 && showForm || showPersons && numberOfPersons >= 3 && userIds.Count >= 3 && !showForm) 195 { 196 showAlternativeLayout = true; 197 } 198 } 199 200 201 @if (queryResult.FacetGroups.Any() || hasContactPersonListItems || showForm) 202 { 203 <section id="section-@Model.Id" class="@sectionClassList item_@Model.Item.SystemName.ToLower()" data-swift-gridrow> 204 <div class=""> 205 206 <div class="container-xl"> 207 <div class="row justify-content-center"> 208 <div class="col-12"> 209 <div class="row"> 210 211 <div 212 class="col-12 @(showAlternativeLayout ? "flex-column flex-lg-row mb-5" : "col-lg-4 flex-column") d-flex justify-content-between"> 213 <div 214 class="js-content-container content-container col-12 @(showAlternativeLayout ? "col-lg-5" : string.Empty)"> 215 216 <span> 217 @string.Join("", headings.Select(h => h.ToString())) 218 </span> 219 220 @if (!string.IsNullOrEmpty(lead)) 221 { 222 <p class="lead">@lead</p> 223 } 224 225 @text 226 227 </div> 228 <div 229 class="js-content-container content-container @(showAlternativeLayout ? "col-lg-5 d-inline-flex justify-content-lg-end align-items-end" : string.Empty)"> 230 <div 231 class="d-flex flex-wrap gap-3 @(showAlternativeLayout ? "mb-4" : "mb-4 mb-lg-0")"> 232 @foreach (ButtonViewModel button in buttons) 233 { 234 @button 235 } 236 </div> 237 </div> 238 </div> 239 240 <div class="col"> 241 <div 242 class="position-relative g-4 js-card-person-container js-dalgas-queryresult-container" 243 id="@($"query-result-{Model.Id}")"> 244 245 @if (allowAllQueryItems) 246 { 247 totaleCount = queryResult.TotalCount; 248 } 249 250 <form method="post" action="@Pageview.SearchFriendlyUrl" 251 data-response-target-element="content" tabindex="-1" aria-hidden="false" 252 class="d-flex js-dalgas-facets-form dalgas-facets-form" 253 data-total-count="@totaleCount" data-page-size="@numberOfPersons"> 254 <input type="hidden" name="LayoutTemplate" 255 value="Designs/Swift/Swift_PageClean.cshtml"/> 256 <input type="hidden" name="PageNum" value="@pageNum"/> 257 @if (showFacets) 258 { 259 foreach (FacetGroup facetGroup in queryResult.FacetGroups) 260 { 261 foreach (Facet facet in facetGroup.Facets) 262 { 263 string showClass = " show"; 264 string ariaExpanded = "true"; 265 string facetGroupId = Regex.Replace(Convert.ToBase64String(Guid.NewGuid().ToByteArray()), "[/+=]", string.Empty); 266 267 268 if (facet.Options.Any()) 269 { 270 int selectedFacetsInGroup = 0; 271 272 foreach (FacetOption option in facet.Options) 273 { 274 if (option.Selected) 275 { 276 selectedFacetsInGroup++; 277 } 278 } 279 280 string label = selectedFacetsInGroup > 0 ? Translate(facet.Name) + "<span style=\"padding: 0.3em 0.6em\" class=\"badge ms-2\">" + selectedFacetsInGroup + "</span>" : Translate(facet.Name); 281 282 <div class="dropdown js-facets-selector"> 283 <button class="btn dropdown-toggle" type="button" 284 id="FacetGroup_@facetGroupId" 285 data-bs-toggle="dropdown" aria-expanded="false"> 286 @label 287 </button> 288 <div data-lenis-prevent class="dropdown-menu p-3" 289 aria-labelledby="FacetGroup_@facetGroupId" 290 style="min-width: 280px"> 291 @foreach (FacetOption facetOption in facet.Options.OrderBy(fo => fo.Label)) 292 { 293 string facetLabel = HtmlEncoder.HtmlEncode(facetOption.Label); 294 string disabled = facetOption.Count <= 0 ? "disabled" : string.Empty; 295 string selected = facetOption.Selected ? "checked" : string.Empty; 296 string facetValue = Uri.UnescapeDataString(facetOption.Value); 297 string optionValue = $"[{facetValue}]"; 298 299 facetLabel = facetLabel.ToLower() == "true" ? facetLabel = Translate("Yes") : facetLabel; 300 facetLabel = facetLabel.ToLower() == "false" ? facetLabel = Translate("No") : facetLabel; 301 302 <label class="form-check mt-1" @disabled> 303 <input type="checkbox" 304 onclick="window.onFacetChange(event)" 305 class="form-check-input" 306 name="@facet.QueryParameter" 307 value="@optionValue" 308 data-filter-value="@facetLabel" 309 @selected> 310 <span 311 class="form-check-label d-flex align-items-center"> 312 <span class="flex-fill">@facetLabel </span> 313 <small 314 class="opacity-85">@facetOption.Count</small> 315 </span> 316 </label> 317 318 if (facetOption.Selected) 319 { 320 FacetOption selectFacetOption = facetOption; 321 selectFacetOption.Name = facet.QueryParameter; 322 selectedFacetOptions.Add(selectFacetOption); 323 } 324 } 325 </div> 326 </div> 327 } 328 } 329 } 330 331 if (!string.IsNullOrEmpty(searchTerm)) 332 { 333 selectedFacetOptions.Add(new FacetOption() 334 { 335 Count = 1, 336 Label = searchTerm, 337 Name = "q", 338 Selected = true, 339 Value = searchTerm 340 }); 341 } 342 } 343 344 @if (showSearch) 345 { 346 <div class="type-ahead-dropdown"> 347 <div class="position-relative suggest-form"> 348 <span 349 class="position-absolute top-0 end-0 icon-3 px-3 d-flex align-items-center h-100 search-icon"> 350 @ReadFile(iconPath + "search.svg") 351 </span> 352 353 <input id="searchField_@Model.Id" 354 class="form-control custom-header-searchbar js-custom-facets-search-field pe-5 ps-3 js-" 355 type="search" 356 placeholder="@Translate("Enter postcode or name of person")" 357 autocomplete="off" 358 maxlength="255" 359 name="q" 360 minlength="3" 361 value="@searchTerm" 362 data-original="@searchTerm"> 363 364 <button type="button" 365 onclick="custom.QueryResult.clearSearchField(event)" 366 class="btn h-100 icon-2 reset-search" 367 aria-label="@Translate("Clear search")" 368 style="opacity: 0; position: absolute; top: 0; right: 0; visibility: hidden;"> 369 @ReadFile(iconPath + "x.svg") 370 </button> 371 </div> 372 </div> 373 <input type="submit" onclick="custom.QueryResult.update(event)" 374 class="btn btn-primary col-md-2" 375 value="@Translate("Search", "Search")"> 376 } 377 </form> 378 379 @if (showFacets && selectedFacetOptions.Any()) 380 { 381 <div 382 class="mt-3 d-flex gap-3 mb-4 js-dalgas-queryresult-selectedfacets-container dalgas-queryresult-selectedfacets-container"> 383 @foreach (FacetOption facetOption in selectedFacetOptions) 384 { 385 string facetValue = Uri.UnescapeDataString(facetOption.Value); 386 string optionValue = $"[{facetValue}]"; 387 <input class="visually-hidden" 388 id="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)" 389 name="@facetOption.Name" 390 onclick="custom.QueryResult.deselectFacetOption(event)" 391 type="checkbox" value="@optionValue" title="@facetOption.Label" 392 checked> 393 <label class="badge theme border border-dark" 394 for="Selected_@(Model.Id)_@facetOption.Value.Replace("#", string.Empty)"> 395 <span class="text-nowrap">@(facetOption.Label)</span> 396 <span class="icon-2 ms-2"> 397 @ReadFile(iconPath + "x.svg") 398 </span> 399 </label> 400 } 401 402 @if (selectedFacetOptions.Count >= 3) 403 { 404 <input class="visually-hidden" id="ClearAll" name="ClearAll" 405 onclick="custom.QueryResult.clearAll(event)" type="checkbox" 406 value="" title="" checked> 407 <label class="badge text-nowrap dalgas-btn-clear-all" for="ClearAll"> 408 <span class="text-nowrap">@Translate("Clear all")</span> 409 <span class="icon-2 ms-2"> 410 @ReadFile(iconPath + "x.svg") 411 </span> 412 </label> 413 } 414 </div> 415 } 416 417 @if (showFacets && selectedFacetOptions.Any() == false && string.IsNullOrEmpty(searchTerm)) 418 { 419 enableShowZeroResultMsg = false; 420 userIds = new List<string>(); 421 } 422 423 @if (showFacets && enableShowZeroResultMsg && userIds.Any() == false) 424 { 425 <div class="mt-4">@Translate("Your search returned no results...")</div> 426 } 427 428 429 @if (showPersons && userIds.Any() || showPersons && hasContactPersonListItems) 430 { 431 <div 432 class="row @(showAlternativeLayout ? "g-4" : "mt-3") js-dalgas-queryresult-itemlist dalgas-queryresult-itemlist"> 433 434 @foreach (string userId in userIds) 435 { 436 if (!int.TryParse(userId, out int intUserId)) 437 { 438 continue; 439 } 440 441 //UserViewModel result = new UserViewModel(); 442 443 User result = User.GetUserByID(intUserId); 444 445 if (result == null) 446 { 447 continue; 448 } 449 450 UserViewModel resultViewModel = result.ToViewModel(); 451 452 <div 453 class="col-12 js-col-card-person col-lg @(showAlternativeLayout ? "col-lg-4" : "")"> 454 455 @{ 456 FileViewModel imageFile = ViewModelFactory.CreateFieldFileValueView(result.Image); 457 } 458 459 <div class="theme theme-light h-100"> 460 <div class="p-img-container d-flex"> 461 <figure 462 class="ratio ratio-1x1 @(!string.IsNullOrEmpty(result.Image) ? "has-image" : string.Empty)"> 463 @RenderPartial("Components/Image.cshtml", imageFile ?? new FileViewModel()) 464 </figure> 465 <figure class="ratio ratio-1x1"> 466 <span 467 class="fifth-element @fifthElementTheme opacity-50"> 468 @ReadFile(fifthElementIconPath + "canopy.svg") 469 </span> 470 </figure> 471 </div> 472 <div class="p-txt-container p-4 pt-5"> 473 <h4>@resultViewModel.Name</h4> 474 475 @if (cardInformationLayout == "title-and-description") 476 { 477 string linkedIn = resultViewModel.GetCustomFieldValue<string>("AccessUser_LinkedIn"); 478 479 <div class="small d-flex flex-column mb-3 opacity-75"> 480 <span>@resultViewModel.GetJobTitle()</span> 481 482 @if (!string.IsNullOrEmpty(linkedIn)) 483 { 484 <a href="@linkedIn" class="mt-1" 485 target="_blank">LinkedIn</a> 486 } 487 488 @if (!string.IsNullOrEmpty(resultViewModel.GetDescription())) 489 { 490 <span 491 class="mt-3">@resultViewModel.GetDescription()</span> 492 } 493 </div> 494 } 495 else 496 { 497 <div class="small d-flex flex-column mb-3 opacity-75"> 498 <span>@resultViewModel.GetJobTitle()</span> 499 <span>@Translate("Contact Department", "Afdeling"): @resultViewModel.GetDepartment()</span> 500 501 @if (resultViewModel.GetLocations().Any()) 502 { 503 <span> 504 <span>@Translate("Office", "Kontor"): </span> 505 @foreach (Location location in resultViewModel.GetLocations()) 506 { 507 <span>@location.Text</span> 508 } 509 </span> 510 } 511 512 <span>@resultViewModel.GetComment()</span> 513 </div> 514 515 516 if (!string.IsNullOrEmpty(resultViewModel.GetContactEmail())) 517 { 518 <div class="d-flex gap-3 small opacity-75"> 519 <span>E.</span> 520 <a style="font-size: 1em" 521 class="text-decoration-none" 522 href="mailto:@resultViewModel.GetContactEmail()">@resultViewModel.GetContactEmail().ToLower()</a> 523 </div> 524 } 525 526 if (!string.IsNullOrEmpty(resultViewModel.Phone)) 527 { 528 <div class="d-flex gap-3 small opacity-75"> 529 <span>T.</span> 530 <span>@resultViewModel.Phone</span> 531 </div> 532 } 533 } 534 </div> 535 </div> 536 537 </div> 538 } 539 @if (showForm) 540 { 541 <div class="col-12 js-col-card-person col-lg"> 542 543 <div class="h-100 contact-person-card js-contact-person-card"> 544 545 <div class="card-front theme theme-light "> 546 <div class="p-img-container d-none d-lg-flex"> 547 <figure class="ratio ratio-1x1"> 548 @* Empty space *@ 549 </figure> 550 <figure class="ratio ratio-1x1"> 551 <span 552 class="fifth-element @fifthElementTheme opacity-50"> 553 @ReadFile(fifthElementIconPath + "canopy.svg") 554 </span> 555 </figure> 556 </div> 557 <div class="p-txt-container p-4 pt-6"> 558 <h4>@Translate("Get Contacted")</h4> 559 560 <div class="small d-flex flex-column mb-3 opacity-75"> 561 @Translate("Dalgas - Get Contacted - Card Text", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo.") 562 </div> 563 564 @RenderModel(btnOpenForm) 565 </div> 566 </div> 567 <div class="card-back theme theme-light "> 568 569 @if (formParagraphId != null) 570 { 571 <div 572 class="contact-person-form-container js-contact-person-form-container theme p-4"> 573 574 575 @if (formType == "microsoft") 576 { 577 <div 578 class="js-remove-microsoft-form-styling microsoft-form-container"> 579 <script 580 src="https://cxppusa1formui01cdnsa01-endpoint.azureedge.net/eur/FormLoader/FormLoader.bundle.js" 581 crossorigin="anonymous" defer></script> 582 <div 583 data-cached-form-url="https://assets-eur.mkt.dynamics.com/@formBlockId/digitalassets/forms/@formContainerId" 584 data-form-api-url="https://public-eur.mkt.dynamics.com/api/v1.0/orgs/@formBlockId/landingpageforms" 585 data-form-id="@formContainerId"></div> 586 </div> 587 } 588 else 589 { 590 @RenderParagraphContent(formParagraphId) 591 } 592 593 594 </div> 595 } 596 597 </div> 598 599 </div> 600 </div> 601 } 602 </div> 603 604 if (allowAllQueryItems && totaleCount > numberOfPersons) 605 { 606 <div class="row mt-4"> 607 <div class="col-12 text-center"> 608 <button onclick="custom.QueryResult.getNextPage(event)" 609 class="btn btn-primary">@Translate("Vis flere")</button> 610 </div> 611 </div> 612 } 613 } 614 else 615 { 616 if (showForm) 617 { 618 <div class="col-12 col-lg"> 619 620 @if (formParagraphId != null) 621 { 622 if (formType == "microsoft") 623 { 624 if (Pageview.IsVisualEditorMode) 625 { 626 <div class="container-xl alert alert-danger" role="alert"> 627 <h4>Use the "Microsoft Form" Paragraph instead</h4> 628 <p>Due to technical limitations within Microsoft Form 629 Markup & Styling, we prefer that you use the 630 "Microsoft Form" item instead, when you have no 631 contact persons attatched this Contact 632 Paragraph.</p> 633 <p>We are showing the default form in the frontend.</p> 634 </div> 635 } 636 else 637 { 638 @RenderParagraphContent(formParagraphId) 639 } 640 } 641 else 642 { 643 @RenderParagraphContent(formParagraphId) 644 } 645 } 646 </div> 647 } 648 } 649 </div> 650 </div> 651 </div> 652 </div> 653 </div> 654 </div> 655 </div> 656 </section> 657 } 658 else 659 { 660 if (Pageview.IsVisualEditorMode) 661 { 662 <div class="container-xl alert alert-danger" role="alert"> 663 This <strong>@Model.Item.SystemName</strong> is empty 664 </div> 665 } 666 } 667 668 669 <script> 670 window.onFacetChange = (event) =>{ 671 custom.QueryResult.update(event); 672 window.dataLayer.push({ 673 event: 'contact_filter_change', 674 filter_name: event.target.name, 675 filter_value: event.target.value 676 }); 677 } 678 </script> 679

No products in cart