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