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_f0850159d16d4550a768f0e55af6a2ca.b__192_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7766
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.b__191_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7743
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 245
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass6_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 267
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.<>c__DisplayClass5_0.b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 159
   at CompiledRazorTemplates.Dynamic.RazorEngine_f0850159d16d4550a768f0e55af6a2ca.Execute() in C:\inetpub\wwwroot\a4.is\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7714
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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