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

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