Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.<RenderMasterBody>b__206_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8398
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 293
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_1bb674ba035d4baf9ba545d75951ba55.Execute() in D:\dynamicweb.net\Solutions\Korsholm_live2024\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8172
   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.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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