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

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