Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.b__193_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7862
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.b__192_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7839
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 267
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_681a2a3d67e347199f91cf1bde4c6838.Execute() in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7810
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @using System.Web; 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 17 @functions { 18 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 19 bool isCart = PageView.Current().Page.NavigationTag == "CartPage"; 20 21 string getFontFamily(params string[] items) 22 { 23 var itemParent = Pageview.AreaSettings; 24 foreach (var item in items) 25 { 26 itemParent = itemParent.GetItem(item); 27 if (itemParent == null) 28 { 29 return null; 30 } 31 } 32 33 var googleFont = itemParent.GetGoogleFont("FontFamily"); 34 if (googleFont == null) 35 { 36 return null; 37 } 38 return googleFont.Family.Replace(" ", "+"); 39 } 40 41 string ConvertToUnixTimestamp(DateTime date) 42 { 43 DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); 44 TimeSpan diff = date.ToUniversalTime() - origin; 45 return Math.Floor(Math.Abs(diff.TotalSeconds)).ToString(); 46 } 47 48 string GetFileVersionEnding(string path) 49 { 50 FileInfo baseDirFileInfo = new FileInfo(AppDomain.CurrentDomain.BaseDirectory); 51 DirectoryInfo parentDirectory = baseDirFileInfo.Directory.Parent; 52 string fileDirectory = string.Format("{0}\\{1}", parentDirectory.FullName, path); 53 FileInfo fileInfo = new FileInfo(fileDirectory); 54 DateTime fileLastWriteTime = fileInfo.LastWriteTimeUtc; 55 string fileVersionStamp = ConvertToUnixTimestamp(fileLastWriteTime); 56 string newPath = path.Replace("\\", "/"); 57 58 return string.Format("/" + newPath + "?v={0}", fileVersionStamp); 59 } 60 } 61 62 @{ 63 //Font settings 64 var fonts = new string[] { 65 getFontFamily("Layout", "HeaderFont"), 66 getFontFamily("Layout", "SubheaderFont"), 67 getFontFamily("Layout", "TertiaryHeaderFont"), 68 getFontFamily("Layout", "BodyText"), 69 getFontFamily("Layout", "Header", "ToolsFont"), 70 getFontFamily("Layout", "Header", "NavigationFont"), 71 getFontFamily("Layout", "MobileNavigation", "Font"), 72 getFontFamily("ProductList", "Facets", "HeaderFont"), 73 getFontFamily("ProductPage", "PriceFontDesign"), 74 getFontFamily("Ecommerce", "SaleSticker", "Font"), 75 getFontFamily("Ecommerce", "NewSticker", "Font"), 76 getFontFamily("Ecommerce", "CustomSticker", "Font") 77 }; 78 79 string autoCssLink = "Files\\Templates\\Designs\\Rapido\\css\\rapido\\rapido_" + Model.Area.ID.ToString() + ".min.css"; 80 string autoIgniteCssLink = "Files\\Templates\\Designs\\Rapido\\css\\ignite\\ignite_" + Model.Area.ID.ToString() + ".min.css"; 81 82 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 83 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 84 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 85 if (useFontAwesomePro) 86 { 87 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 88 } 89 } 90 91 @{ 92 Block master = new Block() 93 { 94 Id = "Master", 95 BlocksList = new List<Block> { 96 new Block { 97 Id = "MasterTopSnippets", 98 SortId = 10 99 }, 100 new Block { 101 Id = "MasterMain", 102 SortId = 20, 103 Template = RenderMain(), 104 SkipRenderBlocksList = true, 105 BlocksList = new List<Block> { 106 new Block { 107 Id = "MasterHeader", 108 SortId = 10, 109 Template = RenderMasterHeader(), 110 SkipRenderBlocksList = true 111 }, 112 new Block { 113 Id = "MasterPageContent", 114 SortId = 20, 115 Template = RenderPageContent() 116 } 117 } 118 }, 119 new Block { 120 Id = "MasterFooter", 121 SortId = 30 122 }, 123 new Block { 124 Id = "MasterReferences", 125 SortId = 40 126 }, 127 new Block { 128 Id = "MasterBottomSnippets", 129 SortId = 50 130 } 131 } 132 }; 133 masterPage.Add(master); 134 } 135 136 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 137 @using System.Text.RegularExpressions 138 @using System.Collections.Generic 139 @using System.Reflection 140 @using System.Web.UI.HtmlControls 141 @using Dynamicweb.Rapido.Blocks.Components 142 @using Dynamicweb.Rapido.Blocks.Components.Articles 143 @using Dynamicweb.Rapido.Blocks.Components.Documentation 144 @using Dynamicweb.Rapido.Blocks 145 146 147 @*--- START: Base block renderers ---*@ 148 149 @helper RenderBlockList(List<Block> blocks) 150 { 151 blocks = blocks.OrderBy(item => item.SortId).ToList(); 152 153 foreach (Block item in blocks) 154 { 155 <!-- START: @item.Id --> 156 157 if (item.Design == null) 158 { 159 @RenderBlock(item) 160 } 161 else if (item.Design.RenderType == RenderType.None) { 162 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 163 164 <div class="@cssClass dw-mod"> 165 @RenderBlock(item) 166 </div> 167 } 168 else if (item.Design.RenderType != RenderType.Hide) 169 { 170 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 171 172 if (!item.SkipRenderBlocksList) { 173 if (item.Design.RenderType == RenderType.Row) 174 { 175 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 176 @RenderBlock(item) 177 </div> 178 } 179 180 if (item.Design.RenderType == RenderType.Column) 181 { 182 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 183 string size = item.Design.Size ?? "12"; 184 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 185 186 <div class="grid__col-lg-@item.Design.Size grid__col-md-@item.Design.Size grid__col-sm-12 grid__col-xs-12 @hidePadding @cssClass dw-mod" id="Block__@item.Id"> 187 @RenderBlock(item) 188 </div> 189 } 190 191 if (item.Design.RenderType == RenderType.Table) 192 { 193 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 194 @RenderBlock(item) 195 </table> 196 } 197 198 if (item.Design.RenderType == RenderType.TableRow) 199 { 200 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 201 @RenderBlock(item) 202 </tr> 203 } 204 205 if (item.Design.RenderType == RenderType.TableColumn) 206 { 207 <td class="@cssClass dw-mod" id="Block__@item.Id"> 208 @RenderBlock(item) 209 </td> 210 } 211 212 if (item.Design.RenderType == RenderType.CardHeader) 213 { 214 <div class="card-header @cssClass dw-mod"> 215 @RenderBlock(item) 216 </div> 217 } 218 219 if (item.Design.RenderType == RenderType.CardBody) 220 { 221 <div class="card @cssClass dw-mod"> 222 @RenderBlock(item) 223 </div> 224 } 225 226 if (item.Design.RenderType == RenderType.CardFooter) 227 { 228 <div class="card-footer @cssClass dw-mod"> 229 @RenderBlock(item) 230 </div> 231 } 232 } 233 else 234 { 235 @RenderBlock(item) 236 } 237 } 238 239 <!-- END: @item.Id --> 240 } 241 } 242 243 @helper RenderBlock(Block item) 244 { 245 if (item.Template != null) 246 { 247 @BlocksPage.RenderTemplate(item.Template) 248 } 249 250 if (item.Component != null) 251 { 252 string methodName = item.Component.HelperName; 253 dynamic[] methodParameters = new dynamic[1]; 254 methodParameters[0] = item.Component; 255 Type methodType = this.GetType(); 256 MethodInfo generalMethod = methodType.GetMethod(methodName); 257 258 if (generalMethod != null) { 259 @generalMethod.Invoke(this, methodParameters).ToString(); 260 } else { 261 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked"); 262 } 263 } 264 265 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 266 { 267 @RenderBlockList(item.BlocksList) 268 } 269 } 270 271 @*--- END: Base block renderers ---*@ 272 273 274 @* Include the components *@ 275 @using Dynamicweb.Rapido.Blocks.Components 276 @using Dynamicweb.Rapido.Blocks.Components.General 277 @using Dynamicweb.Rapido.Blocks 278 279 280 @* Components *@ 281 @using System.Reflection 282 @using Dynamicweb.Rapido.Blocks.Components.General 283 284 285 @* Component *@ 286 287 @helper RenderIcon(Icon settings) { 288 if (settings != null) 289 { 290 dynamic[] methodParameters = new dynamic[1]; 291 methodParameters[0] = settings; 292 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 293 294 if (customMethod != null) 295 { 296 @customMethod.Invoke(this, methodParameters).ToString(); 297 } else { 298 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 299 300 if (settings.Name != null) 301 { 302 if (String.IsNullOrEmpty(settings.Label)) { 303 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 304 } else { 305 if (settings.LabelPosition == IconLabelPosition.Before) { 306 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 307 } else { 308 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 309 } 310 } 311 } 312 } 313 } 314 } 315 @using System.Reflection 316 @using Dynamicweb.Rapido.Blocks.Components.General 317 @using Dynamicweb.Rapido.Blocks.Components 318 319 320 @* Component *@ 321 322 @helper RenderButton(Button settings) { 323 dynamic[] methodParameters = new dynamic[1]; 324 methodParameters[0] = settings; 325 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 326 327 if (customMethod != null) 328 { 329 @customMethod.Invoke(this, methodParameters).ToString(); 330 } 331 else 332 { 333 string target; 334 string disabled = settings.Disabled ? "disabled" : ""; 335 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 336 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 337 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 338 339 switch (settings.Target) 340 { 341 case LinkTargetType.Blank: 342 target = "_blank"; 343 break; 344 case LinkTargetType.Parent: 345 target = "_parent"; 346 break; 347 case LinkTargetType.Self: 348 target = "_self"; 349 break; 350 case LinkTargetType.Top: 351 target = "_top"; 352 break; 353 default: 354 target = "_self"; 355 break; 356 } 357 358 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 359 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 360 361 if (!String.IsNullOrEmpty(settings.ConfirmText)) 362 { 363 string modalId = settings.Id; 364 @RenderConfirmDialog(settings); 365 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 366 } 367 368 if (settings.Icon != null) 369 { 370 if (settings.IconPosition == null) { 371 settings.Icon.LabelPosition = IconLabelPosition.After; 372 } else { 373 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 374 } 375 if (settings.Icon.Label == null) { 376 settings.Icon.Label = settings.Title; 377 } 378 } 379 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 380 381 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 382 { 383 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> 384 } 385 else 386 { 387 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 388 } 389 } 390 } 391 392 393 @helper RenderConfirmDialog(Button settings) { 394 dynamic[] methodParameters = new dynamic[1]; 395 methodParameters[0] = settings; 396 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 397 398 if (customMethod != null) 399 { 400 @customMethod.Invoke(this, methodParameters).ToString(); 401 } else { 402 string modalTriggerId = settings.Id + "ModalTrigger"; 403 404 <!-- Trigger for the confirm modal --> 405 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 406 407 <!-- Login modal --> 408 <div class="modal-container"> 409 <label for="@modalTriggerId" class="modal-overlay"></label> 410 <div class="modal modal--xs"> 411 <div class="modal__header"> 412 <h2>@settings.ConfirmText</h2> 413 </div> 414 <div class="modal__body"> 415 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 416 </div> 417 </div> 418 </div> 419 } 420 } 421 @using System.Reflection 422 @using Dynamicweb.Rapido.Blocks.Components 423 @using Dynamicweb.Rapido.Blocks.Components.General 424 @using Dynamicweb.Rapido.Blocks 425 426 427 @* Component *@ 428 429 @helper RenderRating(Rating settings) 430 { 431 dynamic[] methodParameters = new dynamic[1]; 432 methodParameters[0] = settings; 433 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 434 435 if (customMethod != null) 436 { 437 @customMethod.Invoke(this, methodParameters).ToString(); 438 } else { 439 if (settings.Score > 0) 440 { 441 int rating = settings.Score; 442 string iconType = "fa-star"; 443 444 switch (settings.Type.ToString()) { 445 case "Stars": 446 iconType = "fa-star"; 447 break; 448 case "Hearts": 449 iconType = "fa-heart"; 450 break; 451 case "Lemons": 452 iconType = "fa-lemon"; 453 break; 454 case "Bombs": 455 iconType = "fa-bomb"; 456 break; 457 } 458 459 <div class="u-ta-right"> 460 @for (int i = 0; i < settings.OutOf; i++) 461 { 462 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 463 } 464 </div> 465 } 466 } 467 } 468 @using System.Reflection 469 @using Dynamicweb.Rapido.Blocks.Components.General 470 @using Dynamicweb.Rapido.Blocks.Components 471 472 473 @* Component *@ 474 475 @helper RenderFieldListOption(FieldListOption settings) { 476 dynamic[] methodParameters = new dynamic[1]; 477 methodParameters[0] = settings; 478 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 479 480 if (customMethod != null) 481 { 482 @customMethod.Invoke(this, methodParameters).ToString(); 483 } else { 484 string disabled = settings.Disabled ? "disabled" : ""; 485 string selected = settings.Checked ? "checked" : ""; 486 487 if (settings.Type.ToString() == "RadioButton") 488 { 489 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 490 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 491 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 492 } 493 494 if (settings.Type.ToString() == "Checkbox") 495 { 496 @RenderCheckboxField(settings) 497 } 498 499 if (settings.Type.ToString() == "SelectOption") 500 { 501 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 502 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 503 } 504 } 505 } 506 507 @using System.Reflection 508 @using Dynamicweb.Rapido.Blocks.Components.General 509 @using Dynamicweb.Rapido.Blocks.Components 510 511 512 @* Component *@ 513 514 @helper RenderNavigation(Navigation settings) { 515 dynamic[] methodParameters = new dynamic[1]; 516 methodParameters[0] = settings; 517 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 518 519 if (customMethod != null) 520 { 521 @customMethod.Invoke(this, methodParameters).ToString(); 522 } else { 523 @RenderNavigation(new 524 { 525 id = settings.Id, 526 cssclass = settings.CssClass, 527 startLevel = settings.StartLevel, 528 endlevel = settings.EndLevel, 529 expandmode = settings.Expandmode, 530 template = settings.Template 531 }) 532 } 533 } 534 @using System.Reflection 535 @using Dynamicweb.Rapido.Blocks.Components.General 536 @using Dynamicweb.Rapido.Blocks.Components 537 538 539 @* Component *@ 540 541 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 542 dynamic[] methodParameters = new dynamic[1]; 543 methodParameters[0] = settings; 544 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 545 546 if (customMethod != null) 547 { 548 @customMethod.Invoke(this, methodParameters).ToString(); 549 } else { 550 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 551 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 552 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 553 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 554 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 555 556 @RenderNavigation(settings) 557 } 558 } 559 @using System.Reflection 560 @using Dynamicweb.Rapido.Blocks.Components.General 561 562 563 @* Component *@ 564 565 @helper RenderHeading(Heading settings) { 566 dynamic[] methodParameters = new dynamic[1]; 567 methodParameters[0] = settings; 568 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 569 570 if (customMethod != null) 571 { 572 @customMethod.Invoke(this, methodParameters).ToString(); 573 } else { 574 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 575 string endTag = "</h" + settings.Level.ToString() + "\">"; 576 577 if (settings.Icon != null) 578 { 579 if (settings.IconPosition == null) { 580 settings.Icon.LabelPosition = IconLabelPosition.After; 581 } else { 582 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 583 } 584 if (settings.Icon.Label == null) { 585 settings.Icon.Label = settings.Title; 586 } 587 588 @startTag@RenderIcon(settings.Icon)@endTag 589 } else { 590 @startTag@settings.Title@endTag 591 } 592 } 593 } 594 @using System.Reflection 595 @using Dynamicweb.Rapido.Blocks.Components 596 @using Dynamicweb.Rapido.Blocks.Components.General 597 @using Dynamicweb.Rapido.Blocks 598 599 600 @* Component *@ 601 602 @helper RenderImage(Image settings) 603 { 604 if (settings.Path != null) 605 { 606 dynamic[] methodParameters = new dynamic[1]; 607 methodParameters[0] = settings; 608 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 609 610 if (customMethod != null) 611 { 612 @customMethod.Invoke(this, methodParameters).ToString(); 613 } else { 614 <div> 615 @if (settings.Link != null) 616 { 617 <a href="@settings.Link"> 618 @RenderTheImage(settings); 619 </a> 620 } 621 else 622 { 623 @RenderTheImage(settings); 624 } 625 </div> 626 } 627 } 628 } 629 630 @functions { 631 string getImagePathFromSettings(ImageSettings settings) 632 { 633 string result = ""; 634 635 if (settings != null) 636 { 637 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 638 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 639 result += "Crop=" + settings.Crop + "&"; 640 result += "Compression=" + settings.Compression + "&"; 641 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 642 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 643 } 644 645 return result; 646 } 647 } 648 649 @helper RenderTheImage(Image settings) 650 { 651 if (settings != null) 652 { 653 dynamic[] methodParameters = new dynamic[1]; 654 methodParameters[0] = settings; 655 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 656 657 if (customMethod != null) 658 { 659 @customMethod.Invoke(this, methodParameters).ToString(); 660 } else { 661 string placeholderImage = "/Files/Images/placeholder.gif"; 662 string imageEngine = "/Admin/Public/GetImage.ashx?"; 663 664 string imageStyle = ""; 665 666 switch (settings.Style) 667 { 668 case ImageStyle.Ball: 669 imageStyle = "grid__cell-img--ball"; 670 break; 671 } 672 673 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 674 { 675 if (settings.ImageDefault != null) 676 { 677 settings.ImageDefault.Height = settings.ImageDefault.Width; 678 } 679 if (settings.ImageMedium != null) 680 { 681 settings.ImageMedium.Height = settings.ImageMedium.Width; 682 } 683 if (settings.ImageSmall != null) 684 { 685 settings.ImageSmall.Height = settings.ImageSmall.Width; 686 } 687 } 688 689 string defaultImage = imageEngine; 690 string imageSmall = ""; 691 string imageMedium = ""; 692 693 if (settings.DisableImageEngine) { 694 defaultImage = settings.Path; 695 } else { 696 if (settings.ImageDefault != null) 697 { 698 defaultImage += getImagePathFromSettings(settings.ImageDefault); 699 700 if (settings.Path.GetType() != typeof(string)) 701 { 702 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 703 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 704 } 705 else 706 { 707 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 708 } 709 } 710 711 if (settings.ImageSmall != null) 712 { 713 imageSmall = "data-src-small=\"" + imageEngine; 714 imageSmall += getImagePathFromSettings(settings.ImageSmall); 715 716 if (settings.Path.GetType() != typeof(string)) 717 { 718 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 719 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 720 } 721 else 722 { 723 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 724 } 725 726 imageSmall += "\""; 727 } 728 729 if (settings.ImageMedium != null) 730 { 731 imageMedium = "data-src-medium=\"" + imageEngine; 732 imageMedium += getImagePathFromSettings(settings.ImageMedium); 733 734 if (settings.Path.GetType() != typeof(string)) 735 { 736 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 737 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 738 } 739 else 740 { 741 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 742 } 743 744 imageMedium += "\""; 745 } 746 } 747 748 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 749 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 750 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 751 752 if (settings.DisableLazyLoad) { 753 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 754 } else { 755 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 756 } 757 758 if (settings.Caption != null) 759 { 760 <span class="image-caption dw-mod">@settings.Caption</span> 761 } 762 } 763 } 764 } 765 @using System.Reflection 766 @using Dynamicweb.Rapido.Blocks.Components.General 767 @using Dynamicweb.Rapido.Blocks.Components 768 769 770 @* Component *@ 771 772 @helper RenderTextField(TextField settings) { 773 dynamic[] methodParameters = new dynamic[1]; 774 methodParameters[0] = settings; 775 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 776 777 if (customMethod != null) 778 { 779 @customMethod.Invoke(this, methodParameters).ToString(); 780 } else { 781 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 782 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 783 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 784 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 785 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 786 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 787 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 788 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 789 790 <div class="form__field-group dw-mod"> 791 @if (!String.IsNullOrEmpty(settings.Label)) 792 { 793 <label for="@settings.Id">@settings.Label</label> 794 } 795 796 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 797 798 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 799 </div> 800 } 801 } 802 @using System.Reflection 803 @using Dynamicweb.Rapido.Blocks.Components.General 804 @using Dynamicweb.Rapido.Blocks.Components 805 806 807 @* Component *@ 808 809 @helper RenderNumberField(NumberField settings) { 810 dynamic[] methodParameters = new dynamic[1]; 811 methodParameters[0] = settings; 812 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 813 814 if (customMethod != null) 815 { 816 @customMethod.Invoke(this, methodParameters).ToString(); 817 } else { 818 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 819 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 820 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 821 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 822 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 823 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 824 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 825 826 <div class="form__field-group dw-mod"> 827 @if (!String.IsNullOrEmpty(settings.Label)) 828 { 829 <div> 830 <label for="@settings.Id">@settings.Label</label> 831 </div> 832 } 833 834 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 835 836 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 837 </div> 838 } 839 } 840 @using System.Reflection 841 @using Dynamicweb.Rapido.Blocks.Components.General 842 @using Dynamicweb.Rapido.Blocks.Components 843 844 845 @* Component *@ 846 847 @helper RenderTextareaField(TextareaField settings) { 848 dynamic[] methodParameters = new dynamic[1]; 849 methodParameters[0] = settings; 850 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 851 852 if (customMethod != null) 853 { 854 @customMethod.Invoke(this, methodParameters).ToString(); 855 } else { 856 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 857 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 858 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 859 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 860 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 861 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 862 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 863 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 864 865 <div class="form__field-group dw-mod"> 866 @if (!String.IsNullOrEmpty(@settings.Label)) 867 { 868 <label for="@settings.Id">@settings.Label</label> 869 } 870 871 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 872 873 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 874 </div> 875 } 876 } 877 @using System.Reflection 878 @using Dynamicweb.Rapido.Blocks.Components.General 879 @using Dynamicweb.Rapido.Blocks.Components 880 881 882 @* Component *@ 883 884 @helper RenderHiddenField(HiddenField settings) { 885 dynamic[] methodParameters = new dynamic[1]; 886 methodParameters[0] = settings; 887 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 888 889 if (customMethod != null) 890 { 891 @customMethod.Invoke(this, methodParameters).ToString(); 892 } else { 893 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 894 } 895 } 896 @using System.Reflection 897 @using Dynamicweb.Rapido.Blocks.Components.General 898 @using Dynamicweb.Rapido.Blocks.Components 899 900 901 @* Component *@ 902 903 @helper RenderCheckboxField(dynamic settings) { 904 dynamic[] methodParameters = new dynamic[1]; 905 methodParameters[0] = settings; 906 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 907 908 if (customMethod != null) 909 { 910 @customMethod.Invoke(this, methodParameters).ToString(); 911 } else { 912 settings.Type = FieldListOptionType.Checkbox; 913 string disabled = settings.Disabled ? "disabled" : ""; 914 string required = settings.Required ? "required" : ""; 915 string checkedString = settings.Checked == true ? "checked" : ""; 916 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 917 918 <div class="form__field-group dw-mod"> 919 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 920 921 @if (!String.IsNullOrEmpty(settings.Label)) 922 { 923 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 924 } 925 926 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 927 </div> 928 } 929 } 930 @using System.Reflection 931 @using Dynamicweb.Rapido.Blocks.Components.General 932 @using Dynamicweb.Rapido.Blocks.Components 933 934 935 @* Component *@ 936 937 @helper RenderCheckboxListField(CheckboxListField settings) { 938 dynamic[] methodParameters = new dynamic[1]; 939 methodParameters[0] = settings; 940 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 941 942 if (customMethod != null) 943 { 944 @customMethod.Invoke(this, methodParameters).ToString(); 945 } else { 946 string disabled = settings.Disabled ? "disabled" : ""; 947 948 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 949 @if (!String.IsNullOrEmpty(settings.Label)) 950 { 951 <div class="u-bold u-margin-bottom">@settings.Label</div> 952 } 953 954 @foreach (var item in settings.Options) 955 { 956 item.Type = FieldListOptionType.Checkbox; 957 @RenderFieldListOption(item) 958 } 959 960 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 961 </div> 962 } 963 } 964 965 @using System.Reflection 966 @using Dynamicweb.Rapido.Blocks.Components.General 967 @using Dynamicweb.Rapido.Blocks.Components 968 969 970 @* Component *@ 971 972 @helper RenderSelectField(SelectField settings) { 973 dynamic[] methodParameters = new dynamic[1]; 974 methodParameters[0] = settings; 975 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 976 977 if (customMethod != null) 978 { 979 @customMethod.Invoke(this, methodParameters).ToString(); 980 } else { 981 string disabled = settings.Disabled ? "disabled" : ""; 982 string required = settings.Required ? "required" : ""; 983 984 if (settings.Default != null) 985 { 986 settings.Default.Type = FieldListOptionType.SelectOption; 987 } 988 989 <div class="form__field-group u-full-width dw-mod"> 990 @if (!String.IsNullOrEmpty(settings.Label)) 991 { 992 <label for="@settings.Id">@settings.Label</label> 993 } 994 995 <div class="form__field-combi u-no-margin dw-mod"> 996 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 997 @if (settings.Default.Value != null) 998 { 999 @RenderFieldListOption(settings.Default) 1000 } 1001 1002 @foreach (var item in settings.Options) 1003 { 1004 item.Type = FieldListOptionType.SelectOption; 1005 @RenderFieldListOption(item) 1006 } 1007 </select> 1008 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 1009 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 1010 @RenderButton(settings.ActionButton); 1011 } 1012 </div> 1013 1014 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1015 </div> 1016 } 1017 } 1018 @using System.Reflection 1019 @using Dynamicweb.Rapido.Blocks.Components.General 1020 @using Dynamicweb.Rapido.Blocks.Components 1021 1022 1023 @* Component *@ 1024 1025 @helper RenderRadioButtonField(RadioButtonField settings) { 1026 dynamic[] methodParameters = new dynamic[1]; 1027 methodParameters[0] = settings; 1028 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1029 1030 if (customMethod != null) 1031 { 1032 @customMethod.Invoke(this, methodParameters).ToString(); 1033 } else { 1034 string disabled = settings.Disabled ? "disabled" : ""; 1035 1036 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1037 @if (!String.IsNullOrEmpty(settings.Label)) 1038 { 1039 <div class="u-bold u-margin-bottom">@settings.Label</div> 1040 } 1041 1042 @foreach (var item in settings.Options) 1043 { 1044 item.Type = FieldListOptionType.RadioButton; 1045 1046 if (settings.Name != null) 1047 { 1048 item.Name = settings.Name; 1049 } 1050 1051 if (settings.RenderOptionsInline) 1052 { 1053 @RenderFieldListOption(item) 1054 } 1055 else 1056 { 1057 <div> 1058 @RenderFieldListOption(item) 1059 </div> 1060 } 1061 } 1062 1063 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1064 </div> 1065 } 1066 } 1067 @using System.Reflection 1068 @using Dynamicweb.Rapido.Blocks.Components.General 1069 @using Dynamicweb.Rapido.Blocks.Components 1070 1071 1072 @* Component *@ 1073 1074 @helper RenderNotificationMessage(NotificationMessage settings) { 1075 dynamic[] methodParameters = new dynamic[1]; 1076 methodParameters[0] = settings; 1077 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1078 1079 if (customMethod != null) 1080 { 1081 @customMethod.Invoke(this, methodParameters).ToString(); 1082 } else { 1083 if (!String.IsNullOrEmpty(settings.Message)) 1084 { 1085 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1086 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1087 } 1088 } 1089 } 1090 @using System.Reflection 1091 @using Dynamicweb.Rapido.Blocks.Components.General 1092 1093 1094 @* Component *@ 1095 1096 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1097 dynamic[] methodParameters = new dynamic[1]; 1098 methodParameters[0] = settings; 1099 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1100 1101 if (customMethod != null) 1102 { 1103 @customMethod.Invoke(this, methodParameters).ToString(); 1104 } else { 1105 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1106 1107 <div class="@settings.CssClass dw-mod js-handlebars-root" id="@settings.Id" data-template="@settings.ScriptTemplate" data-json-feed="@settings.FeedUrl" data-init-onload="@settings.InitOnLoad.ToString()" data-preloader="@settings.Preloader" @preRender> 1108 @if (settings.SubBlocks != null) { 1109 @RenderBlockList(settings.SubBlocks) 1110 } 1111 </div> 1112 } 1113 } 1114 @using System.Reflection 1115 @using Dynamicweb.Rapido.Blocks.Components.General 1116 @using Dynamicweb.Rapido.Blocks.Components 1117 @using System.Text.RegularExpressions 1118 1119 1120 @* Component *@ 1121 1122 @helper RenderSticker(Sticker settings) { 1123 dynamic[] methodParameters = new dynamic[1]; 1124 methodParameters[0] = settings; 1125 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1126 1127 if (customMethod != null) 1128 { 1129 @customMethod.Invoke(this, methodParameters).ToString(); 1130 } 1131 else 1132 { 1133 if (!String.IsNullOrEmpty(settings.Title)) { 1134 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1135 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1136 1137 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1138 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1139 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1140 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1141 optionalAttributes.Add("style", styleTag); 1142 } 1143 1144 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1145 } 1146 } 1147 } 1148 1149 @using System.Reflection 1150 @using Dynamicweb.Rapido.Blocks.Components.General 1151 @using Dynamicweb.Rapido.Blocks.Components 1152 1153 1154 @* Component *@ 1155 1156 @helper RenderStickersCollection(StickersCollection settings) { 1157 dynamic[] methodParameters = new dynamic[1]; 1158 methodParameters[0] = settings; 1159 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1160 1161 if (customMethod != null) 1162 { 1163 @customMethod.Invoke(this, methodParameters).ToString(); 1164 } 1165 else 1166 { 1167 if (settings.Stickers.Count > 0) { 1168 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1169 1170 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1171 @foreach (Sticker sticker in settings.Stickers) 1172 { 1173 @RenderSticker(sticker) 1174 } 1175 </div> 1176 } 1177 } 1178 } 1179 1180 @using System.Reflection 1181 @using Dynamicweb.Rapido.Blocks.Components.General 1182 @using Dynamicweb.Rapido.Blocks.Components 1183 1184 1185 1186 @* Component *@ 1187 1188 @helper RenderField(Field settings) { 1189 dynamic[] methodParameters = new dynamic[1]; 1190 methodParameters[0] = settings; 1191 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1192 1193 if (customMethod != null) 1194 { 1195 @customMethod.Invoke(this, methodParameters).ToString(); 1196 } else { 1197 switch (settings.FieldType) 1198 { 1199 case FieldType.Checkbox: 1200 CheckboxField checkbox = new CheckboxField 1201 { 1202 Label = settings.Label, 1203 Id = settings.Id, 1204 Name = settings.Label.Replace(" ", ""), 1205 Value = settings.Value, 1206 Checked = Convert.ToBoolean(settings.Placeholder), 1207 OnClick = settings.OnClick, 1208 Disabled = settings.Disabled, 1209 Required = settings.Required, 1210 CssClass = settings.CssClass, 1211 ExtraAttributes = settings.ExtraAttributes, 1212 ErrorMessage = settings.ErrorMessage 1213 }; 1214 1215 @RenderCheckboxField(checkbox) 1216 break; 1217 case FieldType.Email: 1218 TextField emailField = new TextField 1219 { 1220 Label = settings.Label != null ? settings.Label : Translate("Email"), 1221 Id = settings.Id, 1222 Value = settings.Value, 1223 OnClick = settings.OnClick, 1224 Disabled = settings.Disabled, 1225 Required = settings.Required, 1226 CssClass = settings.CssClass, 1227 ExtraAttributes = settings.ExtraAttributes, 1228 ErrorMessage = settings.ErrorMessage, 1229 Placeholder = settings.Placeholder, 1230 Type = TextFieldType.Email 1231 }; 1232 1233 @RenderTextField(emailField) 1234 break; 1235 case FieldType.Hidden: 1236 HiddenField hiddenField = new HiddenField 1237 { 1238 Label = settings.Label, 1239 Id = settings.Id, 1240 Value = settings.Value, 1241 Disabled = settings.Disabled, 1242 Required = settings.Required, 1243 CssClass = settings.CssClass, 1244 ExtraAttributes = settings.ExtraAttributes, 1245 ErrorMessage = settings.ErrorMessage 1246 }; 1247 1248 @RenderHiddenField(hiddenField) 1249 break; 1250 case FieldType.Integer: 1251 NumberField numberField = new NumberField 1252 { 1253 Label = settings.Label, 1254 Id = settings.Id, 1255 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1256 OnClick = settings.OnClick, 1257 Disabled = settings.Disabled, 1258 Required = settings.Required, 1259 CssClass = settings.CssClass, 1260 ExtraAttributes = settings.ExtraAttributes, 1261 ErrorMessage = settings.ErrorMessage, 1262 Step = 1 1263 }; 1264 1265 @RenderNumberField(numberField) 1266 break; 1267 case FieldType.Password: 1268 TextField passwordField = new TextField 1269 { 1270 Label = settings.Label != null ? settings.Label : Translate("Password"), 1271 Id = settings.Id, 1272 Value = settings.Value, 1273 OnClick = settings.OnClick, 1274 Disabled = settings.Disabled, 1275 Required = settings.Required, 1276 CssClass = settings.CssClass, 1277 ExtraAttributes = settings.ExtraAttributes, 1278 ErrorMessage = settings.ErrorMessage, 1279 Placeholder = settings.Placeholder, 1280 Type = TextFieldType.Password 1281 }; 1282 1283 @RenderTextField(passwordField) 1284 break; 1285 case FieldType.Reset: 1286 Button resetField = new Button 1287 { 1288 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1289 Id = settings.Id, 1290 OnClick = settings.OnClick, 1291 Disabled = settings.Disabled, 1292 CssClass = settings.CssClass, 1293 ExtraAttributes = settings.ExtraAttributes, 1294 ButtonLayout = ButtonLayout.Secondary, 1295 ButtonType = ButtonType.Reset 1296 }; 1297 1298 @RenderButton(resetField) 1299 break; 1300 case FieldType.Submit: 1301 Button submitField = new Button 1302 { 1303 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1304 Id = settings.Id, 1305 OnClick = settings.OnClick, 1306 Disabled = settings.Disabled, 1307 CssClass = settings.CssClass, 1308 ExtraAttributes = settings.ExtraAttributes, 1309 ButtonLayout = ButtonLayout.Primary, 1310 ButtonType = ButtonType.Submit 1311 }; 1312 1313 @RenderButton(submitField) 1314 break; 1315 case FieldType.Tel: 1316 TextField telField = new TextField 1317 { 1318 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1319 Id = settings.Id, 1320 Value = settings.Value, 1321 OnClick = settings.OnClick, 1322 Disabled = settings.Disabled, 1323 Required = settings.Required, 1324 CssClass = settings.CssClass, 1325 ExtraAttributes = settings.ExtraAttributes, 1326 ErrorMessage = settings.ErrorMessage, 1327 Placeholder = settings.Placeholder, 1328 Type = TextFieldType.Tel 1329 }; 1330 1331 @RenderTextField(telField) 1332 break; 1333 case FieldType.Text: 1334 TextField textField = new TextField 1335 { 1336 Label = settings.Label, 1337 Id = settings.Id, 1338 Value = settings.Value, 1339 OnClick = settings.OnClick, 1340 Disabled = settings.Disabled, 1341 Required = settings.Required, 1342 CssClass = settings.CssClass, 1343 ExtraAttributes = settings.ExtraAttributes, 1344 ErrorMessage = settings.ErrorMessage, 1345 Placeholder = settings.Placeholder, 1346 Type = TextFieldType.Text 1347 }; 1348 1349 @RenderTextField(textField) 1350 break; 1351 case FieldType.Textarea: 1352 TextareaField textareaField = new TextareaField 1353 { 1354 Label = settings.Label, 1355 Id = settings.Id, 1356 Value = settings.Value, 1357 OnClick = settings.OnClick, 1358 Disabled = settings.Disabled, 1359 Required = settings.Required, 1360 CssClass = settings.CssClass, 1361 ExtraAttributes = settings.ExtraAttributes, 1362 ErrorMessage = settings.ErrorMessage, 1363 Placeholder = settings.Placeholder 1364 }; 1365 1366 @RenderTextareaField(textareaField) 1367 break; 1368 default: 1369 TextField defaultField = new TextField 1370 { 1371 Label = settings.Label, 1372 Id = settings.Id, 1373 Value = settings.Value, 1374 OnClick = settings.OnClick, 1375 Disabled = settings.Disabled, 1376 Required = settings.Required, 1377 CssClass = settings.CssClass, 1378 ExtraAttributes = settings.ExtraAttributes, 1379 ErrorMessage = settings.ErrorMessage, 1380 Placeholder = settings.Placeholder, 1381 Type = TextFieldType.Text 1382 }; 1383 1384 @RenderTextField(defaultField) 1385 break; 1386 } 1387 } 1388 } 1389 1390 1391 @using Dynamicweb.Frontend 1392 @using System.Reflection 1393 @using Dynamicweb.Content.Items 1394 @using System.Web.UI.HtmlControls 1395 @using Dynamicweb.Rapido.Blocks.Components 1396 @using Dynamicweb.Rapido.Blocks 1397 1398 1399 @* Components for the articles *@ 1400 @using System.Reflection 1401 @using Dynamicweb.Rapido.Blocks.Components.Articles 1402 1403 1404 @* Component for the articles *@ 1405 1406 @helper RenderArticleBanner(dynamic settings) { 1407 dynamic[] methodParameters = new dynamic[1]; 1408 methodParameters[0] = settings; 1409 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1410 1411 if (customMethod != null) 1412 { 1413 @customMethod.Invoke(this, methodParameters).ToString(); 1414 } else { 1415 string filterClasses = "image-filter image-filter--darken"; 1416 settings.Layout = ArticleHeaderLayout.Banner; 1417 1418 if (settings.Image != null) 1419 { 1420 if (settings.Image.Path != null) 1421 { 1422 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1423 <div class="background-image @filterClasses dw-mod"> 1424 <div class="background-image__wrapper @filterClasses dw-mod"> 1425 @{ 1426 settings.Image.CssClass += "background-image__cover dw-mod"; 1427 } 1428 @RenderImage(settings.Image) 1429 </div> 1430 </div> 1431 <div class="center-container dw-mod"> 1432 <div class="grid"> 1433 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 1434 <div class="u-left-middle"> 1435 <div> 1436 @if (!String.IsNullOrEmpty(settings.Heading)) 1437 { 1438 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1439 } 1440 @if (!String.IsNullOrEmpty(settings.Subheading)) 1441 { 1442 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1443 } 1444 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1445 { 1446 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1447 } 1448 @if (!String.IsNullOrEmpty(settings.Link)) { 1449 <div class="grid__cell"> 1450 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1451 </div> 1452 } 1453 </div> 1454 </div> 1455 </div> 1456 @if (settings.ExternalParagraphId != 0) 1457 { 1458 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 1459 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 1460 @RenderParagraphContent(settings.ExternalParagraphId) 1461 </div> 1462 </div> 1463 } 1464 </div> 1465 </div> 1466 </section> 1467 } 1468 else 1469 { 1470 settings.Layout = ArticleHeaderLayout.Clean; 1471 @RenderArticleCleanHeader(settings); 1472 } 1473 } 1474 else 1475 { 1476 settings.Layout = ArticleHeaderLayout.Clean; 1477 @RenderArticleCleanHeader(settings); 1478 } 1479 } 1480 } 1481 @using System.Reflection 1482 @using Dynamicweb.Rapido.Blocks.Components.General 1483 @using Dynamicweb.Rapido.Blocks.Components.Articles 1484 @using Dynamicweb.Content; 1485 1486 1487 @* Component for the articles *@ 1488 1489 @helper RenderArticleHeader(ArticleHeader settings) { 1490 dynamic[] methodParameters = new dynamic[1]; 1491 methodParameters[0] = settings; 1492 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1493 1494 if (customMethod != null) 1495 { 1496 @customMethod.Invoke(this, methodParameters).ToString(); 1497 } else { 1498 switch (settings.Layout) 1499 { 1500 case ArticleHeaderLayout.Clean: 1501 @RenderArticleCleanHeader(settings); 1502 break; 1503 case ArticleHeaderLayout.Split: 1504 @RenderArticleSplitHeader(settings); 1505 break; 1506 case ArticleHeaderLayout.Banner: 1507 @RenderArticleBannerHeader(settings); 1508 break; 1509 case ArticleHeaderLayout.Overlay: 1510 @RenderArticleOverlayHeader(settings); 1511 break; 1512 default: 1513 @RenderArticleCleanHeader(settings); 1514 break; 1515 } 1516 } 1517 } 1518 1519 @helper RenderArticleCleanHeader(ArticleHeader settings) { 1520 dynamic[] methodParameters = new dynamic[1]; 1521 methodParameters[0] = settings; 1522 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1523 1524 if (customMethod != null) 1525 { 1526 @customMethod.Invoke(this, methodParameters).ToString(); 1527 } 1528 else 1529 { 1530 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1531 int pageId = Dynamicweb.Services.Pages.GetPageByNavigationTag(Dynamicweb.Frontend.PageView.Current().Area.ID, "NewsList").ID; 1532 1533 <div class="grid grid--align-content-start grid--justify-start"> 1534 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1535 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1536 { 1537 <div class="u-border-bottom u-padding-bottom"> 1538 @if (!String.IsNullOrEmpty(settings.Category)) 1539 { 1540 <div class="u-pull--left"> 1541 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1542 </div> 1543 } 1544 <div class="u-pull--right"> 1545 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1546 { 1547 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 1548 } 1549 @if (settings.RatingOutOf != 0) 1550 { 1551 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1552 } 1553 </div> 1554 <div class="newslist-goback"> 1555 <i class="fas fa-chevron-left"></i><a href="/Default.aspx?ID=@pageId">@Translate("Back to newslist")</a> 1556 </div> 1557 </div> 1558 } 1559 1560 <div class="grid__cell"> 1561 @if (!String.IsNullOrEmpty(settings.Heading)) 1562 { 1563 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1564 } 1565 @if (settings.Image != null) 1566 { 1567 if (settings.Image.Path != null) 1568 { 1569 <div class="u-padding-bottom--lg"> 1570 @RenderImage(settings.Image) 1571 </div> 1572 } 1573 } 1574 @if (!String.IsNullOrEmpty(settings.Subheading)) 1575 { 1576 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1577 } 1578 @if (!String.IsNullOrEmpty(settings.Link)) 1579 { 1580 <div class="grid__cell"> 1581 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1582 </div> 1583 } 1584 </div> 1585 </div> 1586 @if (settings.ExternalParagraphId != 0) 1587 { 1588 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1589 @RenderParagraphContent(settings.ExternalParagraphId) 1590 </div> 1591 } 1592 </div> 1593 } 1594 } 1595 1596 @helper RenderArticleSplitHeader(ArticleHeader settings) { 1597 dynamic[] methodParameters = new dynamic[1]; 1598 methodParameters[0] = settings; 1599 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1600 1601 if (customMethod != null) 1602 { 1603 @customMethod.Invoke(this, methodParameters).ToString(); 1604 } 1605 else 1606 { 1607 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1608 1609 if (settings.Image != null) 1610 { 1611 if (settings.Image.Path != null) 1612 { 1613 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1614 <div class="grid"> 1615 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1616 <div class="u-left-middle u-padding--lg"> 1617 <div> 1618 @if (!String.IsNullOrEmpty(settings.Category)) 1619 { 1620 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1621 } 1622 @if (!String.IsNullOrEmpty(settings.Heading)) 1623 { 1624 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1625 } 1626 @if (!String.IsNullOrEmpty(settings.Subheading)) 1627 { 1628 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1629 } 1630 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1631 { 1632 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1633 } 1634 @if (settings.RatingOutOf != 0) 1635 { 1636 <div class="u-pull--right"> 1637 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1638 </div> 1639 } 1640 @if (!String.IsNullOrEmpty(settings.Link)) { 1641 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1642 } 1643 </div> 1644 </div> 1645 </div> 1646 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod" style="background-image:url(/Admin/Public/GetImage.ashx?Format=webp&width=1800&amp;height=1100&amp;crop=0&amp;Compression=85&amp;DoNotUpscale=true&amp;image=@settings.Image.Path); background-position: center center; background-size: cover;"></div> 1647 @if (settings.ExternalParagraphId != 0) 1648 { 1649 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto u-color-light-gray--bg dw-mod"> 1650 @RenderParagraphContent(settings.ExternalParagraphId) 1651 </div> 1652 } 1653 </div> 1654 </section> 1655 } 1656 } 1657 else 1658 { 1659 @RenderArticleCleanHeader(settings); 1660 } 1661 } 1662 } 1663 1664 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 1665 dynamic[] methodParameters = new dynamic[1]; 1666 methodParameters[0] = settings; 1667 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1668 1669 if (customMethod != null) 1670 { 1671 @customMethod.Invoke(this, methodParameters).ToString(); 1672 } 1673 else 1674 { 1675 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1676 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1677 1678 if (settings.Image != null) 1679 { 1680 if (settings.Image.Path != null) 1681 { 1682 if (settings.ExternalParagraphId == 0) 1683 { 1684 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1685 <div class="background-image image-filter image-filter--darken dw-mod"> 1686 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1687 @{ 1688 settings.Image.CssClass += "background-image__cover dw-mod"; 1689 } 1690 @RenderImage(settings.Image) 1691 </div> 1692 </div> 1693 <div class="center-container dw-mod"> 1694 <div class="grid @contentAlignment"> 1695 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1696 @if (!String.IsNullOrEmpty(settings.Heading)) 1697 { 1698 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1699 } 1700 @if (!String.IsNullOrEmpty(settings.Subheading)) 1701 { 1702 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1703 } 1704 <div class="u-margin-top"> 1705 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1706 { 1707 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1708 } 1709 @if (settings.RatingOutOf != 0) 1710 { 1711 <div class="u-pull--right"> 1712 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1713 </div> 1714 } 1715 </div> 1716 @if (!String.IsNullOrEmpty(settings.Link)) 1717 { 1718 <div class="grid__cell"> 1719 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1720 </div> 1721 } 1722 </div> 1723 </div> 1724 </div> 1725 </section> 1726 } 1727 else 1728 { 1729 @RenderArticleBanner(settings); 1730 } 1731 } 1732 } 1733 else 1734 { 1735 @RenderArticleCleanHeader(settings); 1736 } 1737 } 1738 } 1739 1740 @helper RenderArticleBannerHeader(dynamic settings) { 1741 dynamic[] methodParameters = new dynamic[1]; 1742 methodParameters[0] = settings; 1743 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1744 1745 if (customMethod != null) 1746 { 1747 @customMethod.Invoke(this, methodParameters).ToString(); 1748 } 1749 else 1750 { 1751 @RenderArticleBanner(settings); 1752 } 1753 } 1754 @using System.Reflection 1755 @using System.Text.RegularExpressions; 1756 @using Dynamicweb.Frontend 1757 @using Dynamicweb.Content.Items 1758 @using Dynamicweb.Rapido.Blocks.Components 1759 @using Dynamicweb.Rapido.Blocks.Components.Articles 1760 @using Dynamicweb.Rapido.Blocks 1761 1762 @* Component for the articles *@ 1763 1764 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1765 { 1766 dynamic[] methodParameters = new dynamic[1]; 1767 methodParameters[0] = settings; 1768 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1769 1770 if (customMethod != null) 1771 { 1772 @customMethod.Invoke(this, methodParameters).ToString(); 1773 } else { 1774 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1775 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1776 1777 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1778 @RenderBlockList(settings.SubBlocks) 1779 </div> 1780 } 1781 } 1782 @using System.Reflection 1783 @using Dynamicweb.Rapido.Blocks.Components 1784 @using Dynamicweb.Rapido.Blocks.Components.General 1785 @using Dynamicweb.Rapido.Blocks.Components.Articles 1786 @using Dynamicweb.Rapido.Blocks 1787 1788 @* Component for the articles *@ 1789 1790 @helper RenderArticleImage(ArticleImage settings) 1791 { 1792 dynamic[] methodParameters = new dynamic[1]; 1793 methodParameters[0] = settings; 1794 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1795 1796 if (customMethod != null) 1797 { 1798 @customMethod.Invoke(this, methodParameters).ToString(); 1799 } 1800 else 1801 { 1802 if (settings.Image != null) 1803 { 1804 if (settings.Image.Path != null) 1805 { 1806 <div class="u-margin-bottom--lg"> 1807 @RenderImage(settings.Image) 1808 </div> 1809 } 1810 } 1811 } 1812 } 1813 @using System.Reflection 1814 @using Dynamicweb.Rapido.Blocks.Components 1815 @using Dynamicweb.Rapido.Blocks.Components.Articles 1816 1817 1818 @* Component for the articles *@ 1819 1820 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1821 { 1822 dynamic[] methodParameters = new dynamic[1]; 1823 methodParameters[0] = settings; 1824 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1825 1826 if (customMethod != null) 1827 { 1828 @customMethod.Invoke(this, methodParameters).ToString(); 1829 } else { 1830 if (!String.IsNullOrEmpty(settings.Title)) 1831 { 1832 <h2 class="article__header">@settings.Title</h2> 1833 } 1834 } 1835 } 1836 @using System.Reflection 1837 @using Dynamicweb.Rapido.Blocks.Components 1838 @using Dynamicweb.Rapido.Blocks.Components.Articles 1839 @using Dynamicweb.Rapido.Blocks 1840 1841 1842 @* Component for the articles *@ 1843 1844 @helper RenderArticleText(ArticleText settings) 1845 { 1846 dynamic[] methodParameters = new dynamic[1]; 1847 methodParameters[0] = settings; 1848 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 1849 1850 if (customMethod != null) 1851 { 1852 @customMethod.Invoke(this, methodParameters).ToString(); 1853 } else { 1854 if (!String.IsNullOrEmpty(settings.Text)) 1855 { 1856 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 1857 1858 <div class="article__paragraph @greatTextClass"> 1859 @settings.Text 1860 </div> 1861 } 1862 } 1863 } 1864 @using System.Reflection 1865 @using Dynamicweb.Rapido.Blocks.Components 1866 @using Dynamicweb.Rapido.Blocks.Components.Articles 1867 @using Dynamicweb.Rapido.Blocks 1868 1869 1870 @* Component for the articles *@ 1871 1872 @helper RenderArticleQuote(ArticleQuote settings) 1873 { 1874 dynamic[] methodParameters = new dynamic[1]; 1875 methodParameters[0] = settings; 1876 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 1877 1878 if (customMethod != null) 1879 { 1880 @customMethod.Invoke(this, methodParameters).ToString(); 1881 } else { 1882 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 1883 1884 <div class="grid u-padding-bottom--lg"> 1885 @if (settings.Image != null) 1886 { 1887 if (settings.Image.Path != null) { 1888 <div class="grid__col-3"> 1889 <div class="grid__cell-img"> 1890 @{ 1891 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 1892 settings.Image.CssClass += " article__image article__image--ball"; 1893 settings.Image.ImageDefault.Width = 200; 1894 settings.Image.ImageDefault.Height = 200; 1895 } 1896 @RenderImage(settings.Image) 1897 </div> 1898 </div> 1899 } 1900 } 1901 <div class="grid__col-auto"> 1902 @if (!String.IsNullOrEmpty(settings.Text)) 1903 { 1904 <div class="article__quote dw-mod"> 1905 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 1906 @settings.Text 1907 <i class="fas fa-quote-right"></i> 1908 </div> 1909 } 1910 @if (!String.IsNullOrEmpty(settings.Author)) 1911 { 1912 <div class="article__quote-author dw-mod"> 1913 - @settings.Author 1914 </div> 1915 } 1916 </div> 1917 </div> 1918 } 1919 } 1920 @using System.Reflection 1921 @using Dynamicweb.Rapido.Blocks.Components 1922 @using Dynamicweb.Rapido.Blocks.Components.Articles 1923 @using Dynamicweb.Rapido.Blocks 1924 1925 @* Component for the articles *@ 1926 1927 @helper RenderArticleInfoTable(ArticleInfoTable settings) 1928 { 1929 dynamic[] methodParameters = new dynamic[1]; 1930 methodParameters[0] = settings; 1931 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 1932 1933 if (customMethod != null) 1934 { 1935 @customMethod.Invoke(this, methodParameters).ToString(); 1936 } else { 1937 <table class="table table--clean"> 1938 @foreach (var row in settings.Rows) 1939 { 1940 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 1941 1942 <tr> 1943 @if (!String.IsNullOrEmpty(row.Icon)) 1944 { 1945 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 1946 } 1947 <td class="u-no-margin-on-p-elements"> 1948 <div class="u-bold">@row.Title</div> 1949 @if (!String.IsNullOrEmpty(row.SubTitle)) 1950 { 1951 if (row.Link == null) 1952 { 1953 <div>@row.SubTitle</div> 1954 } 1955 else 1956 { 1957 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 1958 } 1959 } 1960 </td> 1961 </tr> 1962 } 1963 </table> 1964 } 1965 } 1966 @using System.Reflection 1967 @using Dynamicweb.Rapido.Blocks.Components 1968 @using Dynamicweb.Rapido.Blocks.Components.Articles 1969 @using Dynamicweb.Rapido.Blocks 1970 1971 @* Component for the articles *@ 1972 1973 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 1974 { 1975 dynamic[] methodParameters = new dynamic[1]; 1976 methodParameters[0] = settings; 1977 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1978 1979 if (customMethod != null) 1980 { 1981 @customMethod.Invoke(this, methodParameters).ToString(); 1982 } 1983 else 1984 { 1985 <input type="checkbox" id="ParagraphGalleryModalTrigger" class="modal-trigger" /> 1986 <div class="modal-container"> 1987 <label for="ParagraphGalleryModalTrigger" id="ParagraphGalleryModalOverlay" class="modal-overlay"></label> 1988 <div class="modal modal--full" id="ParagraphGalleryModal"> 1989 <div class="modal__body modal__body--full"> 1990 <div class="modal__image-min-size-wrapper"> 1991 <img src="/Files/Images/placeholder.gif" id="ParagraphGallery" class="modal--full__img dw-mod" alt=""> 1992 </div> 1993 <div class="modal__images-counter" id="ParagraphGallery_counter"></div> 1994 <button class="modal__prev-btn dw-mod" id="ParagraphGallery_prev" onclick="Gallery.prevImage('ParagraphGallery')" type="button"> 1995 <i class="far fa-angle-left"></i> 1996 </button> 1997 <button class="modal__next-btn dw-mod" id="ParagraphGallery_next" onclick="Gallery.nextImage('ParagraphGallery')" type="button"> 1998 <i class="far fa-angle-right"></i> 1999 </button> 2000 </div> 2001 <label class="modal__close-btn" for="ParagraphGalleryModalTrigger"></label> 2002 </div> 2003 </div> 2004 } 2005 } 2006 @using System.Reflection 2007 @using Dynamicweb.Rapido.Blocks.Components 2008 @using Dynamicweb.Rapido.Blocks.Components.Articles 2009 @using Dynamicweb.Rapido.Blocks 2010 2011 2012 @* Component for the articles *@ 2013 2014 @helper RenderArticleRelated(ArticleRelated settings) 2015 { 2016 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2017 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2018 2019 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2020 <div class="center-container dw-mod"> 2021 <div class="grid u-padding"> 2022 <div class="grid__col-md-12 grid__col-xs-12"> 2023 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2024 </div> 2025 </div> 2026 2027 <div class="js-handlebars-root u-padding" id="@settings.Title.Replace(" ", String.Empty)" data-template="RelatedSimpleTemplate" data-json-feed="/Default.aspx?ID=@settings.FeedPageId&@settings.Query&ExcludeItemID=@settings.CurrentPageId&PageSize=@settings.PageSize"></div> 2028 2029 <script id="RelatedSimpleTemplate" type="text/x-template"> 2030 {{#.}} 2031 <div class="grid u-padding-bottom--lg"> 2032 {{#Cases}} 2033 <div class="grid__col-3 image-hover--zoom dw-mod"> 2034 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2035 {{#if image}} 2036 <div class="u-color-light--bg u-no-padding dw-mod"> 2037 <div class="flex-img image-hover__wrapper"> 2038 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=680&height=314&amp;crop=1&amp;DoNotUpscale=True&amp;Compression=95&amp;image={{image}}" alt="{{title}}" /> 2039 </div> 2040 </div> 2041 {{/if}} 2042 2043 <div class="card u-color-light--bg dw-mod"> 2044 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2045 <p class="article__short-summary dw-mod">{{summary}}</p> 2046 </div> 2047 </a> 2048 </div> 2049 {{/Cases}} 2050 </div> 2051 {{/.}} 2052 </script> 2053 </div> 2054 </section> 2055 } 2056 @using System.Reflection 2057 @using Dynamicweb.Rapido.Blocks.Components 2058 @using Dynamicweb.Rapido.Blocks.Components.Articles 2059 @using Dynamicweb.Rapido.Blocks 2060 2061 2062 @* Component for the articles *@ 2063 2064 @helper RenderArticleMenu(ArticleMenu settings) 2065 { 2066 dynamic[] methodParameters = new dynamic[1]; 2067 methodParameters[0] = settings; 2068 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2069 2070 if (customMethod != null) 2071 { 2072 @customMethod.Invoke(this, methodParameters).ToString(); 2073 } else { 2074 if (!String.IsNullOrEmpty(settings.Title)) { 2075 <div class="u-margin u-border-bottom"> 2076 <h3 class="u-no-margin">@settings.Title</h3> 2077 </div> 2078 } 2079 2080 <ul class="menu-left u-margin-bottom dw-mod"> 2081 @foreach (var item in settings.Items) 2082 { 2083 @RenderArticleMenuItem(item) 2084 } 2085 </ul> 2086 } 2087 } 2088 2089 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2090 { 2091 dynamic[] methodParameters = new dynamic[1]; 2092 methodParameters[0] = settings; 2093 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2094 2095 if (customMethod != null) 2096 { 2097 @customMethod.Invoke(this, methodParameters).ToString(); 2098 } else { 2099 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2100 2101 if (!String.IsNullOrEmpty(settings.Title)) { 2102 <li class="menu-left__item dw-mod"> 2103 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2104 </li> 2105 } 2106 } 2107 } 2108 @using System.Reflection 2109 @using Dynamicweb.Rapido.Blocks.Components 2110 @using Dynamicweb.Rapido.Blocks.Components.Articles 2111 @using Dynamicweb.Rapido.Blocks 2112 2113 @* Component for the articles *@ 2114 2115 @helper RenderArticleList(ArticleList settings) 2116 { 2117 dynamic[] methodParameters = new dynamic[1]; 2118 methodParameters[0] = settings; 2119 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2120 2121 if (customMethod != null) 2122 { 2123 @customMethod.Invoke(this, methodParameters).ToString(); 2124 } else { 2125 if (Pageview != null) 2126 { 2127 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2128 string[] sortArticlesListBy = new string[2]; 2129 2130 if (isParagraph) { 2131 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2132 } 2133 else { 2134 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2135 } 2136 2137 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2138 2139 @RenderItemList(new 2140 { 2141 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2142 ListSourceType = settings.SourceType, 2143 ListSourcePage = sourcePage, 2144 ItemFieldsList = "*", 2145 Filter = settings.Filter, 2146 ListOrderBy = sortArticlesListBy[0], 2147 ListOrderByDirection = sortArticlesListBy[1], 2148 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2149 ListSecondOrderByDirection = "ASC", 2150 IncludeAllChildItems = true, 2151 ListTemplate = settings.Template, 2152 ListPageSize = settings.PageSize.ToString() 2153 }); 2154 } 2155 } 2156 } 2157 @using System.Reflection 2158 @using Dynamicweb.Rapido.Blocks.Components.Articles 2159 2160 2161 @* Component for the articles *@ 2162 2163 @helper RenderArticleSummary(ArticleSummary settings) 2164 { 2165 dynamic[] methodParameters = new dynamic[1]; 2166 methodParameters[0] = settings; 2167 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2168 2169 if (customMethod != null) 2170 { 2171 @customMethod.Invoke(this, methodParameters).ToString(); 2172 } else { 2173 if (!String.IsNullOrEmpty(settings.Text)) 2174 { 2175 <div class="article__summary dw-mod">@settings.Text</div> 2176 } 2177 } 2178 } 2179 @using System.Reflection 2180 @using Dynamicweb.Rapido.Blocks.Components 2181 @using Dynamicweb.Rapido.Blocks.Components.Articles 2182 @using Dynamicweb.Rapido.Blocks 2183 2184 @* Component for the articles *@ 2185 2186 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2187 { 2188 dynamic[] methodParameters = new dynamic[1]; 2189 methodParameters[0] = settings; 2190 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2191 2192 if (customMethod != null) 2193 { 2194 @customMethod.Invoke(this, methodParameters).ToString(); 2195 } else { 2196 string pageId = Pageview.ID.ToString(); 2197 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2198 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2199 2200 foreach (var option in settings.Categories) 2201 { 2202 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2203 } 2204 2205 if (selectedFilter == pageId) 2206 { 2207 selectedFilter = Translate("All"); 2208 } 2209 2210 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2211 { 2212 <div class="u-pull--right u-margin-left"> 2213 <div class="collection u-no-margin"> 2214 <h5>@Translate("Category")</h5> 2215 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2216 <div class="dropdown u-w180px dw-mod"> 2217 <label class="dropdown__header dropdown__btn" for="CategorySelector">@Translate(selectedFilter)</label> 2218 <div class="dropdown__content dw-mod"> 2219 @foreach (var option in settings.Categories) 2220 { 2221 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2222 } 2223 </div> 2224 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2225 </div> 2226 </div> 2227 </div> 2228 } 2229 else 2230 { 2231 <div class="u-full-width u-margin-bottom"> 2232 <h5 class="u-no-margin">@Translate("Category")</h5> 2233 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2234 <div class="dropdown u-full-width dw-mod"> 2235 <label class="dropdown__header dropdown__btn" for="CategorySelector">@Translate(selectedFilter)</label> 2236 <div class="dropdown__content dw-mod"> 2237 @foreach (var option in settings.Categories) 2238 { 2239 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2240 } 2241 </div> 2242 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2243 </div> 2244 </div> 2245 } 2246 } 2247 } 2248 @using System.Reflection 2249 @using Dynamicweb.Rapido.Blocks.Components 2250 @using Dynamicweb.Rapido.Blocks.Components.Articles 2251 @using Dynamicweb.Rapido.Blocks 2252 2253 @* Component for the articles *@ 2254 2255 @helper RenderArticleListFilter(ArticleListFilter settings) 2256 { 2257 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2258 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2259 2260 if (settings.Options != null) 2261 { 2262 foreach (var option in settings.Options) 2263 { 2264 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2265 } 2266 2267 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2268 { 2269 <div class="u-pull--right u-margin-left"> 2270 <div class="collection u-no-margin"> 2271 <h5>@settings.Label</h5> 2272 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2273 <div class="dropdown u-w180px dw-mod"> 2274 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2275 <div class="dropdown__content dw-mod"> 2276 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2277 @foreach (var option in settings.Options) 2278 { 2279 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2280 } 2281 </div> 2282 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2283 </div> 2284 </div> 2285 </div> 2286 } 2287 else 2288 { 2289 <div class="u-full-width u-margin-bottom"> 2290 <h5 class="u-no-margin">@settings.Label</h5> 2291 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2292 <div class="dropdown u-full-width w-mod"> 2293 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2294 <div class="dropdown__content dw-mod"> 2295 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2296 @foreach (var option in settings.Options) 2297 { 2298 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2299 } 2300 </div> 2301 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2302 </div> 2303 </div> 2304 } 2305 } 2306 } 2307 @using System.Reflection 2308 @using Dynamicweb.Rapido.Blocks.Components 2309 @using Dynamicweb.Rapido.Blocks.Components.Articles 2310 @using Dynamicweb.Rapido.Blocks 2311 2312 @* Component for the articles *@ 2313 2314 @helper RenderArticleListSearch(ArticleListSearch settings) 2315 { 2316 dynamic[] methodParameters = new dynamic[1]; 2317 methodParameters[0] = settings; 2318 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2319 2320 if (customMethod != null) 2321 { 2322 @customMethod.Invoke(this, methodParameters).ToString(); 2323 } else { 2324 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2325 string className = "u-w340px u-pull--right u-margin-left"; 2326 2327 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2328 { 2329 className = "u-full-width"; 2330 } 2331 2332 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2333 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2334 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2335 </div> 2336 } 2337 } 2338 @using System.Reflection 2339 @using Dynamicweb.Rapido.Blocks.Components 2340 @using Dynamicweb.Rapido.Blocks.Components.Articles 2341 @using Dynamicweb.Rapido.Blocks 2342 2343 @* Component for the articles *@ 2344 2345 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2346 { 2347 dynamic[] methodParameters = new dynamic[1]; 2348 methodParameters[0] = settings; 2349 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2350 2351 if (customMethod != null) 2352 { 2353 @customMethod.Invoke(this, methodParameters).ToString(); 2354 } else { 2355 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2356 } 2357 } 2358 @using System.Reflection 2359 @using Dynamicweb.Rapido.Blocks.Components 2360 @using Dynamicweb.Rapido.Blocks.Components.General 2361 @using Dynamicweb.Rapido.Blocks.Components.Articles 2362 @using Dynamicweb.Rapido.Blocks 2363 @using System.Text.RegularExpressions 2364 2365 @* Component for the articles *@ 2366 2367 @helper RenderArticleListItem(ArticleListItem settings) 2368 { 2369 switch (settings.Type) { 2370 case ArticleListItemType.Card: 2371 @RenderArticleListItemCard(settings); 2372 break; 2373 case ArticleListItemType.List: 2374 @RenderArticleListItemList(settings); 2375 break; 2376 case ArticleListItemType.Simple: 2377 @RenderArticleListItemSimple(settings); 2378 break; 2379 default: 2380 @RenderArticleListItemCard(settings); 2381 break; 2382 } 2383 } 2384 2385 @helper RenderArticleListItemCard(ArticleListItem settings) { 2386 2387 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2388 <div class="u-color-light--bg u-no-padding dw-mod article-list-item__image-container"> 2389 @if (settings.Logo != null) 2390 { 2391 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?Format=webp&width=992&amp;height=760&amp;crop=0&amp;Compression=95&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; 2392 settings.Logo.ImageDefault.Crop = 5; 2393 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2394 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2395 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2396 @if (settings.Stickers != null) 2397 { 2398 if (settings.Stickers.Position != StickersListPosition.Custom) 2399 { 2400 @RenderStickersCollection(settings.Stickers); 2401 } 2402 } 2403 @RenderImage(settings.Logo) 2404 </div> 2405 } else if (settings.Image != null) 2406 { 2407 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2408 @if (settings.Stickers != null) 2409 { 2410 if (settings.Stickers.Position != StickersListPosition.Custom) 2411 { 2412 @RenderStickersCollection(settings.Stickers); 2413 } 2414 } 2415 @RenderImage(settings.Image) 2416 </div> 2417 } 2418 </div> 2419 2420 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2421 { 2422 <div class="card u-color-light--bg dw-mod"> 2423 @if (settings.Stickers != null) 2424 { 2425 if (settings.Stickers.Position == StickersListPosition.Custom) 2426 { 2427 @RenderStickersCollection(settings.Stickers); 2428 } 2429 } 2430 @if (!String.IsNullOrEmpty(settings.Title)) 2431 { 2432 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2433 } 2434 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2435 { 2436 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2437 } 2438 @if (!String.IsNullOrEmpty(settings.Summary)) 2439 { 2440 <p class="article__short-summary dw-mod">@settings.Summary</p> 2441 } 2442 </div> 2443 } 2444 </a> 2445 } 2446 2447 @helper RenderArticleListItemList(ArticleListItem settings) { 2448 <a href="@settings.Link"> 2449 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2450 <div class="grid__col-md-3"> 2451 <div class="u-color-light--bg u-no-padding dw-mod"> 2452 @if (settings.Logo != null) 2453 { 2454 string backgroundImage = settings.Image != null ? "background-image:url(/Admin/Public/GetImage.ashx?Format=webp&width=992&amp;height=760&amp;crop=0&amp;Compression=95&amp;DoNotUpscale=True&amp;image=" + settings.Image.Path + "); background-size: cover;" : ""; 2455 settings.Logo.ImageDefault.Crop = 5; 2456 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2457 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2458 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2459 @if (settings.Stickers != null) 2460 { 2461 if (settings.Stickers.Position != StickersListPosition.Custom) 2462 { 2463 @RenderStickersCollection(settings.Stickers); 2464 } 2465 } 2466 @RenderImage(settings.Logo) 2467 </div> 2468 } else if (settings.Image != null) 2469 { 2470 <div class="flex-img image-hover__wrapper dw-mod"> 2471 @if (settings.Stickers != null) 2472 { 2473 if (settings.Stickers.Position != StickersListPosition.Custom) 2474 { 2475 @RenderStickersCollection(settings.Stickers); 2476 } 2477 } 2478 @RenderImage(settings.Image) 2479 </div> 2480 } 2481 </div> 2482 </div> 2483 2484 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2485 { 2486 <div class="grid__col-md-9"> 2487 @if (!String.IsNullOrEmpty(settings.Title)) 2488 { 2489 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2490 } 2491 @if (settings.Stickers != null) 2492 { 2493 if (settings.Stickers.Position == StickersListPosition.Custom) 2494 { 2495 @RenderStickersCollection(settings.Stickers); 2496 } 2497 } 2498 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2499 { 2500 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2501 } 2502 @if (!String.IsNullOrEmpty(settings.Summary)) 2503 { 2504 <p class="article__short-summary dw-mod">@settings.Summary</p> 2505 } 2506 </div> 2507 } 2508 </div> 2509 </a> 2510 } 2511 2512 @helper RenderArticleListItemSimple(ArticleListItem settings) { 2513 <a href="@settings.Link" class="u-color-inherit"> 2514 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2515 <div class="grid__col-md-12"> 2516 @if (!String.IsNullOrEmpty(settings.Title)) 2517 { 2518 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 2519 } 2520 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2521 { 2522 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2523 } 2524 </div> 2525 </div> 2526 </a> 2527 } 2528 @using System.Reflection 2529 @using Dynamicweb.Rapido.Blocks.Components.Articles 2530 2531 2532 @* Component for the articles *@ 2533 2534 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2535 { 2536 dynamic[] methodParameters = new dynamic[1]; 2537 methodParameters[0] = settings; 2538 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2539 2540 if (customMethod != null) 2541 { 2542 @customMethod.Invoke(this, methodParameters).ToString(); 2543 } else { 2544 <small class="article__subscription"> 2545 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2546 { 2547 <text>@Translate("Written")</text> 2548 } 2549 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2550 { 2551 <text>@Translate("by") @settings.Author</text> 2552 } 2553 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2554 { 2555 <text>@Translate("on") @settings.Date</text> 2556 } 2557 </small> 2558 } 2559 } 2560 @using System.Reflection 2561 @using Dynamicweb.Rapido.Blocks.Components.Articles 2562 2563 2564 @* Component for the articles *@ 2565 2566 @helper RenderArticleLink(ArticleLink settings) 2567 { 2568 dynamic[] methodParameters = new dynamic[1]; 2569 methodParameters[0] = settings; 2570 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2571 2572 if (customMethod != null) 2573 { 2574 @customMethod.Invoke(this, methodParameters).ToString(); 2575 } else { 2576 if (!String.IsNullOrEmpty(settings.Title)) 2577 { 2578 <div class="grid__cell"> 2579 @RenderButton(settings) 2580 </div> 2581 } 2582 } 2583 } 2584 @using System.Reflection 2585 @using Dynamicweb.Rapido.Blocks 2586 @using Dynamicweb.Rapido.Blocks.Components.Articles 2587 @using Dynamicweb.Rapido.Blocks.Components.General 2588 2589 2590 @* Component for the articles *@ 2591 2592 @helper RenderArticleCarousel(ArticleCarousel settings) 2593 { 2594 dynamic[] methodParameters = new dynamic[1]; 2595 methodParameters[0] = settings; 2596 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2597 2598 if (customMethod != null) 2599 { 2600 @customMethod.Invoke(this, methodParameters).ToString(); 2601 } else { 2602 <div class="grid"> 2603 <div class="grid__col-12"> 2604 <div class="carousel" id="carousel_@settings.Id"> 2605 <div class="carousel__container js-carousel-slides dw-mod"> 2606 @RenderBlockList(settings.SubBlocks) 2607 </div> 2608 </div> 2609 </div> 2610 </div> 2611 2612 <script> 2613 document.addEventListener("DOMContentLoaded", function () { 2614 new CarouselModule("#carousel_@settings.Id", { 2615 slideTime: 0, 2616 dots: true 2617 }); 2618 }); 2619 </script> 2620 } 2621 } 2622 2623 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2624 { 2625 dynamic[] methodParameters = new dynamic[1]; 2626 methodParameters[0] = settings; 2627 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2628 2629 if (customMethod != null) 2630 { 2631 @customMethod.Invoke(this, methodParameters).ToString(); 2632 } 2633 else 2634 { 2635 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2636 2637 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2638 if (settings.ImageSettings != null) 2639 { 2640 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2641 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2642 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2643 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2644 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2645 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2646 } 2647 defaultImage += "&Image=" + settings.Image; 2648 2649 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2650 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2651 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2652 <div class="article-list__item-info"> 2653 @if (settings.Stickers != null) 2654 { 2655 settings.Stickers.Position = StickersListPosition.Custom; 2656 @RenderStickersCollection(settings.Stickers); 2657 } 2658 2659 <small class="u-margin-top--lg u-color-light"> 2660 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2661 { 2662 <text>@Translate("Written")</text> 2663 } 2664 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2665 { 2666 <text>@Translate("by") @settings.Author</text> 2667 } 2668 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2669 { 2670 <text>@Translate("on") @settings.Date</text> 2671 } 2672 </small> 2673 </div> 2674 2675 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2676 </a> 2677 @if (settings.UseFilters == true) 2678 { 2679 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2680 } 2681 </div> 2682 } 2683 } 2684 @using System.Text.RegularExpressions 2685 @using Dynamicweb.Rapido.Blocks.Components 2686 @using Dynamicweb.Rapido.Blocks.Components.General 2687 @using Dynamicweb.Rapido.Blocks.Components.Articles 2688 @using Dynamicweb.Rapido.Blocks 2689 2690 @* Component for the articles *@ 2691 2692 @helper RenderArticleVideo(ArticleVideo settings) 2693 { 2694 dynamic[] methodParameters = new dynamic[1]; 2695 methodParameters[0] = settings; 2696 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2697 2698 if (customMethod != null) 2699 { 2700 @customMethod.Invoke(this, methodParameters).ToString(); 2701 } else { 2702 if (settings.Url != null) 2703 { 2704 //getting video ID from youtube URL 2705 string videoCode = settings.Url; 2706 Regex regex = new Regex(@".be\/(.[^?]*)"); 2707 Match match = regex.Match(videoCode); 2708 string videoId = ""; 2709 if (match.Success) 2710 { 2711 videoId = match.Groups[1].Value; 2712 } 2713 else 2714 { 2715 regex = new Regex(@"v=([^&]+)"); 2716 match = regex.Match(videoCode); 2717 if (match.Success) 2718 { 2719 videoId = match.Groups[1].Value; 2720 } 2721 } 2722 2723 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 2724 2725 <div class="video-wrapper"> 2726 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 2727 </div> 2728 } 2729 } 2730 } 2731 2732 2733 2734 @* Simple helpers *@ 2735 2736 @*Requires the Gallery ItemType that comes with Rapido*@ 2737 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 2738 if (gallery != null && gallery.Count > 0) 2739 { 2740 int count = 1; 2741 2742 foreach (var item in gallery) 2743 { 2744 if (item.GetFile("ImagePath") != null) 2745 { 2746 string image = item.GetFile("ImagePath").PathUrlEncoded; 2747 string imagePrefix = "/Admin/Public/GetImage.ashx?Format=webp&width=1200&amp;height=820&amp;crop=5&amp;Compression=95&amp;DoNotUpscale=1&amp;image="; 2748 int imagesCount = gallery.Count; 2749 2750 if (count == 1) 2751 { 2752 <label class="gallery" for="ParagraphGalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 2753 <span class="gallery__main-image"> 2754 <img src="/Admin/Public/GetImage.ashx?Format=webp&width=992&amp;height=760&amp;crop=0&amp;Compression=95&amp;DoNotUpscale=1&amp;image=@image" class="flex-img js-gallery" alt="" data-for="ParagraphGallery" data-image="@imagePrefix@image" /> 2755 </span> 2756 <span class="gallery__image-counter"> 2757 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 2758 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 2759 </span> 2760 </label> 2761 } 2762 else 2763 { 2764 <div class="u-hidden js-gallery" data-for="ParagraphGallery" data-image="@imagePrefix@image"></div> 2765 } 2766 2767 count++; 2768 } 2769 } 2770 @RenderArticleGalleryModal(new ArticleGalleryModal()) 2771 } 2772 } 2773 2774 @helper RenderMobileFilters(List<Block> subBlocks) 2775 { 2776 if (subBlocks.Count > 0) 2777 { 2778 <div class="grid__col-12"> 2779 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2780 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 2781 @RenderBlockList(subBlocks) 2782 </div> 2783 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 2784 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 2785 </div> 2786 } 2787 } 2788 2789 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml"))) 2790 { 2791 <text>@using Dynamicweb.Rapido.Blocks.Components.General 2792 </text> 2793 } 2794 2795 2796 @* Include the Blocks for the page *@ 2797 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2798 2799 @using System 2800 @using System.Web 2801 @using System.Collections.Generic 2802 @using Dynamicweb.Rapido.Blocks.Extensibility 2803 @using Dynamicweb.Rapido.Blocks 2804 2805 @{ 2806 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2807 2808 Block tagManager = new Block() 2809 { 2810 Id = "TagManager", 2811 SortId = 1, 2812 Template = RenderGoogleTagManager() 2813 }; 2814 2815 Block facebookPixel = new Block() 2816 { 2817 Id = "FacebookPixel", 2818 SortId = 2, 2819 Template = RenderFacebookPixel() 2820 }; 2821 2822 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 2823 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 2824 } 2825 2826 @helper RenderGoogleTagManager() { 2827 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 2828 2829 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 2830 { 2831 <script> 2832 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 2833 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 2834 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 2835 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 2836 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 2837 </script> 2838 <!-- Google Tag Manager (noscript) --> 2839 <noscript> 2840 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 2841 height="0" width="0" style="display:none;visibility:hidden"></iframe> 2842 </noscript> 2843 <!-- End Google Tag Manager (noscript) --> 2844 } 2845 } 2846 2847 @helper RenderFacebookPixel() { 2848 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 2849 2850 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 2851 { 2852 <!-- Facebook Pixel Code --> 2853 <script> 2854 !function(f,b,e,v,n,t,s) 2855 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2856 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2857 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2858 n.queue=[];t=b.createElement(e);t.async=!0; 2859 t.src=v;s=b.getElementsByTagName(e)[0]; 2860 s.parentNode.insertBefore(t,s)}(window, document,'script', 2861 'https://connect.facebook.net/en_US/fbevents.js'); 2862 fbq('init', '@FacebookPixelID'); 2863 fbq('track', 'PageView'); 2864 </script> 2865 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2866 } 2867 } 2868 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2869 2870 @using System 2871 @using System.Web 2872 @using System.Collections.Generic 2873 @using Dynamicweb.Rapido.Blocks 2874 @using Dynamicweb.Rapido.Blocks.Extensibility 2875 @using Dynamicweb.Security.UserManagement 2876 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2877 @{ 2878 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2879 2880 Block loginModal = new Block() 2881 { 2882 Id = "LoginModal", 2883 SortId = 10, 2884 Template = LoginModal() 2885 }; 2886 2887 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2888 } 2889 2890 @helper LoginModal() 2891 { 2892 int pageId = Model.TopPage.ID; 2893 string userSignedInErrorText = ""; 2894 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2895 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2896 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2897 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 2898 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 2899 bool showModalOnStart = pageId != GetPageIdByNavigationTag("CustomerCenter") && Model.LogOnFailed; 2900 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 2901 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 2902 2903 2904 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 2905 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 2906 { 2907 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 2908 } 2909 2910 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 2911 { 2912 mobileLogo = "/Admin/Public/GetImage.ashx?Format=webp&height=63&amp;Compression=95&amp;image=" + mobileLogo; 2913 } 2914 else 2915 { 2916 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 2917 } 2918 2919 if (Model.LogOnFailed) 2920 { 2921 switch (Model.LogOnFailedReason) 2922 { 2923 case LogOnFailedReason.PasswordLengthInvalid: 2924 userSignedInErrorText = Translate("Password length is invalid", "Lengd lykilorðs ekki rétt", "true"); 2925 break; 2926 case LogOnFailedReason.IncorrectLogin: 2927 userSignedInErrorText = Translate("Invalid email or password", "Ógilt netfang eða lykilorð", "true"); 2928 break; 2929 case LogOnFailedReason.ExceededFailedLogOnLimit: 2930 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked", "Of margar tilraunir. Aðgangi læst tímabundið", "true"); 2931 break; 2932 case LogOnFailedReason.LoginLocked: 2933 userSignedInErrorText = Translate("The user account is temporarily locked", "Þessum aðgangi hefur verið læst tímabundið", "true"); 2934 break; 2935 case LogOnFailedReason.PasswordExpired: 2936 userSignedInErrorText = Translate("The password has expired and needs to be renewed", "Lykilorð þarf að endurnýja", "true"); 2937 break; 2938 default: 2939 userSignedInErrorText = Translate("An unknown error occured", "Villa kom upp. Vinsamlegast reyndu aftur.", "true"); 2940 break; 2941 } 2942 } 2943 2944 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2945 { 2946 if (Model.CurrentUser.ID <= 0) 2947 { 2948 <!-- Trigger for the login modal --> 2949 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @(showModalOnStart ? "checked" : "") /> 2950 } 2951 else 2952 { 2953 <!-- Trigger for the user modal --> 2954 <input type="checkbox" id="UserModalTrigger" class="modal-trigger" @(showModalOnStart ? "checked" : "") /> 2955 } 2956 } 2957 <!-- Login modal --> 2958 <div class="modal-container"> 2959 <div class="modal modal--full" id="SignInModal" title='@Translate("Frontpage")'> 2960 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 2961 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 2962 </a> 2963 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="close-sign-in-modal"> 2964 <img class="cart--icon" src="Files/Images/Icons/X.svg" /> 2965 </label> 2966 2967 <div class="modal__header"> 2968 <h2>@Translate("Sign in", "Innskráning", "true")</h2> 2969 2970 </div> 2971 <div class="modal__body"> 2972 <form method="post" id="LoginForm" class="u-no-margin"> 2973 <input type="hidden" name="ID" value="@pageId" /> 2974 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2975 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2976 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email", "Netfang", "true")" /> 2977 <div class="form__field-group dw-mod"> 2978 2979 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password", "Lykilorð", "true")" /> 2980 <span toggle="#LoginPassword" class="fa fa-fw fa-eye field-icon toggle-password"></span> 2981 <div class="field-error dw-mod">@userSignedInErrorText</div> 2982 </div> 2983 <div class="form__field-group dw-mod remember-me"> 2984 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2985 <label for="LoginRememberMe"> 2986 @Translate("Remember me", "Muna eftir mér", "true") 2987 </label> 2988 </div> 2989 2990 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in", "Innskráning", "true")</button> 2991 @{ 2992 ProviderCollection providers = Provider.GetActiveProviders(); 2993 } 2994 2995 @foreach (Provider LoginProvider in providers) 2996 { 2997 var ProviderName = LoginProvider.Name.ToLower(); 2998 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 2999 } 3000 <div class="login-modal-actions"> 3001 3002 @if (!hideCreateAccountLink) 3003 { 3004 <a class="btn btn--link-clean dw-mod create-account" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account", "Stofna aðgang", "true")</a> 3005 } 3006 @if (!hideForgotPasswordLink) 3007 { 3008 <a class="btn btn--link-clean dw-mod forgot-password" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Gleymt lykilorð?", "true")</a> 3009 } 3010 </div> 3011 </form> 3012 </div> 3013 </div> 3014 </div> 3015 } 3016 @{ 3017 string areaName = PageView.Current().Area.Name; 3018 } 3019 3020 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 3021 { 3022 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3023 3024 @using System 3025 @using System.Web 3026 @using System.Collections.Generic 3027 @using Dynamicweb.Rapido.Blocks.Extensibility 3028 @using Dynamicweb.Rapido.Blocks 3029 3030 3031 @functions { 3032 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 3033 } 3034 3035 3036 @{ 3037 bool mobileOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("mobileOnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3038 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3039 bool mobileHideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart") || mobileOnlyPreview; 3040 3041 Block mobileBanner = new Block() 3042 { 3043 Id = "MobileBanner", 3044 SortId = 10, 3045 Template = RenderMobileBanner(), 3046 3047 }; 3048 3049 Block mobileHeader = new Block() 3050 { 3051 Id = "MobileTop", 3052 SortId = 20, 3053 Template = RenderMobileTop(), 3054 SkipRenderBlocksList = true 3055 }; 3056 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileBanner); 3057 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3058 3059 Block mobileHeaderNavigation = new Block() 3060 { 3061 Id = "MobileHeaderNavigation", 3062 SortId = 10, 3063 Template = RenderMobileHeaderNavigation(), 3064 SkipRenderBlocksList = true, 3065 BlocksList = new List<Block> { 3066 new Block { 3067 Id = "MobileHeaderNavigationTrigger", 3068 SortId = 10, 3069 Template = RenderMobileHeaderNavigationTrigger() 3070 } 3071 } 3072 }; 3073 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3074 3075 Block mobileHeaderLogo = new Block() 3076 { 3077 Id = "MobileHeaderLogo", 3078 SortId = 20, 3079 Template = RenderMobileHeaderLogo(), 3080 SkipRenderBlocksList = true 3081 }; 3082 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3083 3084 Block mobileHeaderActions = new Block() 3085 { 3086 Id = "MobileHeaderActions", 3087 SortId = 30, 3088 Template = RenderMobileTopActions(), 3089 SkipRenderBlocksList = true 3090 }; 3091 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3092 3093 Block mobileHeaderSearch = new Block 3094 { 3095 Id = "MobileHeaderSearch", 3096 SortId = 30, 3097 }; 3098 3099 Block mobileHeaderUser = new Block() 3100 { 3101 Id = "MobileHeaderUser", 3102 SortId = 20, 3103 Template = RenderMobileTopUser(), 3104 }; 3105 3106 Block mobileOpeningHours = new Block() 3107 { 3108 Id = "MobileOpneningHours", 3109 SortId = 10, 3110 Template = RenderMobileTopOpeningHours(), 3111 }; 3112 3113 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3114 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderUser); 3115 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileOpeningHours); 3116 3117 3118 Block mobileHeaderMiniCart; 3119 3120 if (!mobileHideCart) 3121 { 3122 mobileHeaderMiniCart = new Block 3123 { 3124 Id = "MobileHeaderMiniCart", 3125 SortId = 20, 3126 Template = RenderMobileTopMiniCart() 3127 }; 3128 3129 Block customMiniCartCounterScriptTemplate = new Block 3130 { 3131 Id = "MiniCartCounterScriptTemplate", 3132 Template = RenderMobileMiniCartCounterContent() 3133 }; 3134 3135 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", customMiniCartCounterScriptTemplate); 3136 } 3137 else 3138 { 3139 mobileHeaderMiniCart = new Block 3140 { 3141 Id = "MobileHeaderMiniCart", 3142 SortId = 20 3143 }; 3144 } 3145 3146 3147 Block mobileHeaderSearchBar = new Block() 3148 { 3149 Id = "MobileHeaderSearchBar", 3150 SortId = 30, 3151 Template = RenderMobileTopSearchBar() 3152 }; 3153 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3154 3155 3156 switch (mobileTopLayout) 3157 { 3158 case "nav-left": 3159 mobileHeaderNavigation.SortId = 10; 3160 mobileHeaderLogo.SortId = 20; 3161 mobileHeaderActions.SortId = 30; 3162 break; 3163 case "nav-right": 3164 mobileHeaderLogo.SortId = 10; 3165 mobileHeaderActions.SortId = 20; 3166 mobileHeaderNavigation.SortId = 30; 3167 break; 3168 case "nav-search-left": 3169 mobileHeaderNavigation.SortId = 10; 3170 mobileHeaderLogo.SortId = 20; 3171 mobileHeaderActions.SortId = 30; 3172 break; 3173 case "search-left": 3174 mobileHeaderActions.SortId = 10; 3175 mobileHeaderLogo.SortId = 20; 3176 mobileHeaderNavigation.SortId = 30; 3177 mobileHeaderMiniCart.SortId = 0; 3178 break; 3179 } 3180 3181 if (!mobileOnlyPreview) 3182 { 3183 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block 3184 { 3185 Id = "CartInitialization", 3186 Template = RenderMobileCartInitialization() 3187 }); 3188 } 3189 3190 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 3191 3192 Block masterDesktopActionsMenuMiniCart = new Block 3193 { 3194 Id = "MasterDesktopActionsMenuMiniCart", 3195 SortId = 50, 3196 Template = RenderMiniCart(miniCartLayout == "dropdown"), 3197 SkipRenderBlocksList = true, 3198 BlocksList = new List<Block>() 3199 }; 3200 3201 Block miniCartCounterScriptTemplate = new Block 3202 { 3203 Id = "MiniCartCounterScriptTemplate", 3204 Template = RenderMiniCartCounterContent() 3205 }; 3206 3207 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartPanelLayout(); 3208 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 3209 3210 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 3211 { 3212 Id = "MiniCartTrigger", 3213 Template = miniCartTriggerTemplate 3214 }); 3215 3216 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 3217 { 3218 Id = "CustomMiniCartLayout", 3219 Template = layoutTemplate 3220 }); 3221 3222 BlocksPage.GetBlockPage("Master").Add("MobileHeaderActions", masterDesktopActionsMenuMiniCart); 3223 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3224 } 3225 3226 3227 @helper RenderMobileCartInitialization() 3228 { 3229 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3230 <script> 3231 window.cartId = "@miniCartFeedPageId"; 3232 </script> 3233 } 3234 3235 @helper RenderMobileTop() 3236 { 3237 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3238 3239 <nav class="main-navigation-mobile dw-mod"> 3240 <div class="center-container top-container__center-container dw-mod"> 3241 <div class="grid grid--align-center"> 3242 @RenderBlockList(subBlocks) 3243 </div> 3244 </div> 3245 </nav> 3246 } 3247 3248 @helper RenderMobileHeaderNavigation() 3249 { 3250 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3251 3252 <div class="grid__col-auto-width mobile-header-navigation"> 3253 <ul class="menu dw-mod mobile-header-navigation-list"> 3254 @RenderBlockList(subBlocks) 3255 </ul> 3256 </div> 3257 } 3258 3259 @helper RenderMobileHeaderNavigationTrigger() 3260 { 3261 var areaNameMobile = Model.Area.Name; 3262 3263 3264 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod mobile-nav-trigger-li-item"> 3265 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"> 3266 @if (areaNameMobile == "LEGO") 3267 { 3268 <img alt="burger" id="mobileNavTriggerImageOpen" src="Files/Images/Icons/burger.svg" style="height:22px;" /> 3269 <img alt="burger" id="mobileNavTriggerImageClose" src="Files/Images/Icons/exit.svg" hidden style="height:22px;" /> 3270 } 3271 else 3272 { 3273 <img alt="burger" id="mobileNavTriggerImageOpen" src="Files/Images/Icons/burger_left.svg" style="height:22px;" /> 3274 <img alt="burger" id="mobileNavTriggerImageClose" src="Files/Images/Icons/exit.svg" hidden style="height:22px;" /> 3275 } 3276 </label> 3277 </li> 3278 } 3279 3280 @helper RenderMobileHeaderLogo() 3281 { 3282 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3283 3284 var mobileTopLayout = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetString("Design")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3285 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3286 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3287 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3288 3289 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3290 string areaName = Model.Area.Name; 3291 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3292 { 3293 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3294 } 3295 3296 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3297 { 3298 mobileLogo = "/Admin/Public/GetImage.ashx?height=63&amp;Compression=95&amp;image=" + mobileLogo; 3299 } 3300 else 3301 { 3302 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3303 } 3304 3305 <div class="grid__col-auto grid__col--bleed @areaName-mobile-mega-menu"> 3306 <div class="logo-container--mobile @centeredLogo"> 3307 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3308 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3309 </a> 3310 </div> 3311 3312 @RenderBlockList(subBlocks) 3313 </div> 3314 } 3315 3316 @helper RenderMobileTopActions() 3317 { 3318 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3319 3320 <div class="grid__col-auto-width mobile-header-actions"> 3321 <ul class="menu dw-mod mobile-header-actions-list"> 3322 @RenderBlockList(subBlocks) 3323 </ul> 3324 </div> 3325 } 3326 3327 @helper RenderMobileTopSearch() 3328 { 3329 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3330 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3331 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3332 </label> 3333 </li> 3334 } 3335 3336 @helper RenderMobileTopOpeningHours() 3337 { 3338 int opneningHoursPageId = GetPageIdByNavigationTag("OpeningHours"); 3339 string opneningHoursPageLink = "/Default.aspx?ID=" + opneningHoursPageId; 3340 3341 <a href="@opneningHoursPageLink"> 3342 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3343 <label class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3344 <img alt="clock" src="Files/Images/Icons/clock.svg" style="height: 22px;" /> 3345 </label> 3346 </li> 3347 </a> 3348 } 3349 3350 @helper RenderMobileTopUser() 3351 { 3352 3353 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3354 int myDashboardPageId = GetPageIdByNavigationTag("CustomerOverview"); 3355 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 3356 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3357 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3358 string linkStart = "/Default.aspx?ID="; 3359 if (Model.CurrentUser.ID <= 0) 3360 { 3361 linkStart += signInProfilePageId + "&RedirectPageId="; 3362 } 3363 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 3364 string signInPageLink = "/Default.aspx?ID=" + signInProfilePageId; 3365 string myProfilePageLink = linkStart + myProfilePageId; 3366 string myOrdersPageLink = linkStart + myOrdersPageId; 3367 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3368 int pageId = Model.TopPage.ID; 3369 3370 3371 if (Model.CurrentUser.ID > 0) 3372 { 3373 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod is-dropdown is-dropdown--no-icon"> 3374 <label for="SignInModalTrigger" onclick="" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3375 <img alt="clock" src="Files/Images/Icons/user.svg" /> 3376 </label> 3377 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod mobile-user-dropdown"> 3378 <ul class="list list--clean dw-mod"> 3379 <li> 3380 <a href="@myProfilePageLink" class="list__link dw-mod"> 3381 @Translate("My Profile", "Yfirlit", "true") 3382 </a> 3383 </li> 3384 <li> 3385 <a href="@myFavoritesPageLink" class="list__link dw-mod"> 3386 @Translate("My favorites", "Óskalisti", "true") 3387 </a> 3388 </li> 3389 <li> 3390 <a href="@myOrdersPageLink" class="list__link dw-mod"> 3391 @Translate("My Orders", "Pantanir", "true") 3392 </a> 3393 </li> 3394 3395 <li> 3396 <a href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId" class="list__link dw-mod"> 3397 @Translate("Sign out", "Útskrá", "true") 3398 </a> 3399 </li> 3400 3401 </ul> 3402 </div> 3403 </li> 3404 } 3405 else 3406 { 3407 <a href="@signInPageLink"> 3408 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3409 <label for="SignInModalTrigger" onclick="" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3410 <img alt="user" src="Files/Images/Icons/user.svg" /> 3411 </label> 3412 </li> 3413 </a> 3414 } 3415 3416 } 3417 3418 @helper RenderMobileTopMiniCart() 3419 { 3420 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3421 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3422 double cartProductsCount = Model.Cart.TotalProductsCount; 3423 3424 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper"> 3425 <div class="mini-cart dw-mod"> 3426 <a href="/Default.aspx?ID=@cartPageId&Purge=True" id="miniCartCounterWrap" class="menu__link menu__link--icon menu__link--mobile dw-mod js-mini-cart-button"> 3427 <div class="u-inline u-position-relative"> 3428 <img alt="clock" src="Files/Images/Icons/karfa.svg" /> 3429 @if (cartProductsCount > 0) 3430 { 3431 <div class="mini-cart__counter dw-mod"> 3432 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" data-init-onload="false" data-preloader="false"> 3433 <div class="js-mini-cart-counter-content" data-count="@cartProductsCount"> 3434 @cartProductsCount 3435 </div> 3436 </div> 3437 </div> 3438 } 3439 </div> 3440 </a> 3441 </div> 3442 </li> 3443 } 3444 3445 @helper RenderMobileTopSearchBar() 3446 { 3447 string searchFeedId = ""; 3448 string searchSecondFeedId = ""; 3449 int groupsFeedId; 3450 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3451 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3452 string resultPageLink; 3453 string searchPlaceholder; 3454 string searchType = "product-search"; 3455 string searchTemplate; 3456 string searchContentTemplate = ""; 3457 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3458 bool showGroups = true; 3459 3460 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3461 { 3462 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3463 resultPageLink = contentSearchPageLink; 3464 searchPlaceholder = Translate("Search page"); 3465 groupsFeedId = 0; 3466 searchType = "content-search"; 3467 searchTemplate = "SearchPagesTemplate"; 3468 showGroups = false; 3469 } 3470 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3471 { 3472 searchFeedId = productsPageId + "&feed=true"; 3473 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3474 resultPageLink = Converter.ToString(productsPageId); 3475 searchPlaceholder = Translate("Leita"); 3476 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3477 searchType = "combined-search"; 3478 searchTemplate = "SearchProductsTemplateWrap"; 3479 searchContentTemplate = "SearchPagesTemplateWrap"; 3480 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3481 } 3482 else 3483 { 3484 resultPageLink = Converter.ToString(productsPageId); 3485 searchFeedId = productsPageId + "&feed=true"; 3486 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3487 searchPlaceholder = Translate("Search products", "Leita", "true"); 3488 searchTemplate = "SearchProductsTemplate"; 3489 searchType = "product-search"; 3490 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3491 } 3492 3493 3494 <div class="horizontal-line"></div> 3495 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" checked /> 3496 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3497 <div class="center-container top-container__center-container dw-mod"> 3498 <div class="grid search-container"> 3499 <div class="grid__col search-input-container"> 3500 <div class="typeahead-mobile__search-field dw-mod js-typeahead" data-page-size="@(searchType == "combined-search" ? 4 : 8)" id="MobileProductSearch" data-search-feed-id="@searchFeedId" data-search-second-feed-id="@searchSecondFeedId" data-result-page-id="@resultPageLink" data-search-type="@searchType"> 3501 <label class="mobile-search-icon"> 3502 <img class="menu__link menu__link--icon" src="Files/Images/Icons/search.svg" alt="search" style="height: 55px;" /> 3503 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3504 </label> 3505 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3506 { 3507 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod u-hidden" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 3508 } 3509 else 3510 { 3511 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3512 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="MobileProductSearchBarContent" data-template="@searchTemplate" data-json-feed="/Default.aspx?ID=@searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 3513 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="MobileContentSearchBarContent" data-template="@searchContentTemplate" data-json-feed="/Default.aspx?ID=@searchSecondFeedId" data-init-onload="false"></div> 3514 </div> 3515 } 3516 <button hidden type="button" class="sr-only btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn">></button> 3517 </div> 3518 </div> 3519 </div> 3520 </div> 3521 </div> 3522 <div class="horizontal-line"></div> 3523 } 3524 3525 @helper RenderMobileMiniCartCounterContent() 3526 { 3527 <script id="MiniCartCounterContent" type="text/x-template"> 3528 {{#.}} 3529 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 3530 {{numberofproducts}} 3531 </div> 3532 {{/.}} 3533 </script> 3534 } 3535 3536 3537 @helper RenderMobileBanner() 3538 { 3539 string imagePrefix = "/Admin/Public/GetImage.ashx?Format=webp&width=1240&amp;height=600&amp;crop=5&amp;Compression=95&amp;DoNotUpscale=0&amp;image="; 3540 3541 var primaryImage = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetFile("Primary_Image")?.PathUrlEncoded; 3542 var primaryLink = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("Primary_Image_Link"); 3543 3544 var noImage = ""; 3545 if (primaryImage == null) 3546 { 3547 noImage = "no-image"; 3548 } 3549 <div id="frontpageMobileBanner" class="@noImage"> 3550 <a id="primaryImage" href="@primaryLink" class="mobile-banner-link primary"> 3551 <img src="@imagePrefix@primaryImage" class="mobile-banner-image " /> 3552 </a> 3553 </div> 3554 }</text> 3555 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3556 3557 @using System 3558 @using System.Web 3559 @using System.Collections.Generic 3560 @using Dynamicweb.Rapido.Blocks.Extensibility 3561 @using Dynamicweb.Rapido.Blocks 3562 3563 @functions { 3564 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3565 } 3566 3567 @{ 3568 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3569 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3570 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3571 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3572 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3573 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3574 3575 Block mobileNavigation = new Block() 3576 { 3577 Id = "MobileNavigation", 3578 SortId = 10, 3579 Template = MobileNavigation(), 3580 SkipRenderBlocksList = true 3581 }; 3582 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3583 3584 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 3585 { 3586 Block mobileNavigationSignIn = new Block 3587 { 3588 Id = "MobileNavigationSignIn", 3589 SortId = 10, 3590 Template = RenderMobileNavigationSignIn() 3591 }; 3592 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3593 } 3594 3595 Block mobileNavigationMenu = new Block 3596 { 3597 Id = "MobileNavigationMenu", 3598 SortId = 20, 3599 Template = RenderMobileNavigationMenu() 3600 }; 3601 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3602 3603 Block mobileNavigationActions = new Block 3604 { 3605 Id = "MobileNavigationActions", 3606 SortId = 30, 3607 Template = RenderMobileNavigationActions(), 3608 SkipRenderBlocksList = true 3609 }; 3610 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3611 3612 if (!mobileNavigationItemsHideSignIn) 3613 { 3614 if (Model.CurrentUser.ID <= 0) 3615 { 3616 Block mobileNavigationSignInAction = new Block 3617 { 3618 Id = "MobileNavigationSignInAction", 3619 SortId = 10, 3620 Template = RenderMobileNavigationSignInAction() 3621 }; 3622 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3623 3624 if (!mobileHideCreateAccountLink) 3625 { 3626 Block mobileNavigationCreateAccountAction = new Block 3627 { 3628 Id = "MobileNavigationCreateAccountAction", 3629 SortId = 20, 3630 Template = RenderMobileNavigationCreateAccountAction() 3631 }; 3632 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3633 } 3634 } 3635 else 3636 { 3637 if (!mobileHideMyOrdersLink) 3638 { 3639 Block mobileNavigationOrdersAction = new Block 3640 { 3641 Id = "MobileNavigationOrdersAction", 3642 SortId = 20, 3643 Template = RenderMobileNavigationOrdersAction() 3644 }; 3645 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3646 } 3647 if (!mobileHideMyFavoritesLink) 3648 { 3649 Block mobileNavigationFavoritesAction = new Block 3650 { 3651 Id = "MobileNavigationFavoritesAction", 3652 SortId = 30, 3653 Template = RenderMobileNavigationFavoritesAction() 3654 }; 3655 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3656 } 3657 if (!mobileHideMySavedCardsLink) 3658 { 3659 Block mobileNavigationSavedCardsAction = new Block 3660 { 3661 Id = "MobileNavigationFavoritesAction", 3662 SortId = 30, 3663 Template = RenderMobileNavigationSavedCardsAction() 3664 }; 3665 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3666 } 3667 3668 Block mobileNavigationSignOutAction = new Block 3669 { 3670 Id = "MobileNavigationSignOutAction", 3671 SortId = 40, 3672 Template = RenderMobileNavigationSignOutAction() 3673 }; 3674 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3675 } 3676 } 3677 3678 if (Model.Languages.Count > 1) 3679 { 3680 Block mobileNavigationLanguagesAction = new Block 3681 { 3682 Id = "MobileNavigationLanguagesAction", 3683 SortId = 50, 3684 Template = RenderMobileNavigationLanguagesAction() 3685 }; 3686 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3687 } 3688 } 3689 3690 3691 @helper MobileNavigation() 3692 { 3693 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3694 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3695 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3696 var primaryImage = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetFile("Primary_Image")?.PathUrlEncoded; 3697 var noBanner = ""; 3698 if (string.IsNullOrWhiteSpace(primaryImage)) 3699 { 3700 noBanner = "no-banner"; 3701 } 3702 var isA4 = Model.Area.Name == "A4" ? "A4" : ""; 3703 <!-- Trigger for mobile navigation --> 3704 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3705 3706 <!-- Mobile navigation --> 3707 <nav id="mobileNav" class="mobile-navigation mobile-navigation--@position @isA4 @noBanner dw-mod"> 3708 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3709 @RenderBlockList(subBlocks) 3710 </div> 3711 </nav> 3712 3713 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3714 } 3715 3716 @helper RenderMobileNavigationSignIn() 3717 { 3718 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3719 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 3720 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3721 string myProfilePageLink = linkStart + myProfilePageId; 3722 string userName = Model.CurrentUser.FirstName ?? ""; 3723 userName += " " + (Model.CurrentUser.LastName ?? ""); 3724 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3725 3726 <ul class="menu menu-mobile"> 3727 <li class="menu-mobile__item"> 3728 <a href="@myProfilePageLink" class="menu-mobile__link dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @userName</a> 3729 </li> 3730 </ul> 3731 } 3732 3733 @helper RenderMobileNavigationMenu() 3734 { 3735 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3736 string menuTemplate = Model.Area.Name == "LEGO" ? "CustomBaseMenuForMobileSlides.xslt" : "CustomBaseMenuForMobileSlidesA4.xslt"; 3737 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3738 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3739 int startLevel = renderPagesInToolBar ? 1 : 0; 3740 3741 @RenderNavigation(new 3742 { 3743 id = "mobilenavigation", 3744 cssclass = "menu menu-mobile dwnavigation", 3745 startLevel = @startLevel, 3746 ecomStartLevel = @startLevel + 1, 3747 endlevel = @levels, 3748 expandmode = "all", 3749 template = @menuTemplate 3750 }) 3751 3752 if (isSlidesDesign) 3753 { 3754 <script> 3755 function goToLevel(level) { 3756 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3757 document.getElementById('mobileNav').scrollTop = 0; 3758 } 3759 3760 function goToLevelMobile(level, submenus) { 3761 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3762 document.getElementById('mobileNav').scrollTop = 0; 3763 3764 var x = document.getElementsByClassName("menu-mobile menu-mobile__submenu active"); 3765 3766 if (level == 0) { 3767 for (var i = 0; i < x.length; i++) { 3768 x[i].classList.remove("active"); 3769 } 3770 } 3771 3772 3773 if (level == 2) { 3774 var id = "#" + submenus + "ul >li >ul" 3775 var menuId = $(id)[0].id; 3776 document.getElementById(menuId).classList.add("active"); 3777 } 3778 else { 3779 if (document.getElementById(submenus + "ul")) { 3780 document.getElementById(submenus + "ul").classList.add("active"); 3781 } 3782 } 3783 } 3784 3785 document.addEventListener('DOMContentLoaded', function () { 3786 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3787 }); 3788 </script> 3789 } 3790 3791 if (renderPagesInToolBar) 3792 { 3793 @RenderNavigation(new 3794 { 3795 id = "topToolsMobileNavigation", 3796 cssclass = "menu menu-mobile dwnavigation", 3797 template = "ToolsMenuForMobile.xslt" 3798 }) 3799 } 3800 } 3801 3802 @helper RenderMobileNavigationActions() 3803 { 3804 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3805 3806 <ul class="menu menu-mobile"> 3807 @RenderBlockList(subBlocks) 3808 </ul> 3809 } 3810 3811 @helper RenderMobileNavigationSignInAction() 3812 { 3813 <li class="menu-mobile__item"> 3814 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Sign in")</label> 3815 </li> 3816 } 3817 3818 @helper RenderMobileNavigationCreateAccountAction() 3819 { 3820 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3821 3822 <li class="menu-mobile__item"> 3823 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 3824 </li> 3825 } 3826 3827 @helper RenderMobileNavigationProfileAction() 3828 { 3829 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3830 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3831 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 3832 string myProfilePageLink = linkStart + myProfilePageId; 3833 3834 <li class="menu-mobile__item"> 3835 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 3836 </li> 3837 } 3838 3839 @helper RenderMobileNavigationOrdersAction() 3840 { 3841 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3842 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3843 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3844 string myOrdersPageLink = linkStart + myOrdersPageId; 3845 string ordersIcon = "fas fa-list"; 3846 3847 <li class="menu-mobile__item"> 3848 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a> 3849 </li> 3850 } 3851 3852 @helper RenderMobileNavigationFavoritesAction() 3853 { 3854 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3855 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3856 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3857 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3858 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 3859 3860 3861 <li class="menu-mobile__item"> 3862 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 3863 </li> 3864 } 3865 3866 @helper RenderMobileNavigationSavedCardsAction() 3867 { 3868 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3869 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3870 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3871 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3872 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 3873 3874 <li class="menu-mobile__item"> 3875 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 3876 </li> 3877 } 3878 3879 @helper RenderMobileNavigationSignOutAction() 3880 { 3881 int pageId = Model.TopPage.ID; 3882 string signOutIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignOutIcon").SelectedValue : "far fa-sign-out-alt"; 3883 3884 <li class="menu-mobile__item"> 3885 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 3886 </li> 3887 } 3888 3889 @helper RenderMobileNavigationLanguagesAction() 3890 { 3891 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3892 3893 string selectedLanguage = ""; 3894 foreach (var lang in Model.Languages) 3895 { 3896 if (lang.IsCurrent) 3897 { 3898 selectedLanguage = lang.Name; 3899 } 3900 } 3901 3902 <li class="menu-mobile__item dw-mod"> 3903 @if (isSlidesDesign) 3904 { 3905 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3906 } 3907 else 3908 { 3909 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3910 } 3911 <div class="menu-mobile__link__wrap"> 3912 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 3913 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3914 </div> 3915 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3916 @if (isSlidesDesign) 3917 { 3918 <li class="menu-mobile__item dw-mod"> 3919 <div class="menu-mobile__link__wrap"> 3920 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3921 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3922 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3923 </div> 3924 </li> 3925 } 3926 @foreach (var lang in Model.Languages) 3927 { 3928 <li class="menu-mobile__item dw-mod"> 3929 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 3930 </li> 3931 } 3932 </ul> 3933 </li> 3934 }</text> 3935 } 3936 else 3937 { 3938 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3939 3940 @using System 3941 @using System.Web 3942 @using System.Collections.Generic 3943 @using Dynamicweb.Rapido.Blocks.Extensibility 3944 @using Dynamicweb.Rapido.Blocks 3945 3946 @functions { 3947 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3948 } 3949 3950 @{ 3951 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3952 { 3953 Block masterTools = new Block() 3954 { 3955 Id = "MasterDesktopTools", 3956 SortId = 10, 3957 Template = RenderDesktopTools(), 3958 SkipRenderBlocksList = true, 3959 BlocksList = new List<Block> 3960 { 3961 new Block 3962 { 3963 Id = "MasterDesktopBanner", 3964 SortId = 10, 3965 Template = RenderDesktopBanner(), 3966 3967 }, 3968 new Block { 3969 Id = "MasterDesktopToolsText", 3970 SortId = 20, 3971 Template = RenderDesktopToolsText(), 3972 Design = new Design 3973 { 3974 Size = "auto", 3975 HidePadding = true, 3976 RenderType = RenderType.Column 3977 } 3978 }, 3979 new Block { 3980 Id = "MasterDesktopToolsNavigation", 3981 SortId = 30, 3982 Template = RenderDesktopToolsNavigation(), 3983 Design = new Design 3984 { 3985 Size = "auto-width", 3986 HidePadding = true, 3987 RenderType = RenderType.Column 3988 } 3989 } 3990 } 3991 }; 3992 headerBlocksPage.Add("MasterHeader", masterTools); 3993 } 3994 3995 Block masterDesktopExtra = new Block() 3996 { 3997 Id = "MasterDesktopExtra", 3998 SortId = 10, 3999 Template = RenderDesktopExtra(), 4000 SkipRenderBlocksList = true 4001 }; 4002 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 4003 4004 Block masterDesktopNavigation = new Block() 4005 { 4006 Id = "MasterDesktopNavigation", 4007 SortId = 20, 4008 Template = RenderDesktopNavigation(), 4009 SkipRenderBlocksList = true 4010 }; 4011 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 4012 } 4013 4014 @* Include the Blocks for the page *@ 4015 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4016 4017 @using System 4018 @using System.Web 4019 @using Dynamicweb.Rapido.Blocks.Extensibility 4020 @using Dynamicweb.Rapido.Blocks 4021 4022 @{ 4023 Block masterDesktopLogo = new Block 4024 { 4025 Id = "MasterDesktopLogo", 4026 SortId = 10, 4027 Template = RenderDesktopLogo(), 4028 Design = new Design 4029 { 4030 Size = "auto-width", 4031 HidePadding = true, 4032 RenderType = RenderType.Column, 4033 CssClass = "grid--align-self-center" 4034 } 4035 }; 4036 4037 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 4038 } 4039 4040 4041 @helper RenderDesktopLogo() 4042 { 4043 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 4044 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4045 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 4046 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 4047 if (Path.GetExtension(logo).ToLower() != ".svg") 4048 { 4049 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 4050 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 4051 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=95&amp;image=" + logo; 4052 } 4053 else 4054 { 4055 logo = HttpUtility.UrlDecode(logo); 4056 } 4057 4058 <div class="logo @alignClass dw-mod" title='@Translate("Frontpage")'> 4059 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 4060 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 4061 </a> 4062 </div> 4063 } 4064 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4065 4066 @using System 4067 @using System.Web 4068 @using Dynamicweb.Rapido.Blocks.Extensibility 4069 @using Dynamicweb.Rapido.Blocks 4070 4071 @functions { 4072 bool isMegaMenu; 4073 } 4074 @{ 4075 4076 if (areaName == "LEGO") 4077 { 4078 // Lego 4079 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 4080 Block masterDesktopMenu = new Block 4081 { 4082 Id = "MasterDesktopMenu", 4083 SortId = 10, 4084 Template = RenderDesktopMenu(), 4085 Design = new Design 4086 { 4087 Size = "auto", 4088 HidePadding = true, 4089 RenderType = RenderType.Column 4090 } 4091 }; 4092 4093 if (isMegaMenu) 4094 { 4095 masterDesktopMenu.Design.CssClass = "u-reset-position"; 4096 } 4097 4098 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 4099 } 4100 else if (areaName == "A4" || areaName == "MMS" || areaName == "ISB") 4101 { 4102 // A4 4103 Block DesktopSlideNavigation = new Block() 4104 { 4105 Id = "DesktopSlideNavigation", 4106 SortId = 10, 4107 Template = RenderDesktopSlideNavigations(), 4108 SkipRenderBlocksList = true, 4109 BlocksList = new List<Block> { 4110 new Block { 4111 Id = "DesktopSlideNavigationTrigger", 4112 SortId = 10, 4113 Template = RenderDesktopSlideNavigationTriggers() 4114 } 4115 } 4116 }; 4117 4118 BlocksPage.GetBlockPage("Master").Add("MasterDesktopNavigation", DesktopSlideNavigation); 4119 } 4120 } 4121 4122 @helper RenderDesktopMenu() 4123 { 4124 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4125 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 4126 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 4127 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4128 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 4129 int startLevel = renderPagesInToolBar ? 1 : 0; 4130 int newProductsPageId = GetPageIdByNavigationTag("Nýtt"); 4131 int popularProductsPageId = GetPageIdByNavigationTag("Vinsælt"); 4132 4133 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 4134 4135 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 4136 @if (!isMegaMenu) 4137 { 4138 @RenderNavigation(new 4139 { 4140 id = "topnavigation", 4141 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4142 startLevel = startLevel, 4143 ecomStartLevel = startLevel + 1, 4144 endlevel = 5, 4145 expandmode = "all", 4146 template = "BaseMenuWithDropdown.xslt" 4147 }); 4148 } 4149 else 4150 { 4151 @RenderNavigation(new 4152 { 4153 id = "topnavigation", 4154 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 4155 startLevel = startLevel, 4156 ecomStartLevel = startLevel + 1, 4157 endlevel = 5, 4158 promotionImage = megamenuPromotionImage, 4159 promotionLink = promotionLink, 4160 expandmode = "all", 4161 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 4162 template = "CustomBaseMegaMenu.xslt" 4163 }); 4164 } 4165 </div> 4166 4167 <div class="mega-menu-products hidden" id="newProductsContainer" hidden> 4168 @if (newProductsPageId > 0) 4169 { 4170 @RenderPageContent(newProductsPageId) 4171 } 4172 </div> 4173 4174 <div class="mega-menu-products hidden" id="popularProductsContainer" hidden> 4175 @if (popularProductsPageId > 0) 4176 { 4177 @RenderPageContent(popularProductsPageId) 4178 } 4179 </div> 4180 } 4181 4182 @helper RenderDesktopSlideNavigations() 4183 { 4184 List<Block> subBlocks = BlocksPage.GetBlockPage("Master").GetBlockListById("DesktopSlideNavigation").OrderBy(item => item.SortId).ToList(); 4185 4186 <div class="grid__col-auto-width"> 4187 <ul class="menu dw-mod"> 4188 @RenderBlockList(subBlocks) 4189 </ul> 4190 </div> 4191 } 4192 4193 @helper RenderDesktopSlideNavigationTriggers() 4194 { 4195 <li id="desktopNavTriggerLi" class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 4196 <label for="MobileNavTrigger" id="desktopNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"> 4197 <img id="desktopNavTriggerImageOpen" alt="burger" src="Files/Images/Icons/burger_left.svg"> 4198 <img id="desktopNavTriggerImageClose" alt="exit" src="Files/Images/Icons/exit.svg" hidden> 4199 </label> 4200 </li> 4201 } 4202 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4203 4204 @using System 4205 @using System.Web 4206 @using Dynamicweb.Rapido.Blocks.Extensibility 4207 @using Dynamicweb.Rapido.Blocks 4208 4209 @{ 4210 Block masterDesktopActionsMenu = new Block 4211 { 4212 Id = "MasterDesktopActionsMenu", 4213 SortId = 10, 4214 Template = RenderDesktopActionsMenu(), 4215 Design = new Design 4216 { 4217 CssClass = "u-flex" 4218 }, 4219 SkipRenderBlocksList = true 4220 4221 }; 4222 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 4223 4224 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 4225 { 4226 Block masterDesktopActionsHeaderButton = new Block 4227 { 4228 Id = "MasterDesktopActionsHeaderButton", 4229 SortId = 60, 4230 Template = RenderHeaderButton() 4231 }; 4232 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 4233 } 4234 } 4235 4236 @helper RenderDesktopActionsMenu() 4237 { 4238 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 4239 4240 <ul class="menu u-flex dw-mod"> 4241 @RenderBlockList(subBlocks) 4242 </ul> 4243 } 4244 4245 @helper RenderHeaderButton() 4246 { 4247 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 4248 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 4249 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 4250 4251 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 4252 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 4253 </li> 4254 } 4255 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4256 4257 @using System 4258 @using System.Web 4259 @using Dynamicweb.Core; 4260 @using System.Text.RegularExpressions 4261 @using Dynamicweb.Rapido.Blocks.Extensibility 4262 @using Dynamicweb.Rapido.Blocks 4263 4264 @{ 4265 Block masterDesktopActionsMenuLanguageSelector = new Block 4266 { 4267 Id = "MasterDesktopActionsMenuLanguageSelector", 4268 SortId = 40, 4269 Template = RenderLanguageSelector() 4270 }; 4271 4272 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 4273 } 4274 4275 @helper RenderLanguageSelector() 4276 { 4277 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4278 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4279 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4280 string languageViewType = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue) ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("LanguageSelector").SelectedValue.ToLower() : ""; 4281 4282 if (Model.Languages.Count > 1) 4283 { 4284 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 4285 <div class="@menuLinkClass dw-mod"> 4286 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 4287 </div> 4288 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 4289 @foreach (var lang in Model.Languages) 4290 { 4291 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4292 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4293 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4294 4295 if (languageViewType == "flag-culture") 4296 { 4297 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4298 } 4299 4300 if (languageViewType == "flag") 4301 { 4302 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4303 } 4304 4305 if (languageViewType == "name") 4306 { 4307 langInfo = lang.Name; 4308 } 4309 4310 if (languageViewType == "culture") 4311 { 4312 langInfo = cultureName; 4313 } 4314 4315 <div class="menu__item dw-mod menu__item--fixed-width"> 4316 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4317 </div> 4318 } 4319 </div> 4320 </li> 4321 } 4322 } 4323 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4324 4325 @using System 4326 @using System.Web 4327 @using Dynamicweb.Rapido.Blocks.Extensibility 4328 @using Dynamicweb.Rapido.Blocks 4329 4330 @{ 4331 Block masterDesktopActionsMenuSignIn = new Block 4332 { 4333 Id = "MasterDesktopActionsMenuSignIn", 4334 SortId = 30, 4335 Template = RenderSignIn() 4336 }; 4337 4338 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4339 } 4340 4341 @helper RenderSignIn() 4342 { 4343 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4344 string userInitials = ""; 4345 int pageId = Model.TopPage.ID; 4346 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4347 int myDashboardPageId = GetPageIdByNavigationTag("CustomerOverview"); 4348 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 4349 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4350 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4351 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4352 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4353 int frontPageId = GetPageIdByNavigationTag("Frontpage"); 4354 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4355 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4356 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4357 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4358 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4359 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4360 4361 string linkStart = "/Default.aspx?ID="; 4362 if (Model.CurrentUser.ID <= 0) 4363 { 4364 linkStart += signInProfilePageId + "&RedirectPageId="; 4365 } 4366 4367 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4368 string signInPageLink = "/Default.aspx?ID=" + signInProfilePageId; 4369 string myProfilePageLink = linkStart + myProfilePageId; 4370 string myOrdersPageLink = linkStart + myOrdersPageId; 4371 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4372 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4373 string frontPageLink = linkStart + frontPageId; 4374 4375 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4376 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 4377 4378 if (!navigationItemsHideSignIn) 4379 { 4380 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4381 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4382 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4383 4384 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4385 <div class="@menuLinkClass dw-mod"> 4386 @if (Model.CurrentUser.ID <= 0) 4387 { 4388 <a href=@signInPageLink title='@Translate("Sign in")'> 4389 <img class="menu__link menu__link--icon" alt="user" src="Files/Images/Icons/user.svg" /> 4390 </a> 4391 } 4392 else 4393 { 4394 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title='@Translate("My Profile")'> 4395 <img class="menu__link menu__link--icon" src="Files/Images/Icons/user.svg" /> 4396 </a> 4397 } 4398 </div> 4399 @if (Model.CurrentUser.ID > 0) 4400 { 4401 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4402 <ul class="list list--clean dw-mod"> 4403 @if (!hideMyProfileLink) 4404 { 4405 @RenderListItem(myProfilePageLink, Translate("My Profile", "Yfirlit", "true")) 4406 } 4407 @if (!hideMyOrdersLink) 4408 { 4409 @RenderListItem(myOrdersPageLink, Translate("My Orders", "Pantanir", "true")) 4410 } 4411 @if (!hideMyFavoritesLink) 4412 { 4413 @RenderListItem(myFavoritesPageLink, Translate("My Favorites", "Óskalisti", "true")) 4414 } 4415 @if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4416 { 4417 @RenderSeparator() 4418 } 4419 4420 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + frontPageId, Translate("Sign out", "Útskrá", "true")) 4421 </ul> 4422 </div> 4423 } 4424 </li> 4425 } 4426 } 4427 4428 @helper RenderListItem(string link, string text, string icon = null) 4429 { 4430 <li> 4431 <a href="@link" class="list__link dw-mod"> 4432 @text 4433 </a> 4434 </li> 4435 } 4436 4437 @helper RenderSeparator() 4438 { 4439 <li class="list__seperator dw-mod"></li> 4440 } 4441 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4442 4443 @using System 4444 @using System.Web 4445 @using Dynamicweb.Rapido.Blocks.Extensibility 4446 @using Dynamicweb.Rapido.Blocks 4447 4448 @{ 4449 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4450 4451 Block masterDesktopActionsMenuFavorites = new Block 4452 { 4453 Id = "MasterDesktopActionsMenuFavorites", 4454 SortId = 30, 4455 Template = RenderFavorites() 4456 }; 4457 4458 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4459 { 4460 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4461 } 4462 } 4463 4464 @helper RenderFavorites() 4465 { 4466 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4467 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4468 4469 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4470 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4471 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4472 4473 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4474 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4475 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4476 </a> 4477 </li> 4478 } 4479 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4480 4481 @using System 4482 @using System.Web 4483 @using Dynamicweb.Rapido.Blocks.Extensibility 4484 @using Dynamicweb.Rapido.Blocks 4485 4486 @{ 4487 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4488 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4489 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4490 4491 if (!onlyPreview && !hideCart) 4492 { 4493 Block masterDesktopActionsMenuMiniCart = new Block 4494 { 4495 Id = "MasterDesktopActionsMenuMiniCart", 4496 SortId = 50, 4497 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4498 SkipRenderBlocksList = true, 4499 BlocksList = new List<Block>() 4500 }; 4501 4502 Block miniCartCounterScriptTemplate = new Block 4503 { 4504 Id = "MiniCartCounterScriptTemplate", 4505 Template = RenderMiniCartCounterContent() 4506 }; 4507 4508 //dropdown layout is default 4509 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4510 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4511 4512 switch (miniCartLayout) 4513 { 4514 case "panel": 4515 layoutTemplate = RenderMiniCartPanelLayout(); 4516 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4517 break; 4518 case "modal": 4519 layoutTemplate = RenderMiniCartModalLayout(); 4520 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4521 break; 4522 } 4523 4524 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4525 { 4526 Id = "MiniCartTrigger", 4527 Template = miniCartTriggerTemplate 4528 }); 4529 4530 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4531 { 4532 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4533 { 4534 Id = "MiniCartLayout", 4535 Template = layoutTemplate 4536 }); 4537 } 4538 4539 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4540 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4541 } 4542 4543 if (hideCart && !onlyPreview) 4544 { 4545 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block 4546 { 4547 Id = "CartInitialization", 4548 Template = RenderNoLayoutMiniCart() 4549 }); 4550 } 4551 } 4552 4553 @helper RenderMiniCart(bool hasMouseEnterEvent) 4554 { 4555 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4556 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4557 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4558 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4559 string mouseEvent = ""; 4560 string id = "MiniCart"; 4561 if (hasMouseEnterEvent) { 4562 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4563 id = "miniCartTrigger"; 4564 } 4565 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4566 @RenderBlockList(subBlocks) 4567 </li> 4568 } 4569 4570 @helper RenderMiniCartTriggerLabel() 4571 { 4572 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4573 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4574 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4575 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4576 4577 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title='@Translate("Cart")'> 4578 <div class="u-inline u-position-relative"> 4579 <img class="menu__link menu__link--icon" alt="miniCartAction" src="Files/Templates/Designs/Rapido/Images/Icons/karfa.svg" /> 4580 @RenderMiniCartCounter() 4581 </div> 4582 </div> 4583 } 4584 4585 @helper RenderMiniCartTriggerLink() 4586 { 4587 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4588 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4589 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4590 4591 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title='@Translate("Cart")'> 4592 <div class="u-inline u-position-relative"> 4593 <img class="menu__link menu__link--icon" alt="miniCartAction" src="Files/Templates/Designs/Rapido/Images/Icons/karfa.svg" /> 4594 @RenderMiniCartCounter() 4595 </div> 4596 </a> 4597 } 4598 4599 @helper RenderMiniCartCounter() 4600 { 4601 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4602 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4603 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4604 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4605 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4606 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4607 4608 if (showPrice && counterPosition == "right") 4609 { 4610 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4611 } 4612 @RenderMiniCartCounterContent(); 4613 <div class="mini-cart__counter dw-mod"> 4614 <div class="js-handlebars-root js-mini-cart-counter" id="cartCounter" data-template="MiniCartCounterContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=Counter" > 4615 4616 </div> 4617 </div> 4618 } 4619 4620 @helper RenderMiniCartCounterContent() 4621 { 4622 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4623 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4624 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4625 4626 <script id="MiniCartCounterContent" type="text/x-template"> 4627 {{#.}} 4628 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4629 @if (showPriceInMiniCartCounter) 4630 { 4631 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4632 } 4633 else 4634 { 4635 <text>{{numberofproducts}}</text> 4636 } 4637 </div> 4638 {{/.}} 4639 </script> 4640 } 4641 4642 @helper RenderNoLayoutMiniCart() 4643 { 4644 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4645 <script> 4646 window.cartId = "@miniCartFeedPageId"; 4647 </script> 4648 } 4649 4650 @helper RenderMiniCartDropdownLayout() 4651 { 4652 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4653 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4654 4655 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown" data-cart-page-link="@cartPageLink"> 4656 <div class="mini-cart-dropdown__inner dw-mod"> 4657 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4658 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4659 <div class="js-handlebars-root u-flex grid--direction-column u-full-width dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4660 </div> 4661 </div> 4662 </div> 4663 } 4664 4665 @helper RenderMiniCartPanelLayout() 4666 { 4667 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4668 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4669 4670 <div class="mini-cart grid__cell dw-mod"> 4671 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4672 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="panel" data-cart-page-link="@cartPageLink"> 4673 <label for="miniCartTrigger" class="panel__close-btn miniCartLabel" title="@Translate("Close panel")"><img alt="close cart" src="Files/Images/Icons/X.svg"/></label> 4674 <div class="panel__content u-full-width dw-mod"> 4675 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4676 <div class="panel__content-body panel__content-body--cart dw-mod"> 4677 <div class="js-handlebars-root u-flex grid--direction-column u-full-height dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4678 </div> 4679 </div> 4680 </div> 4681 </div> 4682 } 4683 4684 @helper RenderMiniCartModalLayout() 4685 { 4686 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4687 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 4688 4689 <div class="mini-cart grid__cell dw-mod"> 4690 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4691 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="modal" data-cart-page-link="@cartPageLink"> 4692 <label for="miniCartTrigger" class="modal-overlay"></label> 4693 <div class="modal modal--top-right dw-mod"> 4694 <div class="modal__body u-flex grid--direction-column dw-mod"> 4695 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4696 <div class="js-handlebars-root u-flex grid--direction-column dw-mod" id="miniCartContent" data-template="MiniCartContent" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 4697 </div> 4698 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4699 </div> 4700 </div> 4701 </div> 4702 } 4703 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4704 4705 @using System 4706 @using System.Web 4707 @using Dynamicweb.Rapido.Blocks.Extensibility 4708 @using Dynamicweb.Rapido.Blocks 4709 4710 @{ 4711 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4712 4713 Block masterDesktopActionsMenuDownloadCart = new Block 4714 { 4715 Id = "MasterDesktopActionsMenuDownloadCart", 4716 SortId = 35, 4717 Template = RenderDownloadCart() 4718 }; 4719 4720 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4721 { 4722 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4723 } 4724 } 4725 4726 @helper RenderDownloadCart() 4727 { 4728 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4729 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4730 4731 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4732 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4733 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4734 4735 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4736 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4737 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4738 </a> 4739 </li> 4740 } 4741 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4742 4743 @using System 4744 @using System.Web 4745 @using Dynamicweb.Rapido.Blocks.Extensibility 4746 @using Dynamicweb.Rapido.Blocks 4747 4748 @functions { 4749 public class SearchConfiguration 4750 { 4751 public string searchFeedId { get; set; } 4752 public string searchSecondFeedId { get; set; } 4753 public int groupsFeedId { get; set; } 4754 public string resultPageLink { get; set; } 4755 public string searchPlaceholder { get; set; } 4756 public string searchType { get; set; } 4757 public string searchTemplate { get; set; } 4758 public string searchContentTemplate { get; set; } 4759 public string searchValue { get; set; } 4760 public bool showGroups { get; set; } 4761 4762 public SearchConfiguration() 4763 { 4764 searchFeedId = ""; 4765 searchSecondFeedId = ""; 4766 searchType = "product-search"; 4767 searchContentTemplate = ""; 4768 showGroups = true; 4769 } 4770 } 4771 } 4772 @{ 4773 Block linksInMenu = new Block 4774 { 4775 Id = "MasterSearchBar", 4776 SortId = 40, 4777 Template = RenderLinksInMenu(), 4778 Design = new Design 4779 { 4780 Size = "auto", 4781 HidePadding = true, 4782 RenderType = RenderType.Column 4783 } 4784 }; 4785 4786 Block masterNewSearchAction = new Block 4787 { 4788 Id = "MasterDesktopActionsMenuSearchNew", 4789 SortId = 10, 4790 Template = RenderSearch("newbar") 4791 }; 4792 4793 BlocksPage.GetBlockPage("Master").Add("MasterHeader", linksInMenu); 4794 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterNewSearchAction); 4795 } 4796 4797 @helper RenderSearch(string type = "mini-search") 4798 { 4799 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPageCategories")); 4800 //string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4801 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4802 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4803 4804 SearchConfiguration searchConfiguration = null; 4805 4806 switch (searchType) { 4807 case "contentSearch": 4808 searchConfiguration = new SearchConfiguration() { 4809 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4810 resultPageLink = contentSearchPageLink, 4811 searchPlaceholder = Translate("Search page"), 4812 groupsFeedId = 0, 4813 searchType = "content-search", 4814 searchTemplate = "SearchPagesTemplate", 4815 showGroups = false 4816 }; 4817 break; 4818 case "combinedSearch": 4819 searchConfiguration = new SearchConfiguration() { 4820 searchFeedId = productsPageId + "&feed=true", 4821 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4822 resultPageLink = Converter.ToString(productsPageId), 4823 searchPlaceholder = Translate("Leita"), 4824 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4825 searchType = "combined-search", 4826 searchTemplate = "SearchProductsTemplateWrap", 4827 searchContentTemplate = "SearchPagesTemplateWrap", 4828 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4829 }; 4830 break; 4831 default: //productSearch 4832 searchConfiguration = new SearchConfiguration() { 4833 resultPageLink = Converter.ToString(productsPageId), 4834 searchFeedId = productsPageId + "&feed=true", 4835 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4836 searchPlaceholder = Translate("Search products"), 4837 searchTemplate = "SearchProductsTemplate", 4838 searchType = "product-search", 4839 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4840 }; 4841 break; 4842 } 4843 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4844 4845 if (type == "mini-search") { 4846 @RenderMiniSearch(searchConfiguration) 4847 } else if (type == "newbar") { 4848 @RenderSearchBar(searchConfiguration) 4849 } 4850 } 4851 4852 @helper RenderLinksInMenu() 4853 { 4854 int linksInMenudId = GetPageIdByNavigationTag("LinksInMenu"); 4855 4856 if (linksInMenudId != 0) 4857 { 4858 @RenderPageContent(linksInMenudId) 4859 } 4860 } 4861 4862 @helper RenderSearchBar(SearchConfiguration options) 4863 { 4864 <li class="menu__item menu__item--horizontal menu__item--icon dw-mod search-item menu__item--top-level" title='@Translate("Search")'> 4865 <div class="dw-mod"> 4866 <a href="#" onclick="$('.search-item').addClass('open'); $('#searchInput').focus(); return false;" > 4867 <img class="menu__link menu__link--icon" src="Files/Images/Icons/search.svg" alt="search" style="height: 57px;" /> 4868 </a> 4869 </div> 4870 4871 <div class="js-typeahead" id="ProductSearchBar" 4872 data-page-size="7" 4873 data-search-feed-id="@options.searchFeedId" 4874 data-search-second-feed-id="@options.searchSecondFeedId" 4875 data-result-page-id="@options.resultPageLink" 4876 data-groups-page-id="@options.groupsFeedId" 4877 data-search-type="@options.searchType"> 4878 @if (options.showGroups) 4879 { 4880 <button type="button" class="btn btn--condensed u-color-light-gray--bg typeahead-group-btn dw-mod js-typeahead-groups-btn" data-group-id="all">@Translate("All")</button> 4881 <ul class="dropdown dropdown--absolute-position u-min-w220px js-handlebars-root js-typeahead-groups-content dw-mod" id="ProductSearchBarGroupsContent" data-template="SearchGroupsTemplate" data-json-feed="/Default.aspx?ID=@options.groupsFeedId&feedType=productGroups" data-init-onload="false" data-preloader="minimal"></ul> 4882 } 4883 <div class="typeahead-search-field"> 4884 <label class="mobile-search-icon"> 4885 <input type="text" id="searchInput" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue" autocomplete="off"> 4886 </label> 4887 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4888 { 4889 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" style="height:auto" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 4890 } 4891 else 4892 { 4893 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4894 <div class="js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-init-onload="false"></div> 4895 <div class="js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-init-onload="false"></div> 4896 </div> 4897 } 4898 </div> 4899 <button hidden type="button" class="sr-only btn btn--condensed btn--primary u-no-margin dw-mod js-typeahead-enter-btn">></button> 4900 </div> 4901 4902 </li> 4903 } 4904 4905 @helper RenderMiniSearch(SearchConfiguration options) 4906 { 4907 <li class="menu__item menu__item--horizontal menu__item--top-level menu__item--icon u-hidden-xxs is-dropdown is-dropdown--no-icon dw-mod" onmouseover="document.getElementById('headerSearch').focus()"> 4908 <div class="menu__link menu__link--icon dw-mod"> 4909 <img class="menu__link menu__link--icon" src="Files/Images/Icons/search.svg" style="height: 55px;" /> 4910 </div> 4911 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4912 <div class="typeahead js-typeahead" id="ProductSearchBar" 4913 data-page-size="7" 4914 data-search-feed-id="@options.searchFeedId" 4915 data-search-second-feed-id="@options.searchSecondFeedId" 4916 data-result-page-id="@options.resultPageLink" 4917 data-search-type="@options.searchType"> 4918 <div class="typeahead-search-field"> 4919 <label class="mobile-search-icon"> 4920 <img class="menu__link menu__link--icon" src="Files/Images/Icons/search.svg" style="height: 55px;" /> 4921 <input type="text" class="u-no-margin u-full-width js-typeahead-search-fieldn" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4922 </label> 4923 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4924 { 4925 <ul class="dropdown dropdown--absolute-position u-min-w220px u-full-width js-handlebars-root js-typeahead-search-content dw-mod" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></ul> 4926 } 4927 else 4928 { 4929 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4930 <div class="js-handlebars-root js-typeahead-search-content grid__col-sm-7 grid__col--bleed-y" id="ProductSearchBarContent" data-template="@options.searchTemplate" data-json-feed="/Default.aspx?ID=@options.searchFeedId&feedType=productsOnly" data-init-onload="false"></div> 4931 <div class="js-handlebars-root js-typeahead-additional-search-content grid__col-sm-5 grid__col--bleed-y" id="ContentSearchBarContent" data-template="@options.searchContentTemplate" data-json-feed="/Default.aspx?ID=@options.searchSecondFeedId" data-init-onload="false"></div> 4932 </div> 4933 } 4934 </div> 4935 </div> 4936 </div> 4937 </li> 4938 } 4939 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4940 4941 @using System 4942 @using System.Web 4943 @using Dynamicweb.Rapido.Blocks.Extensibility 4944 @using Dynamicweb.Rapido.Blocks 4945 4946 @{ 4947 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4948 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4949 4950 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4951 4952 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4953 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4954 4955 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4956 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4957 4958 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4959 headerConfigurationPage.RemoveBlock(configSearchBar); 4960 4961 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4962 headerConfigurationPage.RemoveBlock(configSearchAction); 4963 4964 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4965 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4966 4967 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4968 4969 switch (topLayout) 4970 { 4971 case "condensed": //2 4972 configDesktopLogo.Design.Size = "auto-width"; 4973 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4974 4975 if (Model.Area.Name == "LEGO") 4976 { 4977 configDesktopMenu.SortId = 20; 4978 configDesktopMenu.Design.Size = "auto"; 4979 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4980 } 4981 4982 configDesktopActionsMenu.SortId = 30; 4983 configDesktopActionsMenu.Design.Size = "auto-width"; 4984 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4985 4986 if (!hideSearch) 4987 { 4988 configSearchBar.SortId = 40; 4989 configSearchBar.Design.Size = "12"; 4990 configDesktopExtra.SortId = 50; 4991 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4992 } 4993 break; 4994 case "splitted": //3 4995 configDesktopLogo.Design.Size = "auto"; 4996 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4997 4998 if (!hideSearch) 4999 { 5000 configSearchBar.SortId = 20; 5001 configSearchBar.Design.Size = "auto"; 5002 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5003 } 5004 5005 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5006 5007 configDesktopActionsMenu.SortId = 20; 5008 configDesktopActionsMenu.Design.Size = "auto-width"; 5009 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5010 break; 5011 case "minimal": //4 5012 configDesktopLogo.Design.Size = "auto-width"; 5013 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5014 5015 if (Model.Area.Name == "LEGO") 5016 { 5017 configDesktopMenu.Design.Size = "auto"; 5018 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5019 } 5020 5021 configDesktopActionsMenu.SortId = 20; 5022 configDesktopActionsMenu.Design.Size = "auto-width"; 5023 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5024 5025 if (!hideSearch) 5026 { 5027 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5028 } 5029 break; 5030 case "minimal-right": //5 5031 configDesktopLogo.Design.Size = "auto-width"; 5032 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5033 5034 if (Model.Area.Name == "LEGO") 5035 { 5036 configDesktopMenu.Design.Size = "auto"; 5037 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5038 } 5039 5040 configDesktopActionsMenu.SortId = 20; 5041 configDesktopActionsMenu.Design.Size = "auto-width"; 5042 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5043 5044 if (!hideSearch) 5045 { 5046 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5047 } 5048 break; 5049 case "two-lines": //6 5050 configDesktopLogo.Design.Size = "auto"; 5051 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5052 5053 if (Model.Area.Name == "LEGO") 5054 { 5055 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5056 } 5057 5058 configDesktopActionsMenu.SortId = 20; 5059 configDesktopActionsMenu.Design.Size = "auto-width"; 5060 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5061 5062 if (!hideSearch) 5063 { 5064 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5065 } 5066 break; 5067 case "two-lines-centered": //7 5068 configDesktopLogo.Design.Size = "auto"; 5069 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5070 5071 if (Model.Area.Name == "LEGO") 5072 { 5073 configDesktopMenu.Design.Size = "auto-width"; 5074 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5075 } 5076 5077 configDesktopActionsMenu.SortId = 20; 5078 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5079 5080 if (!hideSearch) 5081 { 5082 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5083 } 5084 break; 5085 case "normal": //1 5086 default: 5087 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5088 5089 if (!hideSearch) 5090 { 5091 configSearchBar.SortId = 20; 5092 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5093 } 5094 5095 configDesktopActionsMenu.SortId = 30; 5096 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5097 5098 configDesktopActionsMenu.Design.Size = "auto-width"; 5099 if (Model.Area.Name == "LEGO") 5100 { 5101 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5102 } 5103 break; 5104 } 5105 } 5106 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5107 5108 @using System 5109 @using System.Web 5110 @using Dynamicweb.Rapido.Blocks.Extensibility 5111 @using Dynamicweb.Rapido.Blocks 5112 5113 @{ 5114 5115 Block masterDesktopActionsMenuOpeningHours = new Block 5116 { 5117 Id = "MasterDesktopActionsMenuOpeningHours", 5118 SortId = 20, 5119 Template = RenderHours() 5120 }; 5121 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOpeningHours); 5122 5123 } 5124 5125 @helper RenderHours() 5126 { 5127 int opneningHoursPageId = GetPageIdByNavigationTag("OpeningHours"); 5128 string opneningHoursPageLink = "/Default.aspx?ID=" + opneningHoursPageId; 5129 5130 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5131 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5132 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5133 5134 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod" title='@Translate("Opening hours")'> 5135 <div class="@menuLinkClass dw-mod"> 5136 <a href="@opneningHoursPageLink" > 5137 <img class="menu__link menu__link--icon" alt="openingHours" src="Files/Images/Icons/clock.svg" style="height: 57px;"/> 5138 </a> 5139 </div> 5140 </li> 5141 } 5142 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 5143 { 5144 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5145 5146 @using System 5147 @using System.Web 5148 @using Dynamicweb.Rapido.Blocks.Extensibility 5149 @using Dynamicweb.Rapido.Blocks 5150 5151 5152 @functions { 5153 // BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 5154 BlocksPage headerCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 5155 } 5156 @{ 5157 5158 // Adds link to A4 5159 Block customMasterDesktopNavigation = new Block 5160 { 5161 Id = "CustomMasterDesktopNavigation", 5162 SortId = 20, 5163 Template = RenderCustomDesktopNavigation(), 5164 SkipRenderBlocksList = false 5165 }; 5166 headerCustomBlocksPage.Add("MasterDesktopNavigation", customMasterDesktopNavigation); 5167 } 5168 5169 @helper RenderCustomDesktopNavigation() 5170 { 5171 var link = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("Store_Link"); 5172 var linkTitle = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("Store_Title"); 5173 var areaName = Model.Area.Name; 5174 5175 if (areaName == "LEGO" || areaName == "A4") 5176 { 5177 <a id="A4_Store_Link" href="@link" rel="noopener" target="_blank">@linkTitle</a> 5178 } 5179 }</text> 5180 } 5181 5182 5183 @helper RenderDesktopTools() 5184 { 5185 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 5186 5187 <div class="tools-navigation dw-mod"> 5188 <div class="center-container grid top-container__center-container dw-mod"> 5189 @RenderBlockList(subBlocks) 5190 </div> 5191 </div> 5192 } 5193 5194 @helper RenderDesktopToolsText() 5195 { 5196 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5197 if (!string.IsNullOrEmpty(toolsText)) 5198 { 5199 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5200 } 5201 } 5202 5203 @helper RenderDesktopToolsNavigation() 5204 { 5205 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5206 5207 if (renderPagesInToolBar) 5208 { 5209 @RenderNavigation(new 5210 { 5211 id = "topToolsNavigation", 5212 cssclass = "menu menu-tools dw-mod dwnavigation", 5213 template = "TopMenu.xslt" 5214 }) 5215 } 5216 } 5217 5218 @helper RenderDesktopNavigation() 5219 { 5220 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5221 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5222 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5223 <nav class="main-navigation dw-mod"> 5224 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5225 @RenderBlockList(subBlocks) 5226 </div> 5227 </nav> 5228 } 5229 5230 @helper RenderDesktopExtra() 5231 { 5232 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 5233 5234 if (subBlocks.Count > 0) 5235 { 5236 <div class="header header-top dw-mod"> 5237 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5238 @RenderBlockList(subBlocks) 5239 </div> 5240 </div> 5241 } 5242 } 5243 5244 5245 @helper RenderDesktopBanner() 5246 { 5247 // ef bara ein mynd þá miðja hana í deskopt annars 2 5248 string imagePrefix = "/Admin/Public/GetImage.ashx?Format=webp&width=1240&amp;height=600&amp;crop=5&amp;Compression=95&amp;DoNotUpscale=0&amp;image="; 5249 var primaryImage = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetFile("Primary_Image")?.PathUrlEncoded; 5250 var primaryLink = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("Primary_Image_Link"); 5251 var secondaryImage = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetFile("Secondary_Image")?.PathUrlEncoded; 5252 var secondaryLink = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetString("Secondary_Image_Link"); 5253 var onlyPrimaryImage = ""; 5254 var noImages = ""; 5255 if (string.IsNullOrWhiteSpace(secondaryImage)) 5256 { 5257 onlyPrimaryImage = "only-primary-image"; 5258 } 5259 if (string.IsNullOrWhiteSpace(primaryImage)) 5260 { 5261 noImages = "no-images"; 5262 } 5263 <div id="frontpageDesktopBanner" class="@onlyPrimaryImage @noImages"> 5264 <a id="primaryImage" href="@primaryLink" class="desktop-banner-link primary"> 5265 <img src="@imagePrefix@primaryImage" class="desktop-banner-image " /> 5266 </a> 5267 <a id="secondaryImage" href="@secondaryLink" class="desktop-banner-link secondary"> 5268 <img src="@imagePrefix@secondaryImage" class="desktop-banner-image" /> 5269 </a> 5270 </div> 5271 }</text> 5272 if (areaName == "A4" || areaName == "MMS" || areaName == "ISB") 5273 { 5274 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5275 5276 @using System 5277 @using System.Web 5278 @using System.Collections.Generic 5279 @using Dynamicweb.Rapido.Blocks.Extensibility 5280 @using Dynamicweb.Rapido.Blocks 5281 @using Dynamicweb.Frontend 5282 5283 @functions { 5284 BlocksPage customDesktopNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 5285 } 5286 5287 @{ 5288 bool mobileNavigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 5289 bool mobileHideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 5290 bool mobileHideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 5291 bool mobileHideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 5292 bool mobileHideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 5293 bool mobileHideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 5294 5295 Block mobileNavigation = new Block() 5296 { 5297 Id = "MobileNavigation", 5298 SortId = 10, 5299 Template = DesktopNavigation(), 5300 SkipRenderBlocksList = true 5301 }; 5302 customDesktopNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 5303 5304 if (Model.CurrentUser.ID > 0 && !mobileHideMyProfileLink) 5305 { 5306 Block mobileNavigationSignIn = new Block 5307 { 5308 Id = "MobileNavigationSignIn", 5309 SortId = 10, 5310 Template = RenderDesktopNavigationSignIn() 5311 }; 5312 customDesktopNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 5313 } 5314 5315 Block mobileNavigationMenu = new Block 5316 { 5317 Id = "MobileNavigationMenu", 5318 SortId = 20, 5319 Template = RenderDesktopNavigationMenu() 5320 }; 5321 customDesktopNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 5322 5323 Block mobileNavigationActions = new Block 5324 { 5325 Id = "MobileNavigationActions", 5326 SortId = 30, 5327 Template = RenderDesktopNavigationActions(), 5328 SkipRenderBlocksList = true 5329 }; 5330 customDesktopNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 5331 5332 if (!mobileNavigationItemsHideSignIn) 5333 { 5334 if (Model.CurrentUser.ID <= 0) 5335 { 5336 Block mobileNavigationSignInAction = new Block 5337 { 5338 Id = "MobileNavigationSignInAction", 5339 SortId = 10, 5340 Template = RenderDesktopNavigationSignInAction() 5341 }; 5342 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 5343 5344 if (!mobileHideCreateAccountLink) 5345 { 5346 Block mobileNavigationCreateAccountAction = new Block 5347 { 5348 Id = "MobileNavigationCreateAccountAction", 5349 SortId = 20, 5350 Template = RenderDesktopNavigationCreateAccountAction() 5351 }; 5352 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 5353 } 5354 } 5355 else 5356 { 5357 if (!mobileHideMyOrdersLink) 5358 { 5359 Block mobileNavigationOrdersAction = new Block 5360 { 5361 Id = "MobileNavigationOrdersAction", 5362 SortId = 20, 5363 Template = RenderDesktopNavigationOrdersAction() 5364 }; 5365 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 5366 } 5367 if (!mobileHideMyFavoritesLink) 5368 { 5369 Block mobileNavigationFavoritesAction = new Block 5370 { 5371 Id = "MobileNavigationFavoritesAction", 5372 SortId = 30, 5373 Template = RenderDesktopNavigationFavoritesAction() 5374 }; 5375 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 5376 } 5377 if (!mobileHideMySavedCardsLink) 5378 { 5379 Block mobileNavigationSavedCardsAction = new Block 5380 { 5381 Id = "MobileNavigationFavoritesAction", 5382 SortId = 30, 5383 Template = RenderDesktopNavigationSavedCardsAction() 5384 }; 5385 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 5386 } 5387 5388 Block mobileNavigationSignOutAction = new Block 5389 { 5390 Id = "MobileNavigationSignOutAction", 5391 SortId = 40, 5392 Template = RenderDesktopNavigationSignOutAction() 5393 }; 5394 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 5395 } 5396 } 5397 5398 if (Model.Languages.Count > 1) 5399 { 5400 Block mobileNavigationLanguagesAction = new Block 5401 { 5402 Id = "MobileNavigationLanguagesAction", 5403 SortId = 50, 5404 Template = RenderDesktopNavigationLanguagesAction() 5405 }; 5406 customDesktopNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 5407 } 5408 } 5409 5410 5411 @helper DesktopNavigation() 5412 { 5413 List<Block> subBlocks = this.customDesktopNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 5414 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 5415 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 5416 var primaryImage = Model.Area.Item.GetItem("Custom").GetItem("CustomSettings").GetFile("Primary_Image")?.PathUrlEncoded; 5417 var noBanner = ""; 5418 if (string.IsNullOrWhiteSpace(primaryImage)) 5419 { 5420 noBanner = "no-banner"; 5421 } 5422 <!-- Trigger for mobile navigation --> 5423 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 5424 5425 5426 5427 <nav id="desktopNav" class="desktop-navigation-slide @noBanner"> 5428 <div class="desktop-navigation-slide__wrapper" id="desktopNavigationSlideWrapper"> 5429 @RenderBlockList(subBlocks) 5430 </div> 5431 </nav> 5432 5433 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 5434 } 5435 5436 @helper RenderDesktopNavigationSignIn() 5437 { 5438 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5439 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 5440 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5441 string myProfilePageLink = linkStart + myProfilePageId; 5442 string userName = Model.CurrentUser.Name; 5443 userName = userName.Contains(" ") ? userName.Split(' ')[0] : userName; 5444 <ul class="menu menu-mobile"> 5445 <li class="menu-mobile__item dw-mod"> 5446 <a href="@myProfilePageLink" class="menu-mobile__link desktop-nav-sign-in--link dw-mod"> 5447 <img class="menu-mobile__link-icon" src="Files/Images/Icons/user.svg" /> 5448 <span> 5449 @userName 5450 </span> 5451 </a> 5452 </li> 5453 </ul> 5454 } 5455 5456 @helper RenderDesktopNavigationMenu() 5457 { 5458 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 5459 string menuTemplate = "CustomBaseMenuForMobileSlidesA4.xslt"; 5460 if (Pageview.Device.ToString() != "Mobile") 5461 { 5462 menuTemplate = "CustomBaseMenuForDesktopA4Slides.xslt"; 5463 } 5464 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 5465 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5466 int startLevel = renderPagesInToolBar ? 1 : 0; 5467 var isFrontPage = PageView.Current().Page.NavigationTag == "Frontpage" ? true : false; 5468 5469 @RenderNavigation(new 5470 { 5471 id = "mobilenavigation", 5472 cssclass = "menu menu-mobile dwnavigation", 5473 startLevel = startLevel, 5474 ecomStartLevel = @startLevel + 1, 5475 endlevel = @levels, 5476 expandmode = "all", 5477 template = @menuTemplate 5478 }) 5479 5480 if (isFrontPage) 5481 { 5482 <script> 5483 document.addEventListener('DOMContentLoaded', function () { 5484 var desktopNavSlideWrapper = document.getElementById('desktopNavigationSlideWrapper'); 5485 if (desktopNavSlideWrapper != null) { 5486 var navHeight = $("#desktopNav").height(); 5487 var desktopNavigationSlideWrapper = $("#desktopNavigationSlideWrapper").height(); 5488 if (navHeight < desktopNavigationSlideWrapper) { 5489 $("#desktopNavigationSlideWrapper").css({ "overflow-y": "auto", "overflow-x": "hidden" }); 5490 } 5491 } 5492 }); 5493 </script> 5494 } 5495 else 5496 { 5497 <script> 5498 document.addEventListener('DOMContentLoaded', function () { 5499 var desktopNavSlideWrapper = document.getElementById('desktopNavigationSlideWrapper'); 5500 if (desktopNavSlideWrapper != null) { 5501 $("#desktopNavigationSlideWrapper").css("overflow-y", "initial"); 5502 } 5503 }); 5504 </script> 5505 } 5506 5507 if (isSlidesDesign) 5508 { 5509 <script> 5510 function goToLevel(level) { 5511 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 5512 document.getElementById('mobileNav').scrollTop = 0; 5513 } 5514 5515 function goToLevelDesktop(level, submenu) { 5516 document.getElementById('desktopNavigationSlideWrapper').style.left = -(level * 100) + "%"; 5517 var windowheight = $(window).height(); 5518 var navMenuHeight = 0; 5519 if ($('#Top').height() !== null) { 5520 var topHeight = $('#Top').height() + 1; 5521 navMenuHeight = windowheight - topHeight; 5522 var navigationMenuHeight = navMenuHeight.toString() + "px)"; 5523 } 5524 5525 var x = document.getElementsByClassName("menu-desktop menu-desktop__submenu active"); 5526 if (x != null) { 5527 for (var i = 0; i < x.length; i++) { 5528 x[i].classList.remove("active"); 5529 } 5530 } 5531 5532 if (level == 0) { 5533 var navHeight = $("#desktopNav").height(); 5534 var desktopNavigationSlideWrapper = $("#desktopNavigationSlideWrapper").height(); 5535 5536 if (navHeight < desktopNavigationSlideWrapper) { 5537 $("#desktopNavigationSlideWrapper").css({ "overflow-y": "auto", "overflow-x": "hidden", "height": "100%" }); 5538 } 5539 } 5540 else { 5541 $("#desktopNavigationSlideWrapper").css({ "overflow-y": "initial", "overflow-x": "initial", "height": "initial" }); 5542 } 5543 5544 if (level == 2 && submenu != null) { 5545 var id = "#" + submenu + "ul >li >ul"; 5546 var menuId = $(id); 5547 if (menuId != null) { 5548 document.getElementById(menuId[0].id).classList.add("active"); 5549 5550 if ($('.menu-desktop__submenu.active') !== null) { 5551 var liHeight = 0; 5552 $('.menu-desktop__submenu.active > li').each(function (i) { 5553 liHeight += $(this).height(); 5554 }); 5555 if (navMenuHeight < liHeight) { 5556 $("#" + menuId[0].id).css('height', navMenuHeight.toString() + 'px'); 5557 } 5558 } 5559 } 5560 } 5561 else if (submenu != null) { 5562 var id = "#" + submenu + "ul"; 5563 var menuId = $(id)[0] == null ? "" : $(id)[0].id; 5564 if (document.getElementById(menuId)) { 5565 document.getElementById(menuId).classList.add("active"); 5566 5567 if ($('.menu-desktop__submenu.active') !== null) { 5568 var liHeight = 0; 5569 $('.menu-desktop__submenu.active > li').each(function (i) { 5570 liHeight += $(this).height(); 5571 }); 5572 if (navMenuHeight < liHeight) { 5573 $("#" + menuId).css('height', navMenuHeight.toString() + 'px'); 5574 } 5575 } 5576 } 5577 } 5578 } 5579 5580 document.addEventListener('DOMContentLoaded', function () { 5581 var mobileNavWrapper = document.getElementById('mobileNavigationWrapper'); 5582 if (mobileNavWrapper != null) { 5583 goToLevel(mobileNavWrapper.querySelectorAll('input[type=radio]:checked').length); 5584 } 5585 }); 5586 5587 document.addEventListener('DOMContentLoaded', function () { 5588 var desktopNavSlideWrapper = document.getElementById('desktopNavigationSlideWrapper'); 5589 if (desktopNavSlideWrapper != null) { 5590 goToLevelDesktop(desktopNavSlideWrapper.querySelectorAll('input[type=radio]:checked').length); 5591 } 5592 }); 5593 </script> 5594 } 5595 5596 if (renderPagesInToolBar) 5597 { 5598 @RenderNavigation(new 5599 { 5600 id = "topToolsMobileNavigation", 5601 cssclass = "menu menu-mobile dwnavigation", 5602 template = "ToolsMenuForMobile.xslt" 5603 }) 5604 } 5605 } 5606 5607 @helper RenderDesktopNavigationActions() 5608 { 5609 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 5610 5611 <ul class="menu menu-mobile"> 5612 @RenderBlockList(subBlocks) 5613 </ul> 5614 } 5615 5616 @helper RenderDesktopNavigationSignInAction() 5617 { 5618 <li class="menu-mobile__item dw-mod"> 5619 <label for="SignInModalTrigger" onclick="document.getElementById('MobileNavTrigger').checked = false;" class="menu-mobile__link dw-mod menu-mobile__link--highlighted"> 5620 <span class="desktop-nav-sign-in--link dw-mod"> 5621 <img class="menu-mobile__link-icon" src="Files/Images/Icons/user.svg" /> 5622 @Translate("Sign in") 5623 </span> 5624 </label> 5625 </li> 5626 } 5627 5628 @helper RenderDesktopNavigationCreateAccountAction() 5629 { 5630 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 5631 5632 <li class="menu-mobile__item"> 5633 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Default.aspx?ID=@createAccountPageId"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("Create account")</a> 5634 </li> 5635 } 5636 5637 @helper RenderDesktopNavigationProfileAction() 5638 { 5639 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5640 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5641 int myProfilePageId = GetPageIdByNavigationTag("CustomerOverview"); 5642 string myProfilePageLink = linkStart + myProfilePageId; 5643 5644 <li class="menu-mobile__item"> 5645 <a href="@myProfilePageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue menu-mobile__link-icon"></i> @Translate("My Profile")</a> 5646 </li> 5647 } 5648 5649 @helper RenderDesktopNavigationOrdersAction() 5650 { 5651 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5652 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5653 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 5654 string myOrdersPageLink = linkStart + myOrdersPageId; 5655 string ordersIcon = "fas fa-list"; 5656 5657 <li class="menu-mobile__item"> 5658 <a href="@myOrdersPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@ordersIcon menu-mobile__link-icon"></i> @Translate("My Orders")</a> 5659 </li> 5660 } 5661 5662 @helper RenderDesktopNavigationFavoritesAction() 5663 { 5664 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5665 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5666 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5667 string myFavoritesPageLink = linkStart + myFavoritesPageId; 5668 string favoritesIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue : "fa fa-star"; 5669 5670 5671 <li class="menu-mobile__item"> 5672 <a href="@myFavoritesPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@favoritesIcon menu-mobile__link-icon"></i> @Translate("My Favorites")</a> 5673 </li> 5674 } 5675 5676 @helper RenderDesktopNavigationSavedCardsAction() 5677 { 5678 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 5679 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 5680 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 5681 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 5682 string savedCardsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards") != null ? "fas fa-" + Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SavedCards").SelectedValue : "fas fa-credit-card"; 5683 5684 <li class="menu-mobile__item"> 5685 <a href="@mySavedCardsPageLink" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@savedCardsIcon menu-mobile__link-icon"></i> @Translate("My Saved Cards")</a> 5686 </li> 5687 } 5688 5689 @helper RenderDesktopNavigationSignOutAction() 5690 { 5691 int pageId = Model.TopPage.ID; 5692 5693 <li class="menu-mobile__item dw-mod"> 5694 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod desktop-nav-sign-in--link" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"> 5695 <img class="menu-mobile__link-icon" src="Files/Images/Icons/signout.svg" /> 5696 @Translate("Sign out") 5697 </a> 5698 </li> 5699 } 5700 5701 @helper RenderDesktopNavigationLanguagesAction() 5702 { 5703 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 5704 5705 string selectedLanguage = ""; 5706 foreach (var lang in Model.Languages) 5707 { 5708 if (lang.IsCurrent) 5709 { 5710 selectedLanguage = lang.Name; 5711 } 5712 } 5713 5714 <li class="menu-mobile__item dw-mod"> 5715 @if (isSlidesDesign) 5716 { 5717 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 5718 } 5719 else 5720 { 5721 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 5722 } 5723 <div class="menu-mobile__link__wrap"> 5724 <label for="MobileMenuCheck_Language" class="menu-mobile__link menu-mobile__link--highlighted dw-mod"><i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue menu-mobile__link-icon"></i> @selectedLanguage</label> 5725 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 5726 </div> 5727 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 5728 @if (isSlidesDesign) 5729 { 5730 <li class="menu-mobile__item dw-mod"> 5731 <div class="menu-mobile__link__wrap"> 5732 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 5733 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 5734 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 5735 </div> 5736 </li> 5737 } 5738 @foreach (var lang in Model.Languages) 5739 { 5740 <li class="menu-mobile__item dw-mod"> 5741 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod menu-mobile__link--level-1" href="/Default.aspx?ID=@lang.Page.ID">@lang.Name</a> 5742 </li> 5743 } 5744 </ul> 5745 </li> 5746 }</text> 5747 } 5748 } 5749 5750 5751 5752 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5753 5754 @using System 5755 @using System.Web 5756 @using Dynamicweb.Rapido.Blocks.Extensibility 5757 @using Dynamicweb.Rapido.Blocks 5758 5759 @{ 5760 Block impersonationBar = new Block 5761 { 5762 Id = "ImpersonationBar", 5763 SortId = 50, 5764 Template = RenderImpersonationBar(), 5765 Design = new Design 5766 { 5767 Size = "auto-width", 5768 HidePadding = true, 5769 RenderType = RenderType.Column 5770 } 5771 }; 5772 5773 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5774 { 5775 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5776 } 5777 } 5778 5779 @helper RenderImpersonationBar() 5780 { 5781 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5782 5783 <div class="u-color-warning--bg"> 5784 <div class="center-container top-container__center-container dw-mod"> 5785 @*Impersonation*@ 5786 <div class="grid"> 5787 <div class="grid--align-self-center grid__col-x"> 5788 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5789 { 5790 string stopImpersonateTranslation = Translate("Stop impersonation"); 5791 string username = ""; 5792 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 5793 { 5794 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 5795 } 5796 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 5797 { 5798 username = Model.CurrentSecondaryUser.Name; 5799 } 5800 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 5801 { 5802 username = Model.CurrentSecondaryUser.Email; 5803 } 5804 else 5805 { 5806 username = Model.CurrentSecondaryUser.UserName; 5807 } 5808 <div class="grid-cell"> 5809 <div class="u-pull--left u-bold u-margin-top"> 5810 <i class="fas fa-user-secret"></i> 5811 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 5812 </div> 5813 <form method="post" class="u-pull--right u-no-margin"> 5814 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 5815 </form> 5816 </div> 5817 } 5818 else 5819 { 5820 string viewListTranslation = Translate("View the list of users you can impersonate"); 5821 <div class="grid-cell u-bold"> 5822 <i class="fas fa-user-secret"></i> 5823 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 5824 </div> 5825 } 5826 </div> 5827 </div> 5828 </div> 5829 </div> 5830 } 5831 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5832 5833 @using System 5834 @using System.Web 5835 @using System.Collections.Generic 5836 @using Dynamicweb.Rapido.Blocks.Extensibility 5837 @using Dynamicweb.Rapido.Blocks 5838 5839 @{ 5840 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 5841 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 5842 5843 Block orderLines = new Block 5844 { 5845 Id = "MiniCartOrderLines", 5846 SkipRenderBlocksList = true, 5847 BlocksList = new List<Block> 5848 { 5849 new Block { 5850 Id = "MiniCartOrderLinesList", 5851 SortId = 20, 5852 Template = RenderMiniCartOrderLinesList() 5853 } 5854 } 5855 }; 5856 5857 Block orderlinesScriptTemplates = new Block 5858 { 5859 Id = "OrderlinesScriptTemplates" 5860 }; 5861 5862 if (orderlinesView == "table") 5863 { 5864 orderLines.Template = RenderMiniCartOrderLinesTable(); 5865 orderLines.BlocksList.Add( 5866 new Block 5867 { 5868 Id = "MiniCartOrderlinesTableHeader", 5869 SortId = 10, 5870 Template = RenderMiniCartOrderLinesHeader() 5871 } 5872 ); 5873 5874 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 5875 } 5876 else 5877 { 5878 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 5879 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 5880 } 5881 5882 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 5883 5884 Block miniCartScriptTemplates = new Block() 5885 { 5886 Id = "MasterMiniCartTemplates", 5887 SortId = 1, 5888 Template = RenderMiniCartScriptTemplates(), 5889 SkipRenderBlocksList = true, 5890 BlocksList = new List<Block> 5891 { 5892 orderLines, 5893 new Block { 5894 Id = "MiniCartFooter", 5895 Template = RenderMiniCartFooter(), 5896 SortId = 50, 5897 SkipRenderBlocksList = true, 5898 BlocksList = new List<Block> 5899 { 5900 new Block { 5901 Id = "MiniCartFees", 5902 Template = RenderMiniCartFees(), 5903 SortId = 30 5904 }, 5905 new Block { 5906 Id = "MiniCartPoints", 5907 Template = RenderMiniCartPoints(), 5908 SortId = 40 5909 }, 5910 new Block { 5911 Id = "MiniCartTotal", 5912 Template = RenderMiniCartTotal(), 5913 SortId = 50 5914 }, 5915 new Block { 5916 Id = "MiniCartActions", 5917 Template = RenderMiniCartActions(), 5918 SortId = 60 5919 } 5920 } 5921 } 5922 } 5923 }; 5924 5925 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5926 } 5927 5928 @helper RenderMiniCartScriptsTableTemplates() 5929 { 5930 <script id="MiniCartOrderline" type="text/x-template"> 5931 {{#unless isEmpty}} 5932 <tr> 5933 <td class="u-w60px"><a href="{{link}}" class="{{hideimage}}"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=50&height=50&crop=5&Compression=95&image={{image}}" alt="{{name}}" title="{{name}}"></a></td> 5934 <td class="u-va-middle"> 5935 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5936 {{#if variantname}} 5937 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5938 {{/if}} 5939 {{#if unitname}} 5940 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5941 {{/if}} 5942 </td> 5943 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5944 <td class="u-ta-right u-va-middle"> 5945 {{#if pointsTotal}} 5946 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5947 {{else}} 5948 {{totalprice}} 5949 {{/if}} 5950 </td> 5951 </tr> 5952 {{/unless}} 5953 </script> 5954 5955 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5956 {{#unless isEmpty}} 5957 <tr class="table__row--no-border"> 5958 <td class="u-w60px">&nbsp;</td> 5959 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 5960 <td class="u-ta-right">&nbsp;</td> 5961 <td class="u-ta-right">{{totalprice}}</td> 5962 </tr> 5963 {{/unless}} 5964 </script> 5965 } 5966 5967 @helper RenderMiniCartScriptsListTemplates() 5968 { 5969 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5970 5971 <script id="MiniCartOrderline" type="text/x-template"> 5972 {{#unless isEmpty}} 5973 <div class="mini-cart-orderline grid dw-mod"> 5974 <div class="grid__col-4"> 5975 <a href="{{link}}" class="{{hideimage}}"> 5976 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=100&height=100&crop=5&Compression=95&image={{image}}" alt="{{name}}" title="{{name}}"> 5977 </a> 5978 </div> 5979 <div class="grid__col-8"> 5980 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--truncate mini-cart-orderline__name--md u-padding-right--lg" title="{{name}}">{{name}}</a> 5981 {{#if variantname}} 5982 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5983 {{/if}} 5984 {{#if unitname}} 5985 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5986 {{/if}} 5987 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5988 5989 <div class="grid__cell-footer"> 5990 <div class="grid__cell"> 5991 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5992 {{#if pointsTotal}} 5993 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5994 {{else}} 5995 {{totalprice}} 5996 {{/if}} 5997 </div> 5998 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId&OrderContext={{ContextID}}', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 5999 </div> 6000 </div> 6001 </div> 6002 </div> 6003 {{/unless}} 6004 </script> 6005 6006 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6007 {{#unless isEmpty}} 6008 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6009 <div class="grid__col-6"> 6010 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6011 </div> 6012 <div class="grid__col-6 total-discount-price">{{totalprice}}</div> 6013 </div> 6014 {{/unless}} 6015 </script> 6016 } 6017 6018 @helper RenderMiniCartScriptTemplates() 6019 { 6020 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6021 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6022 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6023 6024 <script id="MiniCartContent" type="text/x-template"> 6025 {{#.}} 6026 {{#unless isEmpty}} 6027 @RenderBlockList(subBlocks) 6028 {{/unless}} 6029 {{/.}} 6030 </script> 6031 } 6032 6033 @helper RenderMiniCartOrderLinesTable() 6034 { 6035 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6036 6037 <div class="u-overflow-auto"> 6038 <table class="table mini-cart-table dw-mod"> 6039 @RenderBlockList(subBlocks) 6040 </table> 6041 </div> 6042 } 6043 6044 @helper RenderMiniCartOrderLinesBlocks() 6045 { 6046 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6047 6048 <div class="u-overflow-auto"> 6049 @RenderBlockList(subBlocks) 6050 </div> 6051 } 6052 6053 @helper RenderMiniCartOrderLinesHeader() 6054 { 6055 <thead> 6056 <tr> 6057 <td>&nbsp;</td> 6058 <td>@Translate("Product")</td> 6059 <td class="u-ta-right">@Translate("Qty")</td> 6060 <td class="u-ta-right" width="120">@Translate("Price")</td> 6061 </tr> 6062 </thead> 6063 } 6064 6065 @helper RenderMiniCartOrderLinesList() 6066 { 6067 <text> 6068 {{#OrderLines}} 6069 {{#ifCond template "===" "CartOrderline"}} 6070 {{>MiniCartOrderline}} 6071 {{/ifCond}} 6072 {{#ifCond template "===" "CartOrderlineMobile"}} 6073 {{>MiniCartOrderline}} 6074 {{/ifCond}} 6075 {{#ifCond template "===" "CartOrderlineDiscount"}} 6076 {{>MiniCartOrderlineDiscount}} 6077 {{/ifCond}} 6078 {{/OrderLines}} 6079 </text> 6080 } 6081 6082 @helper RenderMiniCartFees() 6083 { 6084 @*<div class="grid u-border-top grid--external-bleed-bottom"> 6085 <div class="grid__col-6"> 6086 {{paymentmethod}} 6087 </div> 6088 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 6089 </div> 6090 <div class="grid grid--external-bleed-bottom"> 6091 <div class="grid__col-6"> 6092 {{shippingmethod}} 6093 </div> 6094 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 6095 </div>*@ 6096 } 6097 6098 @helper RenderMiniCartFooter() 6099 { 6100 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6101 6102 <div class="mini-cart__footer dw-mod"> 6103 @RenderBlockList(subBlocks) 6104 </div> 6105 } 6106 6107 @helper RenderMiniCartActions() 6108 { 6109 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6110 int cartLoginId = GetPageIdByNavigationTag("cartLogin"); 6111 6112 if (Model.CurrentUser.ID <= 0 && cartLoginId > 0) 6113 { 6114 <a href="/Default.aspx?ID=@cartLoginId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width proceed-button dw-mod">@Translate("Proceed to checkout")</a> 6115 } 6116 else 6117 { 6118 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width proceed-button dw-mod">@Translate("Proceed to checkout")</a> 6119 } 6120 <button type="button" title="@Translate("Empty cart")" class="btn btn--secondary u-full-width dw-mod u-margin-bottom clear-button" onclick="googleEnchantImpressionEmptyCart(); Cart.EmptyCart(event, '{{ContextID}}');">@Translate("Empty cart")</button> 6121 } 6122 6123 @helper RenderMiniCartPoints() 6124 { 6125 <text> 6126 {{#if earnings}} 6127 <div class="grid grid--external-bleed-bottom"> 6128 <div class="grid__col-6">@Translate("Earnings")</div> 6129 <div class="grid__col-6 grid--align-end"> 6130 <div> 6131 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6132 </div> 6133 </div> 6134 </div> 6135 {{/if}} 6136 </text> 6137 } 6138 6139 @helper RenderMiniCartTotal() 6140 { 6141 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 6142 {{#if hasDiscount}} 6143 <div class="grid__col-6" style="padding-top:0; padding-bottom:0;">@Translate("Full price")</div> 6144 <div class="grid__col-6 grid--align-end" style="padding-top:0; padding-bottom:0;">{{totalpriceWithoutDiscounts}}</div> 6145 <div class="grid__col-6" style="padding-top:0; padding-bottom:0;">@Translate("Discount")</div> 6146 <div class="grid__col-6 grid--align-end" style="padding-top:0; padding-bottom:0;">{{totalDiscounts}}</div> 6147 {{/if}} 6148 <div class="grid__col-6" style="padding-top:0; padding-bottom:0;">@Translate("Total")</div> 6149 <div class="grid__col-6 grid--align-end" style="padding-top:0; padding-bottom:0;">{{totalprice}}</div> 6150 </div> 6151 } 6152 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6153 6154 @using Dynamicweb.Rapido.Blocks.Extensibility 6155 @using Dynamicweb.Rapido.Blocks 6156 6157 @{ 6158 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 6159 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6160 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6161 6162 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 6163 if (addToCartNotificationType == "modal") 6164 { 6165 Block addToCartNotificationModal = new Block 6166 { 6167 Id = "AddToCartNotificationModal", 6168 Template = RenderAddToCartNotificationModal() 6169 }; 6170 6171 Block addToCartNotificationScript = new Block 6172 { 6173 Id = "AddToCartNotificationScript", 6174 Template = RenderAddToCartNotificationModalScript() 6175 }; 6176 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6177 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6178 } 6179 else if (addToCartNotificationType == "toggle" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6180 { 6181 Block addToCartNotificationScript = new Block 6182 { 6183 Id = "AddToCartNotificationScript", 6184 Template = RenderAddToCartNotificationToggleScript() 6185 }; 6186 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6187 } 6188 } 6189 } 6190 6191 @helper RenderAddToCartNotificationModal() 6192 { 6193 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6194 } 6195 6196 @helper RenderAddToCartNotificationModalScript() 6197 { 6198 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6199 6200 <script id="LastAddedProductTemplate" type="text/x-template"> 6201 <!-- Trigger for the login modal --> 6202 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 6203 6204 <!-- Login modal --> 6205 <div class="modal-container"> 6206 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 6207 <div class="modal modal--md"> 6208 <div class="modal__header"> 6209 <h2>@Translate("Product is added to the cart")</h2> 6210 </div> 6211 <div class="modal__body"> 6212 <div class="grid"> 6213 <div class="grid__col-2"> 6214 <a href="{{productInfo.link}}"> 6215 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 6216 </a> 6217 </div> 6218 <div class="u-padding grid--align-self-center"> 6219 <span>{{quantity}}</span> x 6220 </div> 6221 <div class="grid__col-auto grid--align-self-center"> 6222 <div>{{productInfo.name}}</div> 6223 {{#if productInfo.variantName}} 6224 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6225 {{/if}} 6226 {{#if productInfo.unitName}} 6227 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6228 {{/if}} 6229 </div> 6230 </div> 6231 <div class="modal__footer u-margin-top--lg"> 6232 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 6233 <a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 6234 </div> 6235 </div> 6236 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 6237 </div> 6238 </div> 6239 </script> 6240 <script> 6241 document.addEventListener('addToCart', function (event) { 6242 Cart.ShowLastAddedProductModal(event.detail); 6243 }); 6244 </script> 6245 } 6246 6247 @helper RenderAddToCartNotificationToggleScript() 6248 { 6249 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6250 6251 <script> 6252 document.addEventListener('addToCart', function () { 6253 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6254 }); 6255 </script> 6256 } 6257 @*Legobud areaId = 1 & A4 areaId = 3*@ 6258 6259 @if (areaName == "LEGO") 6260 { 6261 // Lego 6262 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6263 6264 @using System 6265 @using System.Web 6266 @using System.Collections.Generic 6267 @using Dynamicweb.Rapido.Blocks.Extensibility 6268 @using Dynamicweb.Rapido.Blocks 6269 @using Dynamicweb.Content; 6270 6271 @functions { 6272 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6273 } 6274 6275 @{ 6276 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6277 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6278 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6279 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6280 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6281 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6282 6283 6284 6285 Block masterFooterContent = new Block() 6286 { 6287 Id = "MasterFooterContent", 6288 SortId = 10, 6289 Template = RenderFooter(), 6290 SkipRenderBlocksList = true 6291 }; 6292 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6293 6294 // Mailing list and advertisment 6295 Block masterFooterRowOne = new Block 6296 { 6297 Id = "MasterFooterRowOne", 6298 SortId = 10, 6299 Template = RenderFooterRowOne(), 6300 Design = new Design 6301 { 6302 Size = "auto", 6303 RenderType = RenderType.Row 6304 } 6305 }; 6306 footerBlocksPage.Add("MasterFooterContent", masterFooterRowOne); 6307 6308 // Footer columns 6309 Block masterFooterRowTwo = new Block 6310 { 6311 Id = "MasterFooterRowTwo", 6312 SortId = 20, 6313 Template = RenderFooterRowTwo(), 6314 Design = new Design 6315 { 6316 Size = "auto", 6317 RenderType = RenderType.Row 6318 } 6319 }; 6320 footerBlocksPage.Add("MasterFooterContent", masterFooterRowTwo); 6321 6322 // General info & Social links 6323 Block masterFooterRowThree = new Block 6324 { 6325 Id = "MasterFooterRowThree", 6326 SortId = 30, 6327 Template = RenderFooterRowThree(), 6328 Design = new Design 6329 { 6330 Size = "auto", 6331 RenderType = RenderType.Row 6332 } 6333 }; 6334 footerBlocksPage.Add("MasterFooterContent", masterFooterRowThree); 6335 6336 Block masterFooterRowFour = new Block 6337 { 6338 Id = "MasterFooterRowFour", 6339 SortId = 40, 6340 Template = RenderFooterRowFour(), 6341 Design = new Design 6342 { 6343 Size = "auto", 6344 RenderType = RenderType.Row 6345 } 6346 }; 6347 footerBlocksPage.Add("MasterFooterContent", masterFooterRowFour); 6348 6349 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6350 { 6351 Block masterFooterNewsletterSignUp = new Block 6352 { 6353 Id = "MasterFooterNewsletterSignUp", 6354 SortId = 10, 6355 Template = RenderFooterNewsletterSignUp(), 6356 Design = new Design 6357 { 6358 Size = "auto", 6359 RenderType = RenderType.Column 6360 } 6361 }; 6362 footerBlocksPage.Add("MasterFooterRowOne", masterFooterNewsletterSignUp); 6363 } 6364 6365 6366 Block MasterFooterAdvertisment = new Block 6367 { 6368 Id = "MasterFooterAdvertisment", 6369 SortId = 20, 6370 Template = RenderFooterAdvertisment(), 6371 Design = new Design 6372 { 6373 Size = "auto", 6374 RenderType = RenderType.Column 6375 } 6376 }; 6377 footerBlocksPage.Add("MasterFooterRowOne", MasterFooterAdvertisment); 6378 6379 int customFooterColumnOneParentPageID = GetPageIdByNavigationTag("FooterColumnOne"); 6380 int customFooterColumnTwoParentPageID = GetPageIdByNavigationTag("FooterColumnTwo"); 6381 int customFooterColumnThreeParentPageID = GetPageIdByNavigationTag("FooterColumnThree"); 6382 int customFooterColumnFourParentPageID = GetPageIdByNavigationTag("FooterColumnFour"); 6383 6384 6385 var columnSize = "3"; 6386 6387 if (Pageview.Device.ToString() == "Mobile") 6388 { 6389 columnSize = "12"; 6390 } 6391 if (customFooterColumnOneParentPageID != 0) 6392 { 6393 Block MasterFooterCustomColumnOne = new Block 6394 { 6395 6396 Id = "MasterFooterCustomColumnOne", 6397 SortId = 20, 6398 Template = RenderCustomColumn(customFooterColumnOneParentPageID), 6399 Design = new Design 6400 { 6401 Size = columnSize, 6402 CssClass = "footer-custom-column", 6403 RenderType = RenderType.Column 6404 } 6405 }; 6406 footerBlocksPage.Add("MasterFooterRowTwo", MasterFooterCustomColumnOne); 6407 } 6408 if (customFooterColumnTwoParentPageID != 0) 6409 { 6410 Block MasterFooterCustomColumnTwo = new Block 6411 { 6412 6413 Id = "MasterFooterCustomColumnTwo", 6414 SortId = 20, 6415 Template = RenderCustomColumn(customFooterColumnTwoParentPageID), 6416 Design = new Design 6417 { 6418 Size = columnSize, 6419 CssClass = "footer-custom-column", 6420 RenderType = RenderType.Column 6421 } 6422 }; 6423 footerBlocksPage.Add("MasterFooterRowTwo", MasterFooterCustomColumnTwo); 6424 } 6425 if (customFooterColumnThreeParentPageID != 0) 6426 { 6427 Block MasterFooterCustomColumnThree = new Block 6428 { 6429 6430 Id = "MasterFooterCustomColumnThree", 6431 SortId = 20, 6432 Template = RenderCustomColumn(customFooterColumnThreeParentPageID), 6433 Design = new Design 6434 { 6435 Size = columnSize, 6436 CssClass = "footer-custom-column", 6437 RenderType = RenderType.Column 6438 } 6439 }; 6440 6441 footerBlocksPage.Add("MasterFooterRowTwo", MasterFooterCustomColumnThree); 6442 } 6443 if (customFooterColumnFourParentPageID != 0) 6444 { 6445 Block MasterFooterCustomColumnFour = new Block 6446 { 6447 6448 Id = "MasterFooterCustomColumnFour", 6449 SortId = 20, 6450 Template = RenderCustomColumn(customFooterColumnFourParentPageID), 6451 Design = new Design 6452 { 6453 Size = columnSize, 6454 CssClass = "footer-custom-column", 6455 RenderType = RenderType.Column 6456 } 6457 }; 6458 footerBlocksPage.Add("MasterFooterRowTwo", MasterFooterCustomColumnFour); 6459 } 6460 6461 6462 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6463 { 6464 Block masterFooterColumnOne = new Block 6465 { 6466 Id = "MasterFooterColumnOne", 6467 SortId = 10, 6468 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6469 Design = new Design 6470 { 6471 Size = "auto", 6472 RenderType = RenderType.Column 6473 } 6474 }; 6475 footerBlocksPage.Add("MasterFooterRowThree", masterFooterColumnOne); 6476 } 6477 6478 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6479 { 6480 Block masterFooterColumnTwo = new Block 6481 { 6482 Id = "MasterFooterColumnTwo", 6483 SortId = 20, 6484 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6485 Design = new Design 6486 { 6487 Size = "auto", 6488 RenderType = RenderType.Column 6489 } 6490 }; 6491 footerBlocksPage.Add("MasterFooterRowThree", masterFooterColumnTwo); 6492 } 6493 6494 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6495 { 6496 Block masterFooterColumnThree = new Block 6497 { 6498 Id = "MasterFooterColumnThree", 6499 SortId = 30, 6500 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6501 Design = new Design 6502 { 6503 Size = "auto", 6504 RenderType = RenderType.Column 6505 } 6506 }; 6507 footerBlocksPage.Add("MasterFooterRowThree", masterFooterColumnThree); 6508 } 6509 6510 6511 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6512 { 6513 Block masterFooterSocialLinks = new Block 6514 { 6515 Id = "MasterFooterSocialLinks", 6516 SortId = 40, 6517 Template = RenderFooterSocialLinks(), 6518 Design = new Design 6519 { 6520 Size = "auto", 6521 RenderType = RenderType.Column 6522 } 6523 }; 6524 footerBlocksPage.Add("MasterFooterRowThree", masterFooterSocialLinks); 6525 } 6526 6527 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6528 { 6529 Block masterFooterPayments = new Block 6530 { 6531 Id = "MasterFooterPayments", 6532 SortId = 50, 6533 Template = RenderFooterPayments(), 6534 Design = new Design 6535 { 6536 Size = "12", 6537 RenderType = RenderType.Column 6538 } 6539 }; 6540 footerBlocksPage.Add("MasterFooterRowThree", masterFooterPayments); 6541 } 6542 6543 Block masterFooterVottanir = new Block 6544 { 6545 Id = "MasterFooterVottanir", 6546 SortId = 10, 6547 Template = RenderFooterVottanir(), 6548 Design = new Design 6549 { 6550 Size = "auto", 6551 RenderType = RenderType.Column, 6552 6553 } 6554 }; 6555 footerBlocksPage.Add("MasterFooterRowFour", masterFooterVottanir); 6556 6557 } 6558 6559 @helper RenderFooterRowOne() 6560 { 6561 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterRowOne").OrderBy(item => item.SortId).ToList(); 6562 6563 } 6564 6565 6566 @helper RenderFooterRowTwo() 6567 { 6568 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterRowTwo").OrderBy(item => item.SortId).ToList(); 6569 6570 } 6571 6572 6573 @helper RenderFooterRowThree() 6574 { 6575 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterRowThree").OrderBy(item => item.SortId).ToList(); 6576 6577 } 6578 6579 @helper RenderFooterRowFour() 6580 { 6581 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterRowFour").OrderBy(item => item.SortId).ToList(); 6582 6583 } 6584 6585 @helper RenderFooter() 6586 { 6587 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6588 string CartId = GetPageIdByNavigationTag("CartPage").ToString(); 6589 bool hasCartID = Dynamicweb.Context.Current.Request.RawUrl.Contains(CartId); 6590 6591 if (!(isCart || hasCartID)) 6592 { 6593 <footer class="footer dw-mod"> 6594 <div class="center-container top-container__center-container dw-mod"> 6595 <div class="grid grid--external-bleed-x"> 6596 @RenderBlockList(subBlocks) 6597 </div> 6598 </div> 6599 </footer> 6600 } 6601 } 6602 6603 @helper RenderFooterColumn(string header, string content) 6604 { 6605 <h3 class="footer__heading dw-mod">@header</h3> 6606 <div class="footer__content dw-mod"> 6607 @content 6608 </div> 6609 } 6610 6611 @helper RenderFooterNewsletterSignUp() 6612 { 6613 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6614 <h2>LEGO Klúbburinn</h2> 6615 <h3>Vertu með í skemmtilegum klúbbi</h3> 6616 <div class="footer__content dw-mod footer-newsletter-container"> 6617 <form class="form dw-mod newsletter-form" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 6618 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 6619 <div class="form__field-combi newsletter-input-container"> 6620 <label for="NewsletterEmail" class="u-hidden">Newsletter</label> 6621 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Netfang", "true")' class="u-full-width" /> 6622 <input class="btn dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Skrá mig", "true")' /> 6623 </div> 6624 </form> 6625 </div> 6626 } 6627 6628 @helper RenderFooterAdvertisment() 6629 { 6630 6631 int footerAdId = GetPageIdByNavigationTag("FooterAdvertise"); 6632 6633 <div class="footer__content dw-mod footer-advertisment-container"> 6634 @RenderPageContent(footerAdId) 6635 </div> 6636 } 6637 6638 @helper RenderFooterSocialLinks() 6639 { 6640 <div class="footer__content dw-mod"> 6641 <div class="collection dw-mod"> 6642 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6643 { 6644 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6645 6646 string socialIconClass = socialIcon.SelectedValue; 6647 string socialIconTitle = socialIcon.SelectedName; 6648 string socialLink = socialitem.GetString("Link"); 6649 if (socialLink.Contains("facebook")) 6650 { 6651 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="facebook" src='Files/Images/Icons/facebook.svg' style='height: 37px;' /></a> 6652 } 6653 else if (socialLink.Contains("instagram")) 6654 { 6655 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="instagram" src='Files/Images/Icons/instagram.svg' style='height: 37px;' /></a> 6656 } 6657 else if (socialLink.Contains("twitter")) 6658 { 6659 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="twitter" src='Files/Images/Icons/twitter.svg' style='height: 37px;' /></a> 6660 } 6661 else if (socialLink.Contains("linked")) 6662 { 6663 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="linkedin" src='Files/Images/Icons/linkedin.svg' style='height: 37px;' /></a> 6664 } 6665 } 6666 </div> 6667 </div> 6668 } 6669 6670 @helper RenderFooterPayments() 6671 { 6672 <div class="footer__content dw-mod"> 6673 <div class="collection dw-mod"> 6674 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6675 { 6676 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6677 string paymentImage = null; 6678 string paymentTitle = paymentItem.SelectedName; 6679 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6680 if (selected != null) 6681 { 6682 paymentImage = selected.Icon; 6683 } 6684 6685 <div class="footer__card-type"> 6686 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=60&Compression=95&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 6687 </div> 6688 } 6689 </div> 6690 </div> 6691 } 6692 6693 @helper RenderFooterVottanir() 6694 { 6695 <div class="footer__content dw-mod"> 6696 <div class="collection dw-mod footer-vottanir-container"> 6697 <img class='footer__social--icon' id="jafnlaunavottun-icon" alt="jafnlaunavottun" src='Files/Images/Icons/jafnlaunavottun_text.svg' /> 6698 <img class='footer__social--icon' id="framurskarandi-icon" alt="framurskarandi fyrirtæki" src='Files/Images/Icons/framurskarandi.svg' /> 6699 <img class='footer__social--icon' id="fyrirmyndar-icon" alt="fyrirmyndar fyrirtæki" src='Files/Images/Icons/fyrirmyndar.svg' /> 6700 </div> 6701 </div> 6702 } 6703 6704 @helper RenderCustomColumn(int pageId) 6705 { 6706 if (pageId != 0) 6707 { 6708 Dynamicweb.Content.PageService pageService = new Dynamicweb.Content.PageService(); 6709 string parentPageName = pageService.GetPage(pageId).GetDisplayName(); 6710 IEnumerable<Dynamicweb.Content.Page> pages = pageService.GetPagesByParentID(pageId); 6711 if (Pageview.Device.ToString() == "Mobile") 6712 { 6713 <div class="footer-column-links mobile" onload="setWidth()"> 6714 <div onclick="toggleFooterLinks(this)" class="footer-column-header-container"> 6715 <h4 class="footer-column-header">@parentPageName</h4> 6716 <i class="fa fa-plus"></i> 6717 </div> 6718 6719 <div class="footer-column-links-container" style="display:none"> 6720 @foreach (var page in pages) 6721 { 6722 if (page.Active) 6723 { 6724 <a href="/Default.aspx?ID=@page.ID">@page.GetDisplayName()</a> 6725 } 6726 } 6727 </div> 6728 </div> 6729 } 6730 else 6731 { 6732 <div class="footer-column-links"> 6733 <h4 class="footer-column-header">@parentPageName</h4> 6734 <div class="footer-column-links-container"> 6735 @foreach (var page in pages) 6736 { 6737 if (page.Active) 6738 { 6739 <a href="/Default.aspx?ID=@page.ID">@page.GetDisplayName()</a> 6740 } 6741 } 6742 </div> 6743 </div> 6744 } 6745 } 6746 6747 6748 6749 <script> 6750 function toggleFooterLinks(elem) { 6751 var content = elem.nextElementSibling; 6752 if (content.style.display === "flex") { 6753 elem.lastChild.previousSibling.classList.remove("fa-minus"); 6754 elem.lastChild.previousSibling.classList.add("fa-plus"); 6755 content.style.display = "none"; 6756 } else { 6757 elem.lastChild.previousSibling.classList.remove("fa-plus"); 6758 elem.lastChild.previousSibling.classList.add("fa-minus"); 6759 content.style.display = "flex"; 6760 } 6761 } 6762 </script> 6763 } 6764 </text> 6765 } 6766 else if (areaName == "A4") 6767 { 6768 // A4 6769 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6770 6771 @using System 6772 @using System.Web 6773 @using System.Collections.Generic 6774 @using Dynamicweb.Rapido.Blocks.Extensibility 6775 @using Dynamicweb.Rapido.Blocks 6776 @using Dynamicweb.Content; 6777 6778 @functions { 6779 BlocksPage footerBlocksPage_A4 = BlocksPage.GetBlockPage("Master"); 6780 } 6781 6782 @{ 6783 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6784 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6785 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6786 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6787 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6788 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6789 6790 6791 6792 Block masterFooterContent = new Block() 6793 { 6794 Id = "MasterFooterContent", 6795 SortId = 10, 6796 Template = RenderFooter_A4(), 6797 SkipRenderBlocksList = true 6798 }; 6799 footerBlocksPage_A4.Add(MasterBlockId.MasterFooter, masterFooterContent); 6800 6801 // Mailing list and advertisment 6802 Block masterFooterRowOne = new Block 6803 { 6804 Id = "MasterFooterRowOne", 6805 SortId = 10, 6806 Template = RenderFooterRowOne_A4(), 6807 Design = new Design 6808 { 6809 Size = "auto", 6810 RenderType = RenderType.Row 6811 } 6812 }; 6813 footerBlocksPage_A4.Add("MasterFooterContent", masterFooterRowOne); 6814 6815 // Footer columns 6816 Block masterFooterRowTwo = new Block 6817 { 6818 Id = "MasterFooterRowTwo", 6819 SortId = 20, 6820 Template = RenderFooterRowTwo_A4(), 6821 Design = new Design 6822 { 6823 Size = "auto", 6824 RenderType = RenderType.Row 6825 } 6826 }; 6827 footerBlocksPage_A4.Add("MasterFooterContent", masterFooterRowTwo); 6828 6829 // General info & Social links 6830 Block masterFooterRowThree = new Block 6831 { 6832 Id = "MasterFooterRowThree", 6833 SortId = 30, 6834 Template = RenderFooterRowThree_A4(), 6835 Design = new Design 6836 { 6837 Size = "auto", 6838 RenderType = RenderType.Row 6839 } 6840 }; 6841 footerBlocksPage_A4.Add("MasterFooterContent", masterFooterRowThree); 6842 6843 Block masterFooterRowFour = new Block 6844 { 6845 Id = "MasterFooterRowFour", 6846 SortId = 40, 6847 Template = RenderFooterRowFour_A4(), 6848 Design = new Design 6849 { 6850 Size = "auto", 6851 RenderType = RenderType.Row 6852 } 6853 }; 6854 footerBlocksPage_A4.Add("MasterFooterContent", masterFooterRowFour); 6855 6856 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6857 { 6858 Block masterFooterNewsletterSignUp = new Block 6859 { 6860 Id = "MasterFooterNewsletterSignUp", 6861 SortId = 10, 6862 Template = RenderFooterNewsletterSignUp_A4(), 6863 Design = new Design 6864 { 6865 Size = "auto", 6866 RenderType = RenderType.Column 6867 } 6868 }; 6869 footerBlocksPage_A4.Add("MasterFooterRowOne", masterFooterNewsletterSignUp); 6870 } 6871 6872 6873 Block MasterFooterAdvertisment = new Block 6874 { 6875 Id = "MasterFooterAdvertisment", 6876 SortId = 20, 6877 Template = RenderFooterAdvertisment_A4(), 6878 Design = new Design 6879 { 6880 Size = "auto", 6881 RenderType = RenderType.Column 6882 } 6883 }; 6884 footerBlocksPage_A4.Add("MasterFooterRowOne", MasterFooterAdvertisment); 6885 6886 int customFooterColumnOneParentPageID = GetPageIdByNavigationTag("FooterColumnOne"); 6887 int customFooterColumnTwoParentPageID = GetPageIdByNavigationTag("FooterColumnTwo"); 6888 int customFooterColumnThreeParentPageID = GetPageIdByNavigationTag("FooterColumnThree"); 6889 int customFooterColumnFourParentPageID = GetPageIdByNavigationTag("FooterColumnFour"); 6890 6891 6892 var columnSize = "3"; 6893 6894 if (Pageview.Device.ToString() == "Mobile") 6895 { 6896 columnSize = "12"; 6897 } 6898 if (customFooterColumnOneParentPageID != 0) 6899 { 6900 Block MasterFooterCustomColumnOne = new Block 6901 { 6902 6903 Id = "MasterFooterCustomColumnOne", 6904 SortId = 20, 6905 Template = RenderCustomColumn_A4(customFooterColumnOneParentPageID), 6906 Design = new Design 6907 { 6908 Size = columnSize, 6909 CssClass = "footer-custom-column", 6910 RenderType = RenderType.Column 6911 } 6912 }; 6913 footerBlocksPage_A4.Add("MasterFooterRowTwo", MasterFooterCustomColumnOne); 6914 } 6915 if (customFooterColumnTwoParentPageID != 0) 6916 { 6917 Block MasterFooterCustomColumnTwo = new Block 6918 { 6919 6920 Id = "MasterFooterCustomColumnTwo", 6921 SortId = 20, 6922 Template = RenderCustomColumn_A4(customFooterColumnTwoParentPageID), 6923 Design = new Design 6924 { 6925 Size = columnSize, 6926 CssClass = "footer-custom-column", 6927 RenderType = RenderType.Column 6928 } 6929 }; 6930 footerBlocksPage_A4.Add("MasterFooterRowTwo", MasterFooterCustomColumnTwo); 6931 } 6932 if (customFooterColumnThreeParentPageID != 0) 6933 { 6934 Block MasterFooterCustomColumnThree = new Block 6935 { 6936 6937 Id = "MasterFooterCustomColumnThree", 6938 SortId = 20, 6939 Template = RenderCustomColumn_A4(customFooterColumnThreeParentPageID), 6940 Design = new Design 6941 { 6942 Size = columnSize, 6943 CssClass = "footer-custom-column", 6944 RenderType = RenderType.Column 6945 } 6946 }; 6947 6948 footerBlocksPage_A4.Add("MasterFooterRowTwo", MasterFooterCustomColumnThree); 6949 } 6950 if (customFooterColumnFourParentPageID != 0) 6951 { 6952 Block MasterFooterCustomColumnFour = new Block 6953 { 6954 6955 Id = "MasterFooterCustomColumnFour", 6956 SortId = 20, 6957 Template = RenderCustomColumn_A4(customFooterColumnFourParentPageID), 6958 Design = new Design 6959 { 6960 Size = columnSize, 6961 CssClass = "footer-custom-column", 6962 RenderType = RenderType.Column 6963 } 6964 }; 6965 footerBlocksPage_A4.Add("MasterFooterRowTwo", MasterFooterCustomColumnFour); 6966 } 6967 6968 6969 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6970 { 6971 Block masterFooterColumnOne = new Block 6972 { 6973 Id = "MasterFooterColumnOne", 6974 SortId = 10, 6975 Template = RenderFooterColumn_A4(footerColumnOneHeader, footerColumnOneContent), 6976 Design = new Design 6977 { 6978 Size = "auto", 6979 RenderType = RenderType.Column 6980 } 6981 }; 6982 footerBlocksPage_A4.Add("MasterFooterRowThree", masterFooterColumnOne); 6983 } 6984 6985 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6986 { 6987 Block masterFooterColumnTwo = new Block 6988 { 6989 Id = "MasterFooterColumnTwo", 6990 SortId = 20, 6991 Template = RenderFooterColumn_A4(footerColumnTwoHeader, footerColumnTwoContent), 6992 Design = new Design 6993 { 6994 Size = "auto", 6995 RenderType = RenderType.Column 6996 } 6997 }; 6998 footerBlocksPage_A4.Add("MasterFooterRowThree", masterFooterColumnTwo); 6999 } 7000 7001 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 7002 { 7003 Block masterFooterColumnThree = new Block 7004 { 7005 Id = "MasterFooterColumnThree", 7006 SortId = 30, 7007 Template = RenderFooterColumn_A4(footerColumnThreeHeader, footerColumnThreeContent), 7008 Design = new Design 7009 { 7010 Size = "auto", 7011 RenderType = RenderType.Column 7012 } 7013 }; 7014 footerBlocksPage_A4.Add("MasterFooterRowThree", masterFooterColumnThree); 7015 } 7016 7017 7018 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 7019 { 7020 Block masterFooterSocialLinks = new Block 7021 { 7022 Id = "MasterFooterSocialLinks", 7023 SortId = 40, 7024 Template = RenderFooterSocialLinks_A4(), 7025 Design = new Design 7026 { 7027 Size = "auto", 7028 RenderType = RenderType.Column 7029 } 7030 }; 7031 footerBlocksPage_A4.Add("MasterFooterRowThree", masterFooterSocialLinks); 7032 } 7033 7034 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 7035 { 7036 Block masterFooterPayments = new Block 7037 { 7038 Id = "MasterFooterPayments", 7039 SortId = 50, 7040 Template = RenderFooterPayments_A4(), 7041 Design = new Design 7042 { 7043 Size = "12", 7044 RenderType = RenderType.Column 7045 } 7046 }; 7047 footerBlocksPage_A4.Add("MasterFooterRowThree", masterFooterPayments); 7048 } 7049 7050 Block masterFooterVottanir = new Block 7051 { 7052 Id = "MasterFooterVottanir", 7053 SortId = 10, 7054 Template = RenderFooterVottanir_A4(), 7055 Design = new Design 7056 { 7057 Size = "auto", 7058 RenderType = RenderType.Column, 7059 7060 } 7061 }; 7062 footerBlocksPage_A4.Add("MasterFooterRowFour", masterFooterVottanir); 7063 7064 } 7065 7066 @helper RenderFooterRowOne_A4() 7067 { 7068 List<Block> subBlocks = this.footerBlocksPage_A4.GetBlockListById("MasterFooterRowOne").OrderBy(item => item.SortId).ToList(); 7069 7070 } 7071 7072 7073 @helper RenderFooterRowTwo_A4() 7074 { 7075 List<Block> subBlocks = this.footerBlocksPage_A4.GetBlockListById("MasterFooterRowTwo").OrderBy(item => item.SortId).ToList(); 7076 7077 } 7078 7079 7080 @helper RenderFooterRowThree_A4() 7081 { 7082 List<Block> subBlocks = this.footerBlocksPage_A4.GetBlockListById("MasterFooterRowThree").OrderBy(item => item.SortId).ToList(); 7083 7084 } 7085 7086 @helper RenderFooterRowFour_A4() 7087 { 7088 List<Block> subBlocks = this.footerBlocksPage_A4.GetBlockListById("MasterFooterRowFour").OrderBy(item => item.SortId).ToList(); 7089 7090 } 7091 7092 @helper RenderFooter_A4() 7093 { 7094 List<Block> subBlocks = this.footerBlocksPage_A4.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 7095 string CartId = GetPageIdByNavigationTag("CartPage").ToString(); 7096 bool hasCartID = Dynamicweb.Context.Current.Request.RawUrl.Contains(CartId); 7097 7098 if (!(isCart || hasCartID)) 7099 { 7100 <footer class="footer dw-mod"> 7101 <div class="center-container top-container__center-container dw-mod"> 7102 <div class="grid grid--external-bleed-x"> 7103 @RenderBlockList(subBlocks) 7104 </div> 7105 </div> 7106 </footer> 7107 } 7108 } 7109 7110 @helper RenderFooterColumn_A4(string header, string content) 7111 { 7112 <h3 class="footer__heading dw-mod">@header</h3> 7113 <div class="footer__content dw-mod"> 7114 @content 7115 </div> 7116 } 7117 7118 @helper RenderFooterNewsletterSignUp_A4() 7119 { 7120 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 7121 <h2 style="font-family: 'Satisfy'; font-weight: 100;">A4 Klúbburinn</h2> 7122 <h3 style="font-weight: 300;">Spennandi vörur og áhugaverð tilboð</h3> 7123 <div class="footer__content dw-mod footer-newsletter-container"> 7124 <form class="form dw-mod newsletter-form" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 7125 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 7126 <label for="NewsletterEmail" class="u-hidden">Newsletter</label> 7127 <div class="form__field-combi newsletter-input-container"> 7128 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Netfang", "true")' class="u-full-width" /> 7129 <input class="btn dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Skrá mig", "true")' /> 7130 </div> 7131 </form> 7132 </div> 7133 } 7134 7135 @helper RenderFooterAdvertisment_A4() 7136 { 7137 7138 int footerAdId = GetPageIdByNavigationTag("FooterAdvertise"); 7139 7140 <div class="footer__content dw-mod footer-advertisment-container"> 7141 @RenderPageContent(footerAdId) 7142 </div> 7143 } 7144 7145 @helper RenderFooterSocialLinks_A4() 7146 { 7147 <div class="footer__content dw-mod"> 7148 <div class="collection dw-mod"> 7149 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 7150 { 7151 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7152 7153 string socialIconClass = socialIcon.SelectedValue; 7154 string socialIconTitle = socialIcon.SelectedName; 7155 string socialLink = socialitem.GetString("Link"); 7156 if (socialLink.Contains("facebook")) 7157 { 7158 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="facebook" src='Files/Images/Icons/facebook.svg' style='height: 37px;' /></a> 7159 } 7160 else if (socialLink.Contains("instagram")) 7161 { 7162 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="instagram" src='Files/Images/Icons/instagram.svg' style='height: 37px;' /></a> 7163 } 7164 else if (socialLink.Contains("twitter")) 7165 { 7166 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="twitter" src='Files/Images/Icons/twitter.svg' style='height: 37px;' /></a> 7167 } 7168 else if (socialLink.Contains("linked")) 7169 { 7170 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener" style="background-color: unset;"><img class='footer__social--icon' alt="linkedin" src='Files/Images/Icons/linkedin.svg' style='height: 37px;' /></a> 7171 } 7172 } 7173 </div> 7174 </div> 7175 } 7176 7177 @helper RenderFooterPayments_A4() 7178 { 7179 <div class="footer__content dw-mod"> 7180 <div class="collection dw-mod"> 7181 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 7182 { 7183 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 7184 string paymentImage = null; 7185 string paymentTitle = paymentItem.SelectedName; 7186 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 7187 if (selected != null) 7188 { 7189 paymentImage = selected.Icon; 7190 } 7191 7192 <div class="footer__card-type"> 7193 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=60&Compression=95&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 7194 </div> 7195 } 7196 </div> 7197 </div> 7198 } 7199 7200 @helper RenderFooterVottanir_A4() 7201 { 7202 <div class="footer__content dw-mod"> 7203 <div class="collection dw-mod footer-vottanir-container"> 7204 <img class='footer__social--icon' id="jafnlaunavottun-icon" alt="jafnlaunavottun" src='Files/Images/Icons/jafnlaunavottun_text.svg' /> 7205 <img class='footer__social--icon' id="framurskarandi-icon" alt="framurskarandi fyrirtæki" src='Files/Images/Icons/framurskarandi.svg' /> 7206 <img class='footer__social--icon' id="fyrirmyndar-icon" alt="fyrirmyndar fyrirtæki" src='Files/Images/Icons/fyrirmyndar.svg' /> 7207 </div> 7208 </div> 7209 } 7210 7211 @helper RenderCustomColumn_A4(int pageId) 7212 { 7213 if (pageId != 0) 7214 { 7215 Dynamicweb.Content.PageService pageService = new Dynamicweb.Content.PageService(); 7216 string parentPageName = pageService.GetPage(pageId).GetDisplayName(); 7217 IEnumerable<Dynamicweb.Content.Page> pages = pageService.GetPagesByParentID(pageId); 7218 if (Pageview.Device.ToString() == "Mobile") 7219 { 7220 <div class="footer-column-links mobile" onload="setWidth()"> 7221 <div onclick="toggleFooterLinks(this)" class="footer-column-header-container"> 7222 <h4 class="footer-column-header">@parentPageName</h4> 7223 <i class="fa fa-plus"></i> 7224 </div> 7225 7226 <div class="footer-column-links-container" style="display:none"> 7227 @foreach (var page in pages) 7228 { 7229 if (page.Active) 7230 { 7231 <a href="/Default.aspx?ID=@page.ID">@page.GetDisplayName()</a> 7232 } 7233 } 7234 </div> 7235 </div> 7236 } 7237 else 7238 { 7239 <div class="footer-column-links"> 7240 <h4 class="footer-column-header">@parentPageName</h4> 7241 <div class="footer-column-links-container"> 7242 @foreach (var page in pages) 7243 { 7244 if (page.Active) 7245 { 7246 <a href="/Default.aspx?ID=@page.ID">@page.GetDisplayName()</a> 7247 } 7248 } 7249 </div> 7250 </div> 7251 } 7252 } 7253 7254 7255 7256 <script> 7257 function toggleFooterLinks(elem) { 7258 var content = elem.nextElementSibling; 7259 if (content.style.display === "flex") { 7260 elem.lastChild.previousSibling.classList.remove("fa-minus"); 7261 elem.lastChild.previousSibling.classList.add("fa-plus"); 7262 content.style.display = "none"; 7263 } else { 7264 elem.lastChild.previousSibling.classList.remove("fa-plus"); 7265 elem.lastChild.previousSibling.classList.add("fa-minus"); 7266 content.style.display = "flex"; 7267 } 7268 } 7269 </script> 7270 } 7271 </text> 7272 } 7273 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7274 7275 @using System 7276 @using System.Web 7277 @using System.Collections.Generic 7278 @using Dynamicweb.Rapido.Blocks.Extensibility 7279 @using Dynamicweb.Rapido.Blocks 7280 @using Dynamicweb.Ecommerce.Common 7281 7282 @{ 7283 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 7284 7285 Block masterScriptReferences = new Block() 7286 { 7287 Id = "MasterScriptReferences", 7288 SortId = 1, 7289 Template = RenderMasterScriptReferences() 7290 }; 7291 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 7292 } 7293 7294 @helper RenderMasterScriptReferences() 7295 { 7296 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 7297 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 7298 7299 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 7300 { 7301 <script src="/Files/Templates/Designs/Rapido/js/Source/Custom.js"></script> 7302 PushPromise("/Files/Templates/Designs/Rapido/js/Source/Custom.js"); 7303 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 7304 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 7305 } 7306 7307 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 7308 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 7309 } 7310 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7311 7312 @using System 7313 @using System.Web 7314 @using System.Collections.Generic 7315 @using Dynamicweb.Rapido.Blocks.Extensibility 7316 @using Dynamicweb.Rapido.Blocks 7317 7318 @{ 7319 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 7320 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 7321 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 7322 7323 if (!navigationItemsHideSearch || isFavoriteList) 7324 { 7325 Block masterSearchScriptTemplates = new Block() 7326 { 7327 Id = "MasterSearchScriptTemplates", 7328 SortId = 1, 7329 Template = RenderSearchScriptTemplates() 7330 }; 7331 7332 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 7333 } 7334 } 7335 7336 @helper RenderSearchScriptTemplates() 7337 { 7338 int productsPageId = GetPageIdByNavigationTag("ProductsPageCategories"); 7339 //int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7340 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7341 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7342 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 7343 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7344 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7345 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7346 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7347 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7348 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7349 7350 <script id="SearchGroupsTemplate" type="text/x-template"> 7351 {{#.}} 7352 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7353 {{/.}} 7354 </script> 7355 7356 <script id="SearchProductsTemplate" type="text/x-template"> 7357 {{#each .}} 7358 {{#Product}} 7359 {{#ifCond template "!==" "SearchMore"}} 7360 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7361 @if (useFacebookPixel) 7362 { 7363 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7364 } 7365 @if (useGoogleTagManager) 7366 { 7367 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 7368 } 7369 <div class="search-item"> 7370 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 7371 <div class="u-margin-right u-pull--left {{noimage}} u-hidden-xs u-hidden-xxs"><img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?Format=webp&width=45&height=36&crop=5&FillCanvas=True&Compression=95&image={{image}}" alt="{{name}}"></div> 7372 <div class="u-pull--left"> 7373 <div class="u-bold u-max-w210px u-truncate-text js-typeahead-name">{{name}}</div> 7374 @if (showPrice && !onlyPreview) 7375 { 7376 if (pointShopOnly) 7377 { 7378 <text> 7379 {{#if havePointPrice}} 7380 <div> 7381 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7382 </div> 7383 {{else}} 7384 <small class="help-text u-no-margin">@Translate("Not available")</small> 7385 {{/if}} 7386 {{#unless canBePurchasedWithPoints}} 7387 {{#if havePointPrice}} 7388 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7389 {{/if}} 7390 {{/unless}} 7391 </text> 7392 } 7393 else 7394 { 7395 <text> 7396 {{#unless isSerpontun}} 7397 <div>{{price}}</div> 7398 {{/unless}} 7399 </text> 7400 } 7401 } 7402 </div> 7403 </a> 7404 <div class="u-margin-left u-pull--right"> 7405 @if (showAddToCartButton && !onlyPreview) { 7406 if (pointShopOnly) 7407 { 7408 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 7409 onclick="Cart.AddToCart(event, { 7410 id: '{{productId}}', 7411 quantity: 1, 7412 buyForPoints: true, 7413 productInfo: {{productInfo}} 7414 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 7415 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 7416 </button> 7417 } else { 7418 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 7419 onclick="Cart.AddToCart(event, { 7420 id: '{{productId}}', 7421 quantity: 1, 7422 productInfo: {{productInfo}} 7423 }); {{facebookPixelAction}}"> 7424 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 7425 </button> 7426 } 7427 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 7428 } 7429 else if (showViewButton) 7430 { 7431 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("Skoða")">@Translate("Skoða")</a> 7432 } 7433 @if (showAddToDownloadButton) 7434 { 7435 <button type="button" class="btn btn--primary u-no-margin btn--condensed dw-mod js-add-to-downloads" title="@Translate("Add")" data-product-id="{{productId}}"> 7436 <i class="fas fa-plus js-button-icon"></i> 7437 </button> 7438 } 7439 </div> 7440 </div> 7441 </li> 7442 {{/ifCond}} 7443 {{#ifCond template "===" "SearchMore"}} 7444 {{>SearchMoreProducts}} 7445 {{/ifCond}} 7446 {{/Product}} 7447 {{else}} 7448 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7449 @Translate("Your search gave 0 results") 7450 </li> 7451 {{/each}} 7452 </script> 7453 7454 <script id="SearchMoreProducts" type="text/x-template"> 7455 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7456 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7457 @Translate("View all") 7458 </a> 7459 </li> 7460 </script> 7461 7462 <script id="SearchMorePages" type="text/x-template"> 7463 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7464 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7465 @Translate("View all") 7466 </a> 7467 </li> 7468 </script> 7469 7470 <script id="SearchPagesTemplate" type="text/x-template"> 7471 {{#each .}} 7472 {{#ifCond template "!==" "SearchMore"}} 7473 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7474 <div> 7475 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 7476 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7477 <div class="u-pull--left"> 7478 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7479 </div> 7480 </a> 7481 </div> 7482 </li> 7483 {{/ifCond}} 7484 {{#ifCond template "===" "SearchMore"}} 7485 {{>SearchMorePages}} 7486 {{/ifCond}} 7487 {{else}} 7488 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 7489 @Translate("Your search gave 0 results") 7490 </li> 7491 {{/each}} 7492 </script> 7493 7494 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7495 <div class="dropdown__column-header">@Translate("Pages")</div> 7496 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 7497 {{>SearchPagesTemplate}} 7498 </ul> 7499 </script> 7500 7501 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7502 <div class="dropdown__column-header">@Translate("Products")</div> 7503 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 7504 {{>SearchProductsTemplate}} 7505 </ul> 7506 </script> 7507 } 7508 7509 7510 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7511 7512 @using System 7513 @using System.Web 7514 @using System.Collections.Generic 7515 @using Dynamicweb.Rapido.Blocks.Extensibility 7516 @using Dynamicweb.Rapido.Blocks 7517 7518 @{ 7519 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7520 7521 Block primaryBottomSnippets = new Block() 7522 { 7523 Id = "MasterJavascriptInitializers", 7524 SortId = 100, 7525 Template = RenderPrimaryBottomSnippets() 7526 }; 7527 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7528 } 7529 7530 @helper RenderPrimaryBottomSnippets() { 7531 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7532 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7533 7534 if (isWireframeMode) 7535 { 7536 <script> 7537 Wireframe.Init(true); 7538 </script> 7539 } 7540 7541 7542 if (useGoogleTagManager) 7543 { 7544 <script> 7545 document.addEventListener('addToCart', function(event) { 7546 var googleImpression = event.detail.productInfo.googleImpression; 7547 dataLayer.push({ 7548 'event': 'addToCart', 7549 'ecommerce': { 7550 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 7551 'add': { 7552 'products': [{ 7553 'name': googleImpression.name, 7554 'id': googleImpression.id, 7555 'price': googleImpression.price, 7556 'brand': googleImpression.brand, 7557 'category': googleImpression.category, 7558 'variant': googleImpression.variant, 7559 'quantity': event.detail.quantity 7560 }] 7561 } 7562 } 7563 }); 7564 }); 7565 </script> 7566 } 7567 7568 //if digitalwarehouse 7569 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7570 { 7571 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7572 7573 if (string.IsNullOrEmpty(cartContextId)) { 7574 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7575 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7576 cartContextId = cartSettings.OrderContextID; 7577 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7578 } 7579 7580 <script> 7581 let downloadCart = new DownloadCart({ 7582 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7583 contextId: "@cartContextId", 7584 addButtonText: "@Translate("Add")", 7585 removeButtonText: "@Translate("Remove")" 7586 }); 7587 </script> 7588 } 7589 7590 <!--@Javascripts--> 7591 } 7592 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml"))) 7593 { 7594 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7595 7596 @using System 7597 @using System.Web 7598 @using System.Collections.Generic 7599 @using Dynamicweb.Rapido.Blocks 7600 @using Dynamicweb.Rapido.Blocks.Extensibility 7601 7602 @functions { 7603 7604 } 7605 @{ 7606 } 7607 </text> 7608 } 7609 7610 7611 @functions { 7612 public class ManifestIcon 7613 { 7614 public string src { get; set; } 7615 public string type { get; set; } 7616 public string sizes { get; set; } 7617 } 7618 7619 public class Manifest 7620 { 7621 public string name { get; set; } 7622 public string short_name { get; set; } 7623 public string start_url { get; set; } 7624 public string display { get; set; } 7625 public string background_color { get; set; } 7626 public string theme_color { get; set; } 7627 public List<ManifestIcon> icons { get; set; } 7628 } 7629 } 7630 @{ 7631 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) 7632 { 7633 Manifest manifest = new Manifest 7634 { 7635 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7636 short_name = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppShortName")) ? Model.Area.Item.GetItem("Settings").GetString("AppShortName") : Model.Area.Item.GetItem("Settings").GetString("AppName"), 7637 start_url = "/", 7638 display = "standalone", 7639 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7640 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7641 }; 7642 7643 manifest.icons = new List<ManifestIcon> { 7644 new ManifestIcon { 7645 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7646 sizes = "192x192", 7647 type = "image/png" 7648 }, 7649 new ManifestIcon { 7650 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7651 sizes = "512x512", 7652 type = "image/png" 7653 }, 7654 new ManifestIcon { 7655 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7656 sizes = "1024x1024", 7657 type = "image/png" 7658 } 7659 }; 7660 7661 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7662 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7663 string currentManifest = File.ReadAllText(manifestFilePath); 7664 7665 if (manifestJSON != currentManifest) 7666 { 7667 File.WriteAllText(manifestFilePath, manifestJSON); 7668 } 7669 } 7670 } 7671 7672 @{ 7673 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7674 var brandColors = swatches.GetColorSwatch(1); 7675 string brandColorOne = brandColors.Palette["BrandColor1"]; 7676 } 7677 7678 <!DOCTYPE html> 7679 7680 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName" id="htmlTag"> 7681 <head> 7682 @if (areaName == "LEGO") 7683 { 7684 <!-- Global site tag (gtag.js) - Google Analytics --> 7685 <script async src="https://www.googletagmanager.com/gtag/js?id=UA-150208948-1"></script> 7686 <script> 7687 window.dataLayer = window.dataLayer || []; 7688 function gtag() { dataLayer.push(arguments); } 7689 gtag('js', new Date()); 7690 7691 gtag('config', 'UA-150208948-1'); 7692 </script> 7693 } 7694 @if (areaName == "A4") 7695 { 7696 <!-- Global site tag (gtag.js) - Google Analytics --> 7697 <script async src="https://www.googletagmanager.com/gtag/js?id=UA-37843413-1"></script> 7698 <script> 7699 window.dataLayer = window.dataLayer || []; 7700 function gtag() { dataLayer.push(arguments); } 7701 gtag('js', new Date()); 7702 7703 gtag('config', 'UA-37843413-1'); 7704 </script> 7705 } 7706 7707 <!-- Rapido version 3.1.1 --> 7708 <meta charset="utf-8" /> 7709 <title>@Model.Title</title> 7710 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7711 <meta name="robots" content="index, follow"> 7712 <meta name="theme-color" content="@brandColorOne" /> 7713 @Model.MetaTags 7714 7715 <!-- Favicon --> 7716 <link href="@favicon" rel="icon" type="image/png"> 7717 7718 <!-- Base (Default, wireframe) styles --> 7719 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css?v=2" type="text/css"> 7720 7721 <!-- Rapido Css from Website Settings --> 7722 <link rel="stylesheet" id="rapidoCss" href="@GetFileVersionEnding(autoCssLink)" type="text/css"> 7723 7724 <!--/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css--> 7725 <!-- Ignite Css (Custom site specific styles) --> 7726 <link rel="stylesheet" id="igniteCss" type="text/css" href="@GetFileVersionEnding(autoIgniteCssLink)"> 7727 7728 <!-- Font awesome --> 7729 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 7730 7731 <!-- Flag icon --> 7732 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 7733 7734 <!-- Google fonts --> 7735 @{ 7736 var family = string.Join("%7C", fonts.Where(x => !string.IsNullOrEmpty(x)).Distinct().Select(x => string.Format("{0}:100,200,300,400,500,600,700,800,900", x))); 7737 } 7738 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 7739 <link href="https://fonts.googleapis.com/css?family=Satisfy&display=swap" rel="stylesheet"> 7740 @{ 7741 PushPromise(favicon); 7742 PushPromise(fontAwesomeCssLink); 7743 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 7744 PushPromise(GetFileVersionEnding(autoCssLink)); 7745 PushPromise(GetFileVersionEnding("Files\\Templates\\Designs\\Rapido\\css\\ignite\\ignite.min.css")); 7746 PushPromise("/Files/Images/placeholder.gif"); 7747 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 7748 } 7749 7750 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 7751 { 7752 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 7753 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 7754 } 7755 </head> 7756 7757 <body> 7758 <!-- Load Facebook SDK for JavaScript --> 7759 <div id="fb-root"></div> 7760 <script> 7761 window.fbAsyncInit = function () { 7762 FB.init({ 7763 xfbml: true, 7764 version: 'v6.0' 7765 }); 7766 }; 7767 7768 (function (d, s, id) { 7769 var js, fjs = d.getElementsByTagName(s)[0]; 7770 if (d.getElementById(id)) return; 7771 js = d.createElement(s); js.id = id; 7772 js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js'; 7773 fjs.parentNode.insertBefore(js, fjs); 7774 }(document, 'script', 'facebook-jssdk'));</script> 7775 @{ 7776 string className = "fb-customerchat"; 7777 } 7778 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 7779 { 7780 className = "fb-customerchat mobile-tablet"; 7781 } 7782 7783 @if (areaName == "LEGO") 7784 { 7785 <!-- Legobudin - Your customer chat code --> 7786 <div class="@className" 7787 attribution=install_email 7788 page_id="1140476355964941" 7789 theme_color="#c20012" 7790 greeting_dialog_display="hide" 7791 logged_in_greeting="G&#xf3;&#xf0;an dag, hvernig getum vi&#xf0; a&#xf0;sto&#xf0;a&#xf0;?" 7792 logged_out_greeting="G&#xf3;&#xf0;an dag, hvernig getum vi&#xf0; a&#xf0;sto&#xf0;a&#xf0;?"> 7793 </div> 7794 } 7795 @if (areaName == "A4") 7796 { 7797 <!-- A4 - Your customer chat code --> 7798 <div class="@className" 7799 attribution=install_email 7800 page_id="167048019979316" 7801 theme_color="#ff3500" 7802 greeting_dialog_display="hide" 7803 logged_in_greeting="G&#xf3;&#xf0;an dag, hvernig getum vi&#xf0; a&#xf0;sto&#xf0;a&#xf0;?" 7804 logged_out_greeting="G&#xf3;&#xf0;an dag, hvernig getum vi&#xf0; a&#xf0;sto&#xf0;a&#xf0;?"> 7805 </div> 7806 } 7807 7808 7809 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7810 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7811 7812 7813 @helper RenderMasterHeader() 7814 { 7815 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 7816 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 7817 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 7818 string CartId = GetPageIdByNavigationTag("CartPage").ToString(); 7819 bool hasCartID = Dynamicweb.Context.Current.Request.RawUrl.Contains(CartId); 7820 if (!(isCart || hasCartID)) 7821 { 7822 <header class="top-container @PageView.Current().Page.NavigationTag @stickyTop dw-mod" id="Top"> 7823 @RenderBlockList(subBlocks) 7824 </header> 7825 } 7826 } 7827 7828 @helper RenderMain() 7829 { 7830 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 7831 int frontPageId = Model.Area.FirstPage.ID; 7832 int currentPageId = Model.TopPage.ID; 7833 7834 string backgroundImg = Model.Area.Item.GetItem("Layout").GetFile("PageBackgroundImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("PageBackgroundImage").Path : ""; 7835 7836 string showBackgroundImg = !string.IsNullOrWhiteSpace(backgroundImg) && frontPageId == currentPageId ? "background-image:url(/Admin/Public/GetImage.ashx?Format=webp&Width=1920&Crop=5&image=" + backgroundImg + ")" : "background-image:none"; 7837 7838 <main class="site dw-mod" style="@showBackgroundImg"> 7839 @RenderBlockList(subBlocks) 7840 </main> 7841 } 7842 7843 @helper RenderPageContent() 7844 { 7845 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 7846 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 7847 string CartId = GetPageIdByNavigationTag("CartPage").ToString(); 7848 bool hasCartID = Dynamicweb.Context.Current.Request.RawUrl.Contains(CartId); 7849 string cartStyle = ""; 7850 if ((isCart || hasCartID)) 7851 { 7852 cartStyle = "margin-top: 0;"; 7853 } 7854 <div id="Page" class="page @pagePos" style="@cartStyle"> 7855 <section class="center-container content-container dw-mod" id="content" style="@cartStyle"> 7856 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7857 7858 7859 @{ 7860 string columnClass = "12"; 7861 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null; 7862 string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 7863 } 7864 7865 @if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 7866 { 7867 <div class="grid__col-12 grid__col--bleed-y"> 7868 @RenderNavigation(new 7869 { 7870 id = "breadcrumb", 7871 template = "Breadcrumb.xslt" 7872 }) 7873 </div> 7874 } 7875 7876 <div class="grid"> 7877 @if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 7878 { 7879 var navigationMarkup = RenderNavigation(new 7880 { 7881 id = "leftnav", 7882 cssclass = "dwnavigation", 7883 startLevel = 2, 7884 expandmode = "all", 7885 endlevel = 5, 7886 template = "LeftNavigation.xslt" 7887 }); 7888 7889 if (!string.IsNullOrEmpty(navigationMarkup)) 7890 { 7891 <nav class="grid__col-md-3"> 7892 <div class="grid__cell"> 7893 @navigationMarkup 7894 </div> 7895 </nav> 7896 columnClass = "9"; 7897 } 7898 } 7899 <div class="grid__col-md-@columnClass grid__col--bleed"> 7900 <div class="grid"> 7901 @Model.Placeholder("dwcontent", "content", "default:true;sort:1") 7902 </div> 7903 </div> 7904 </div> 7905 7906 7907 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 7908 @if (backgroundColorClass != "") 7909 { 7910 <script> 7911 document.getElementById("Page").classList.add("@backgroundColorClass"); 7912 </script> 7913 } 7914 </section> 7915 </div> 7916 } 7917 </body> 7918 </html> 7919 7920