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