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