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