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