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_db655b1e61b04fdda7473ca59e5d9022.<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 8162
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_db655b1e61b04fdda7473ca59e5d9022.<>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_db655b1e61b04fdda7473ca59e5d9022.<>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_db655b1e61b04fdda7473ca59e5d9022.<>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_db655b1e61b04fdda7473ca59e5d9022.<>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_db655b1e61b04fdda7473ca59e5d9022.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\weh.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8009
   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 string widthClass = "menu__item--fixed-width"; 4829 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 4830 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 4831 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 4832 4833 if (languageViewType == "flag-culture") 4834 { 4835 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 4836 } 4837 4838 if (languageViewType == "flag") 4839 { 4840 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 4841 widthClass = ""; 4842 } 4843 4844 if (languageViewType == "name") 4845 { 4846 langInfo = lang.Name; 4847 } 4848 4849 if (languageViewType == "culture") 4850 { 4851 langInfo = cultureName; 4852 widthClass = ""; 4853 } 4854 4855 <div class="menu__item dw-mod @widthClass"> 4856 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__link dw-mod">@langInfo</a> 4857 </div> 4858 } 4859 </div> 4860 </li> 4861 } 4862 } 4863 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4864 4865 @using System 4866 @using System.Web 4867 @using Dynamicweb.Rapido.Blocks.Extensibility 4868 @using Dynamicweb.Rapido.Blocks 4869 4870 @{ 4871 Block masterDesktopActionsMenuSignIn = new Block 4872 { 4873 Id = "MasterDesktopActionsMenuSignIn", 4874 SortId = 20, 4875 Template = RenderSignIn() 4876 }; 4877 4878 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4879 } 4880 4881 @helper RenderSignIn() 4882 { 4883 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4884 string userInitials = ""; 4885 int pageId = Model.TopPage.ID; 4886 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4887 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4888 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4889 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4890 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4891 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4892 int myOrderDraftsPageId = GetPageIdByNavigationTag("OrderDraft"); 4893 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4894 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4895 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4896 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4897 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4898 bool hideMyOrderDraftsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrderDrafts"); 4899 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4900 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4901 4902 string linkStart = "/Default.aspx?ID="; 4903 if (Model.CurrentUser.ID <= 0) 4904 { 4905 linkStart += signInProfilePageId + "&RedirectPageId="; 4906 } 4907 4908 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4909 string myProfilePageLink = linkStart + myProfilePageId; 4910 string myOrdersPageLink = linkStart + myOrdersPageId; 4911 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4912 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4913 string myOrderDraftsLink = linkStart + myOrderDraftsPageId; 4914 4915 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4916 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"; 4917 string orderDraftsIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 4918 4919 if (Model.CurrentUser.ID != 0) 4920 { 4921 userInitials = Dynamicweb.Rapido.Services.User.GetInitials(Model.CurrentUser.Name, Model.CurrentUser.FirstName, Model.CurrentUser.LastName, Model.CurrentUser.Email, Model.CurrentUser.UserName); 4922 } 4923 4924 if (!navigationItemsHideSignIn) 4925 { 4926 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4927 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4928 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4929 4930 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4931 <div class="@menuLinkClass dw-mod"> 4932 @if (Model.CurrentUser.ID <= 0) 4933 { 4934 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x" title="@Translate("Sign in")"></i> 4935 } 4936 else 4937 { 4938 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit" title="@Translate("Customer center")"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4939 } 4940 </div> 4941 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4942 <ul class="list list--clean dw-mod"> 4943 @if (Model.CurrentUser.ID <= 0) 4944 { 4945 <li> 4946 <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> 4947 </li> 4948 4949 if (!hideCreateAccountLink) 4950 { 4951 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4952 } 4953 if (!hideForgotPasswordLink) 4954 { 4955 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4956 } 4957 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4958 { 4959 @RenderSeparator() 4960 } 4961 } 4962 @if (!hideMyProfileLink) 4963 { 4964 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4965 } 4966 @if (!hideMyOrdersLink) 4967 { 4968 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4969 } 4970 @if (!hideMyFavoritesLink) 4971 { 4972 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4973 } 4974 @if (!hideMySavedCardsLink) 4975 { 4976 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4977 } 4978 @if (!hideMyOrderDraftsLink) 4979 { 4980 @RenderListItem(myOrderDraftsLink, Translate("My Order drafts"), orderDraftsIcon) 4981 } 4982 @if (Model.CurrentUser.ID > 0) 4983 { 4984 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4985 { 4986 @RenderSeparator() 4987 } 4988 4989 //Check if impersonation is on 4990 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4991 { 4992 <li> 4993 <div class="list__link dw-mod" onclick="document.getElementById('StopImpersonationModalTrigger').checked = true;"> 4994 @Translate("Sign out") 4995 </div> 4996 </li> 4997 } else { 4998 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4999 } 5000 } 5001 </ul> 5002 </div> 5003 </li> 5004 } 5005 } 5006 5007 @helper RenderListItem(string link, string text, string icon = null) { 5008 <li> 5009 <a href="@link" class="list__link dw-mod" onclick="RememberState.SetCookie('useAnotherAddress', false)"> 5010 @if (!string.IsNullOrEmpty(icon)){<i class="@icon u-margin-right"></i>}@text 5011 </a> 5012 </li> 5013 } 5014 5015 @helper RenderSeparator() 5016 { 5017 <li class="list__seperator dw-mod"></li> 5018 } 5019 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5020 5021 @using System 5022 @using System.Web 5023 @using Dynamicweb.Rapido.Blocks.Extensibility 5024 @using Dynamicweb.Rapido.Blocks 5025 5026 @{ 5027 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 5028 5029 Block masterDesktopActionsMenuFavorites = new Block 5030 { 5031 Id = "MasterDesktopActionsMenuFavorites", 5032 SortId = 30, 5033 Template = RenderFavorites() 5034 }; 5035 5036 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 5037 { 5038 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 5039 } 5040 } 5041 5042 @helper RenderFavorites() 5043 { 5044 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 5045 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 5046 5047 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5048 string liClasses = topLayout != "normal" && topLayout != "splitted-center" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5049 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5050 5051 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5052 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod" title="@Translate("Favorites")"> 5053 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 5054 </a> 5055 </li> 5056 } 5057 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5058 5059 @using System 5060 @using System.Web 5061 @using Dynamicweb.Rapido.Blocks.Extensibility 5062 @using Dynamicweb.Rapido.Blocks 5063 @using Dynamicweb.Rapido.Services 5064 5065 @{ 5066 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 5067 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 5068 5069 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !hideCart) 5070 { 5071 Block masterDesktopActionsMenuMiniCart = new Block 5072 { 5073 Id = "MasterDesktopActionsMenuMiniCart", 5074 SortId = 60, 5075 Template = RenderMiniCart(miniCartLayout == "dropdown"), 5076 SkipRenderBlocksList = true, 5077 BlocksList = new List<Block>() 5078 }; 5079 5080 Block miniCartCounterScriptTemplate = new Block 5081 { 5082 Id = "MiniCartCounterScriptTemplate", 5083 Template = RenderMiniCartCounterContent() 5084 }; 5085 5086 //dropdown layout is default 5087 RazorEngine.Templating.TemplateWriter layoutTemplate; 5088 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate; 5089 5090 switch (miniCartLayout) 5091 { 5092 case "dropdown": 5093 layoutTemplate = RenderMiniCartDropdownLayout(); 5094 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5095 break; 5096 case "panel": 5097 layoutTemplate = RenderMiniCartPanelLayout(); 5098 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5099 break; 5100 case "modal": 5101 layoutTemplate = RenderMiniCartModalLayout(); 5102 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 5103 break; 5104 case "none": 5105 default: 5106 layoutTemplate = RenderMiniCartDropdownLayout(); 5107 miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 5108 break; 5109 } 5110 5111 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5112 { 5113 Id = "MiniCartTrigger", 5114 Template = miniCartTriggerTemplate 5115 }); 5116 5117 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 5118 { 5119 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 5120 { 5121 Id = "MiniCartLayout", 5122 Template = layoutTemplate 5123 }); 5124 } 5125 5126 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 5127 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 5128 } 5129 5130 if (hideCart && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 5131 { 5132 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", new Block { 5133 Id = "CartInitialization" 5134 }); 5135 } 5136 } 5137 5138 @helper RenderMiniCart(bool hasMouseEnterEvent) 5139 { 5140 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 5141 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5142 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 5143 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5144 string mouseEvent = ""; 5145 string id = "MiniCart"; 5146 if (hasMouseEnterEvent) 5147 { 5148 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 5149 id = "miniCartTrigger"; 5150 } 5151 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 5152 @RenderBlockList(subBlocks) 5153 </li> 5154 } 5155 5156 @helper RenderMiniCartTriggerLabel() 5157 { 5158 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5159 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5160 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5161 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5162 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5163 5164 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')" title="@Translate("Cart")"> 5165 <div class="u-inline u-position-relative"> 5166 <i class="@cartIcon fa-1_5x"></i> 5167 @RenderMiniCartCounter() 5168 </div> 5169 </div> 5170 } 5171 5172 @helper RenderMiniCartTriggerLink() 5173 { 5174 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5175 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 5176 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5177 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5178 5179 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button" title="@Translate("Cart")"> 5180 <span class="u-inline u-position-relative"> 5181 <i class="@cartIcon fa-1_5x"></i> 5182 @RenderMiniCartCounter() 5183 </span> 5184 </a> 5185 } 5186 5187 @helper RenderMiniCartCounter() 5188 { 5189 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5190 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 5191 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5192 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5193 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 5194 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 5195 5196 if (showPrice && counterPosition == "right") 5197 { 5198 cartProductsCount = Translate("Cart") + " (" + cartProductsCount + ")"; 5199 } 5200 5201 <span class="mini-cart__counter @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod"> 5202 <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"> 5203 <span class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 5204 @cartProductsCount @cartProductsTotalPrice 5205 </span> 5206 </span> 5207 </span> 5208 } 5209 5210 @helper RenderMiniCartCounterContent() 5211 { 5212 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 5213 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5214 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 5215 5216 <script id="MiniCartCounterContent" type="text/x-template"> 5217 {{#.}} 5218 <span class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 5219 @if (showPriceInMiniCartCounter) 5220 { 5221 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 5222 } 5223 else 5224 { 5225 <text>{{numberofproducts}}</text> 5226 } 5227 </span> 5228 {{/.}} 5229 </script> 5230 } 5231 5232 @helper RenderMiniCartDropdownLayout() 5233 { 5234 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5235 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5236 5237 <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"> 5238 <div class="mini-cart-dropdown__inner dw-mod"> 5239 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 5240 <div class="mini-cart-dropdown__body u-flex dw-mod"> 5241 <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> 5242 </div> 5243 </div> 5244 </div> 5245 } 5246 5247 @helper RenderMiniCartPanelLayout() 5248 { 5249 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5250 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5251 5252 <div class="mini-cart grid__cell dw-mod"> 5253 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 5254 <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"> 5255 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 5256 <div class="panel__content u-full-width dw-mod"> 5257 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 5258 <div class="panel__content-body panel__content-body--cart dw-mod"> 5259 <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> 5260 </div> 5261 </div> 5262 </div> 5263 </div> 5264 } 5265 5266 @helper RenderMiniCartModalLayout() 5267 { 5268 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5269 string cartPageLink = "Default.aspx?ID=" + GetPageIdByNavigationTag("CartPage"); 5270 5271 <div class="mini-cart grid__cell dw-mod"> 5272 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 5273 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block" data-cart-page-link="@cartPageLink"> 5274 <label for="miniCartTrigger" class="modal-overlay"></label> 5275 <div class="modal modal--md modal--top-right dw-mod"> 5276 <div class="modal__body u-flex grid--direction-column dw-mod"> 5277 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 5278 <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> 5279 </div> 5280 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 5281 </div> 5282 </div> 5283 </div> 5284 } 5285 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5286 5287 @using System 5288 @using System.Web 5289 @using Dynamicweb.Rapido.Blocks.Extensibility 5290 @using Dynamicweb.Rapido.Blocks 5291 5292 @{ 5293 bool showOrderDraftLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOrderDraftIcon"); 5294 5295 Block masterDesktopActionsMenuOrderDraft = new Block 5296 { 5297 Id = "MasterDesktopActionsMenuOrderDraft", 5298 SortId = 40, 5299 Template = RenderOrderDraft() 5300 }; 5301 5302 if (showOrderDraftLink && Model.CurrentUser.ID > 0) 5303 { 5304 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuOrderDraft); 5305 } 5306 } 5307 5308 @helper RenderOrderDraft() 5309 { 5310 int OrderDraftPageId = GetPageIdByNavigationTag("OrderDraft"); 5311 string OrderDraftPageLink = "/Default.aspx?ID=" + OrderDraftPageId; 5312 string draftIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("DraftIcon").SelectedValue : "fa fa-clipboard"; 5313 5314 5315 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5316 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5317 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5318 5319 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5320 <a href="@OrderDraftPageLink" class="@menuLinkClass dw-mod" title="@Translate("My order drafts")"> 5321 <span class="u-inline u-position-relative"> 5322 <i class="@draftIcon fa-1_5x"></i> 5323 </span> 5324 </a> 5325 </li> 5326 } 5327 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5328 5329 @using System 5330 @using System.Web 5331 @using Dynamicweb.Rapido.Blocks.Extensibility 5332 @using Dynamicweb.Rapido.Blocks 5333 5334 @{ 5335 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 5336 5337 Block masterDesktopActionsMenuDownloadCart = new Block 5338 { 5339 Id = "MasterDesktopActionsMenuDownloadCart", 5340 SortId = 50, 5341 Template = RenderDownloadCart() 5342 }; 5343 5344 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 5345 { 5346 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 5347 } 5348 } 5349 5350 @helper RenderDownloadCart() 5351 { 5352 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 5353 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 5354 5355 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5356 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 5357 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5358 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 5359 5360 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 5361 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod" title="@Translate("Download cart")"> 5362 <span class="u-inline u-position-relative"> 5363 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 5364 <span class="mini-cart__counter u-hidden @(counterPosition == "right" ? "mini-cart__counter--inline" : "") dw-mod js-download-cart-counter"></span> 5365 </span> 5366 </a> 5367 </li> 5368 } 5369 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5370 5371 @using System 5372 @using System.Web 5373 @using Dynamicweb.Rapido.Blocks.Extensibility 5374 @using Dynamicweb.Rapido.Blocks 5375 5376 @functions { 5377 public class SearchConfiguration 5378 { 5379 public string searchFeedId { get; set; } 5380 public string searchSecondFeedId { get; set; } 5381 public int groupsFeedId { get; set; } 5382 public string resultPageLink { get; set; } 5383 public string searchPlaceholder { get; set; } 5384 public string searchType { get; set; } 5385 public string searchTemplate { get; set; } 5386 public string searchContentTemplate { get; set; } 5387 public string searchValue { get; set; } 5388 public bool showGroups { get; set; } 5389 5390 public SearchConfiguration() 5391 { 5392 searchFeedId = ""; 5393 searchSecondFeedId = ""; 5394 searchType = "product-search"; 5395 searchContentTemplate = ""; 5396 showGroups = true; 5397 } 5398 } 5399 } 5400 @{ 5401 Block masterSearchBar = new Block 5402 { 5403 Id = "MasterSearchBar", 5404 SortId = 40, 5405 Template = RenderSearch("bar"), 5406 Design = new Design 5407 { 5408 Size = "auto", 5409 HidePadding = true, 5410 RenderType = RenderType.Column 5411 } 5412 }; 5413 5414 Block masterSearchAction = new Block 5415 { 5416 Id = "MasterDesktopActionsMenuSearch", 5417 SortId = 10, 5418 Template = RenderSearch() 5419 }; 5420 5421 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 5422 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 5423 } 5424 5425 @helper RenderSearch(string type = "mini-search") 5426 { 5427 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 5428 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5429 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 5430 5431 SearchConfiguration searchConfiguration = null; 5432 5433 switch (searchType) { 5434 case "contentSearch": 5435 searchConfiguration = new SearchConfiguration() { 5436 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5437 resultPageLink = contentSearchPageLink, 5438 searchPlaceholder = Translate("Search page"), 5439 groupsFeedId = 0, 5440 searchType = "content-search", 5441 searchTemplate = "SearchPagesTemplate", 5442 showGroups = false 5443 }; 5444 break; 5445 case "combinedSearch": 5446 searchConfiguration = new SearchConfiguration() { 5447 searchFeedId = productsPageId + "&feed=true", 5448 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 5449 resultPageLink = Converter.ToString(productsPageId), 5450 searchPlaceholder = Translate("Search products or pages"), 5451 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5452 searchType = "combined-search", 5453 searchTemplate = "SearchProductsTemplateWrap", 5454 searchContentTemplate = "SearchPagesTemplateWrap", 5455 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5456 }; 5457 break; 5458 default: //productSearch 5459 searchConfiguration = new SearchConfiguration() { 5460 resultPageLink = Converter.ToString(productsPageId), 5461 searchFeedId = productsPageId + "&feed=true", 5462 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 5463 searchPlaceholder = Translate("Search products"), 5464 searchTemplate = "SearchProductsTemplate", 5465 searchType = "product-search", 5466 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 5467 }; 5468 break; 5469 } 5470 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 5471 5472 if (type == "mini-search") { 5473 @RenderMiniSearch(searchConfiguration) 5474 } else { 5475 @RenderSearchBar(searchConfiguration) 5476 } 5477 } 5478 5479 @helper RenderSearchBar(SearchConfiguration options) 5480 { 5481 <div class="typeahead typeahead--centered u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 5482 data-page-size="7" 5483 data-search-feed-id="@options.searchFeedId" 5484 data-search-second-feed-id="@options.searchSecondFeedId" 5485 data-result-page-id="@options.resultPageLink" 5486 data-groups-page-id="@options.groupsFeedId" 5487 data-search-type="@options.searchType"> 5488 @if (options.showGroups) 5489 { 5490 <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> 5491 <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> 5492 } 5493 <div class="typeahead-search-field"> 5494 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5495 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5496 { 5497 <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> 5498 } 5499 else 5500 { 5501 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 5502 <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> 5503 <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> 5504 </div> 5505 } 5506 </div> 5507 <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> 5508 </div> 5509 } 5510 5511 @helper RenderMiniSearch(SearchConfiguration options) 5512 { 5513 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5514 string menuLinkClass = topLayout != "normal" && topLayout != "splitted-center" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 5515 5516 <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"> 5517 <div class="@menuLinkClass dw-mod" title="@Translate("Search")"> 5518 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 5519 </div> 5520 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 5521 <div class="typeahead js-typeahead" id="ProductSearchBar" 5522 data-page-size="7" 5523 data-search-feed-id="@options.searchFeedId" 5524 data-search-second-feed-id="@options.searchSecondFeedId" 5525 data-result-page-id="@options.resultPageLink" 5526 data-search-type="@options.searchType"> 5527 <div class="typeahead-search-field"> 5528 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 5529 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 5530 { 5531 <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> 5532 } 5533 else 5534 { 5535 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 5536 <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> 5537 <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> 5538 </div> 5539 } 5540 </div> 5541 </div> 5542 </div> 5543 </li> 5544 } 5545 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5546 5547 @using System 5548 @using System.Web 5549 @using Dynamicweb.Rapido.Blocks.Extensibility 5550 @using Dynamicweb.Rapido.Blocks 5551 5552 @{ 5553 string headerConfigurationTopLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5554 bool headerConfigurationHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5555 5556 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 5557 5558 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 5559 headerConfigurationPage.RemoveBlock(configDesktopLogo); 5560 5561 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 5562 headerConfigurationPage.RemoveBlock(configDesktopMenu); 5563 5564 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 5565 headerConfigurationPage.RemoveBlock(configSearchBar); 5566 5567 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 5568 headerConfigurationPage.RemoveBlock(configSearchAction); 5569 5570 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 5571 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 5572 5573 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 5574 5575 switch (headerConfigurationTopLayout) 5576 { 5577 case "condensed": //2 5578 configDesktopLogo.Design.Size = "auto-width"; 5579 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5580 5581 configDesktopMenu.SortId = 20; 5582 configDesktopMenu.Design.Size = "auto"; 5583 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5584 5585 configDesktopActionsMenu.SortId = 30; 5586 configDesktopActionsMenu.Design.Size = "auto-width"; 5587 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5588 5589 if (!headerConfigurationHideSearch) 5590 { 5591 configSearchBar.SortId = 40; 5592 configSearchBar.Design.Size = "12"; 5593 configDesktopExtra.SortId = 50; 5594 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5595 } 5596 break; 5597 case "splitted": //3 5598 configDesktopLogo.Design.Size = "auto"; 5599 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5600 5601 if (!headerConfigurationHideSearch) 5602 { 5603 configSearchBar.SortId = 20; 5604 configSearchBar.Design.Size = "auto"; 5605 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5606 } 5607 5608 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5609 5610 configDesktopActionsMenu.SortId = 20; 5611 configDesktopActionsMenu.Design.Size = "auto-width"; 5612 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5613 break; 5614 case "splitted-center": //4 5615 configDesktopLogo.Design.Size = "auto"; 5616 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5617 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5618 5619 configDesktopActionsMenu.SortId = 30; 5620 configDesktopActionsMenu.Design.Size = "auto-width"; 5621 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5622 5623 if (!headerConfigurationHideSearch) 5624 { 5625 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5626 } 5627 break; 5628 case "minimal": //5 5629 configDesktopLogo.Design.Size = "auto-width"; 5630 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5631 5632 configDesktopMenu.Design.Size = "auto"; 5633 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5634 5635 configDesktopActionsMenu.SortId = 20; 5636 configDesktopActionsMenu.Design.Size = "auto-width"; 5637 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5638 5639 if (!headerConfigurationHideSearch) 5640 { 5641 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5642 } 5643 break; 5644 case "minimal-center": //6 5645 configDesktopLogo.Design.Size = "auto-width"; 5646 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5647 5648 configDesktopMenu.Design.Size = "auto"; 5649 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5650 5651 configDesktopActionsMenu.SortId = 20; 5652 configDesktopActionsMenu.Design.Size = "auto-width"; 5653 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5654 5655 if (!headerConfigurationHideSearch) 5656 { 5657 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5658 } 5659 break; 5660 case "minimal-right": //7 5661 configDesktopLogo.Design.Size = "auto-width"; 5662 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 5663 5664 configDesktopMenu.Design.Size = "auto"; 5665 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5666 5667 configDesktopActionsMenu.SortId = 20; 5668 configDesktopActionsMenu.Design.Size = "auto-width"; 5669 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5670 5671 if (!headerConfigurationHideSearch) 5672 { 5673 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5674 } 5675 break; 5676 case "two-lines": //8 5677 configDesktopLogo.Design.Size = "auto"; 5678 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5679 5680 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5681 5682 configDesktopActionsMenu.SortId = 20; 5683 configDesktopActionsMenu.Design.Size = "auto-width"; 5684 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5685 5686 if (!headerConfigurationHideSearch) 5687 { 5688 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5689 } 5690 break; 5691 case "two-lines-centered": //9 5692 configDesktopLogo.Design.Size = "auto"; 5693 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5694 5695 configDesktopMenu.Design.Size = "auto-width"; 5696 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5697 5698 configDesktopActionsMenu.SortId = 20; 5699 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 5700 5701 if (!headerConfigurationHideSearch) 5702 { 5703 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 5704 } 5705 break; 5706 case "normal": //1 5707 default: 5708 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 5709 5710 if (!headerConfigurationHideSearch) 5711 { 5712 configSearchBar.SortId = 20; 5713 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 5714 } 5715 5716 configDesktopActionsMenu.SortId = 30; 5717 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 5718 5719 configDesktopActionsMenu.Design.Size = "auto-width"; 5720 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 5721 break; 5722 } 5723 } 5724 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5725 5726 @using System 5727 @using System.Web 5728 @using Dynamicweb.Rapido.Blocks.Extensibility 5729 @using Dynamicweb.Rapido.Blocks 5730 5731 @{ 5732 5733 } 5734 5735 5736 @helper RenderDesktopTools() 5737 { 5738 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 5739 5740 <div class="tools-navigation dw-mod"> 5741 <div class="center-container grid top-container__center-container dw-mod"> 5742 @RenderBlockList(subBlocks) 5743 </div> 5744 </div> 5745 } 5746 5747 @helper RenderDesktopToolsText() 5748 { 5749 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 5750 if (!string.IsNullOrEmpty(toolsText)) 5751 { 5752 <div class="u-margin-top u-margin-bottom">@toolsText</div> 5753 } 5754 } 5755 5756 @helper RenderDesktopToolsNavigation() 5757 { 5758 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 5759 5760 if (renderPagesInToolBar) 5761 { 5762 @RenderNavigation(new 5763 { 5764 id = "topToolsNavigation", 5765 cssclass = "menu menu-tools dw-mod dwnavigation", 5766 template = "TopMenu.xslt" 5767 }) 5768 } 5769 } 5770 5771 @helper RenderDesktopNavigation() 5772 { 5773 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 5774 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 5775 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 5776 <nav class="main-navigation dw-mod"> 5777 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 5778 @RenderBlockList(subBlocks) 5779 </div> 5780 </nav> 5781 } 5782 5783 @helper RenderDesktopExtra() 5784 { 5785 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 5786 5787 if (subBlocks.Count > 0) 5788 { 5789 <div class="header header-top dw-mod"> 5790 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 5791 @RenderBlockList(subBlocks) 5792 </div> 5793 </div> 5794 } 5795 }</text> 5796 } 5797 5798 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5799 5800 @using System 5801 @using System.Web 5802 @using Dynamicweb.Rapido.Blocks.Extensibility 5803 @using Dynamicweb.Rapido.Blocks 5804 @using Dynamicweb.Rapido.Blocks.Components.General 5805 @using Dynamicweb.Frontend 5806 5807 @functions { 5808 int impersonationPageId; 5809 string impersonationLayout; 5810 int impersonationFeed; 5811 Block impersonationBar; 5812 5813 string getUserNameFromParams(string firstName, string middleName, string lastName, string name, string email, string userName) 5814 { 5815 string username = ""; 5816 5817 if (!string.IsNullOrEmpty(firstName) && !string.IsNullOrEmpty(lastName)) 5818 { 5819 username = firstName + " " + (!string.IsNullOrEmpty(middleName) ? middleName + " " : "") + lastName; 5820 } 5821 else if (!string.IsNullOrEmpty(name)) 5822 { 5823 username = name; 5824 } 5825 else if (!string.IsNullOrEmpty(email)) 5826 { 5827 username = email; 5828 } 5829 else 5830 { 5831 username = userName; 5832 } 5833 return username; 5834 } 5835 5836 string getUserName(UserViewModel user) 5837 { 5838 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5839 } 5840 5841 string getUserName(Dynamicweb.Security.UserManagement.User user) 5842 { 5843 return getUserNameFromParams(user.FirstName, user.MiddleName, user.LastName, user.Name, user.Email, user.UserName); 5844 } 5845 } 5846 5847 @{ 5848 impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 5849 impersonationLayout = Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout") != null ? Model.Area.Item.GetItem("Ecommerce").GetList("ImpersonationLayout").SelectedValue : "bar"; 5850 impersonationFeed = GetPageIdByNavigationTag("UsersFeed"); 5851 5852 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 5853 { 5854 impersonationBar = new Block 5855 { 5856 Id = "ImpersonationBar", 5857 SortId = 50, 5858 Template = RenderImpersonation(), 5859 SkipRenderBlocksList = true, 5860 Design = new Design 5861 { 5862 Size = "auto-width", 5863 HidePadding = true, 5864 RenderType = RenderType.Column 5865 } 5866 }; 5867 5868 if (impersonationLayout == "top-bar") { 5869 impersonationBar.SortId = 9; 5870 } 5871 5872 Block impersonationContent = new Block 5873 { 5874 Id = "ImpersonationContent", 5875 SortId = 20 5876 }; 5877 5878 if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 5879 { 5880 //Render stop impersonation view 5881 impersonationContent.Template = RenderStopImpersonationView(); 5882 5883 5884 Modal stopImpersonation = new Modal 5885 { 5886 Id = "StopImpersonation", 5887 Heading = new Heading { 5888 Level = 2, 5889 Title = Translate("Sign out"), 5890 Icon = new Icon { 5891 Name = "fa-sign-out", 5892 Prefix = "fas", 5893 LabelPosition = IconLabelPosition.After 5894 } 5895 }, 5896 Width = ModalWidth.Sm, 5897 BodyTemplate = RenderStopImpersonationForm() 5898 }; 5899 5900 Block stopImpersonationBlock = new Block 5901 { 5902 Id = "StopImpersonationBlock", 5903 SortId = 10, 5904 Component = stopImpersonation 5905 }; 5906 impersonationBar.BlocksList.Add(stopImpersonationBlock); 5907 } 5908 else 5909 { 5910 //Render main view 5911 switch (impersonationLayout) 5912 { 5913 case "right-lower-box": 5914 impersonationContent.BlocksList.Add( 5915 new Block { 5916 Id = "RightLowerBoxHeader", 5917 SortId = 10, 5918 Component = new Heading { 5919 Level = 5, 5920 Title = Translate("View the list of users you can sign in as"), 5921 CssClass = "impersonation-text" 5922 } 5923 } 5924 ); 5925 impersonationContent.BlocksList.Add( 5926 new Block { 5927 Id = "RightLowerBoxContent", 5928 SortId = 20, 5929 Template = RenderImpersonationControls() 5930 } 5931 ); 5932 break; 5933 case "right-lower-bar": 5934 impersonationContent.BlocksList.Add( 5935 new Block { 5936 Id = "RightLowerBarContent", 5937 SortId = 10, 5938 Template = RenderImpersonationControls() 5939 } 5940 ); 5941 break; 5942 case "bar": 5943 default: 5944 impersonationContent.BlocksList.Add( 5945 new Block { 5946 Id = "ViewListLink", 5947 SortId = 20, 5948 Template = RenderViewListLink() 5949 } 5950 ); 5951 impersonationContent.BlocksList.Add( 5952 new Block { 5953 Id = "BarTypeaheadSearch", 5954 SortId = 30, 5955 Template = RenderTypeaheadSearch() 5956 } 5957 ); 5958 break; 5959 } 5960 } 5961 impersonationBar.BlocksList.Add(impersonationContent); 5962 5963 impersonationBar.BlocksList.Add( 5964 new Block 5965 { 5966 Id = "ImpersonationSearchTemplates", 5967 SortId = 30, 5968 Template = RenderSearchResultTemplate() 5969 } 5970 ); 5971 if (impersonationLayout != "bar" && impersonationLayout != "top-bar") 5972 { 5973 impersonationBar.BlocksList.Add( 5974 new Block 5975 { 5976 Id = "ImpersonationSearchScripts", 5977 SortId = 40, 5978 Template = RenderSearchScripts() 5979 } 5980 ); 5981 } 5982 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 5983 } 5984 } 5985 5986 @helper RenderImpersonation() 5987 { 5988 List<Block> subBlocks = impersonationBar.BlocksList.OrderBy(item => item.SortId).ToList(); 5989 <input type="checkbox" class="impersonation-trigger js-remember-state" id="ImpersonationMinimizeTrigger" /> 5990 <div class="impersonation impersonation--@(impersonationLayout)-layout dw-mod" id="Impersonation"> 5991 @if (impersonationLayout == "right-lower-box") 5992 { 5993 @RenderRightLowerBoxHeader() 5994 } 5995 <div class="center-container top-container__center-container impersonation__container @(impersonationLayout != "bar" && impersonationLayout != "top-bar" ? "impersonation__container--box" : "") dw-mod"> 5996 @*Impersonation*@ 5997 @RenderBlockList(subBlocks) 5998 </div> 5999 </div> 6000 } 6001 6002 @helper RenderRightLowerBoxHeader() 6003 { 6004 <div class="impersonation__header dw-mod"> 6005 <div class="impersonation__title">@Translate("Impersonation")</div> 6006 <label for="ImpersonationMinimizeTrigger" class="btn btn--impersonation impersonation__minimize-btn dw-mod" onclick="this.blur();"> 6007 @Render(new Icon 6008 { 6009 Prefix = "fas", 6010 Name = "fa-window-minimize" 6011 }) 6012 </label> 6013 </div> 6014 } 6015 6016 @helper RenderStopImpersonationView() 6017 { 6018 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6019 string userName = getUserName(Pageview.User); 6020 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> "; 6021 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; 6022 6023 if (impersonationLayout == "right-lower-box") 6024 { 6025 <div class="u-margin-bottom--lg u-ta-center"> 6026 @impersonationText 6027 </div> 6028 <div class="u-margin-bottom--lg u-ta-center"> 6029 @RenderSwitchAccountButton() 6030 </div> 6031 @RenderStopImpersonationButton() 6032 } 6033 else 6034 { 6035 <div class="grid grid--align-center impersonation__stop-wrap"> 6036 <div class="impersonation-bar-item dw-mod"> 6037 @impersonationText 6038 </div> 6039 <div class="impersonation-bar-item dw-mod"> 6040 @RenderSwitchAccountButton() 6041 </div> 6042 <div class="impersonation-bar-item dw-mod"> 6043 @RenderStopImpersonationButton() 6044 </div> 6045 </div> 6046 } 6047 } 6048 6049 @helper RenderSwitchAccountButton() { 6050 @Render(new Button 6051 { 6052 Href = "/Default.aspx?ID=" + impersonationPageId, 6053 ButtonType = ButtonType.Button, 6054 ButtonLayout = ButtonLayout.Clean, 6055 Title = Translate("Switch account"), 6056 Icon = new Icon { 6057 Name = "fa-users", 6058 Prefix = "fal", 6059 LabelPosition = IconLabelPosition.After 6060 }, 6061 CssClass = "u-no-margin u-color-inherit" 6062 }) 6063 } 6064 6065 @helper RenderStopImpersonationForm() 6066 { 6067 string secondaryUserName = getUserName(Model.CurrentSecondaryUser); 6068 string userName = getUserName(Pageview.User); 6069 int pageId = Model.TopPage.ID; 6070 6071 <form method="post" class="u-no-margin"> 6072 @Render(new Button 6073 { 6074 ButtonType = ButtonType.Submit, 6075 ButtonLayout = ButtonLayout.Secondary, 6076 Title = Translate("Sign out as") + " " + userName, 6077 Href = "/Default.aspx?ID=" + impersonationPageId, 6078 CssClass = "btn--full", 6079 Name = "DwExtranetRemoveSecondaryUser" 6080 }) 6081 6082 @Render(new Button 6083 { 6084 ButtonType = ButtonType.Submit, 6085 ButtonLayout = ButtonLayout.Secondary, 6086 Title = Translate("Sign out as") + " " + secondaryUserName, 6087 Href = "/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, 6088 CssClass = "btn--full", 6089 Name = "DwExtranetRemoveSecondaryUser" 6090 }) 6091 </form> 6092 } 6093 6094 @helper RenderStopImpersonationButton() { 6095 @Render(new Button 6096 { 6097 ButtonType = ButtonType.Button, 6098 ButtonLayout = ButtonLayout.Clean, 6099 Title = Translate("Sign out"), 6100 Icon = new Icon { 6101 Name = "fa-sign-out", 6102 Prefix = "fal", 6103 LabelPosition = IconLabelPosition.After 6104 }, 6105 OnClick = "document.getElementById('StopImpersonationModalTrigger').checked = true", 6106 CssClass = "u-no-margin" 6107 }) 6108 } 6109 6110 @helper RenderImpersonationControls() 6111 { 6112 <div class="impersonation__controls"> 6113 @RenderViewListLink() 6114 @RenderSearchBox() 6115 </div> 6116 @RenderResultsList() 6117 } 6118 6119 @helper RenderViewListLink() 6120 { 6121 string title = impersonationLayout == "right-lower-box" ? Translate("View the list") : Translate("View the list of users you can sign in as"); 6122 string buttonClasses = impersonationLayout == "right-lower-box" ? "impersonation__button btn btn--impersonation" : "impersonation__link impersonation__link"; 6123 6124 @Render(new Link { 6125 ButtonLayout = ButtonLayout.None, 6126 Title = title, 6127 Href = "/Default.aspx?ID=" + impersonationPageId, 6128 CssClass = buttonClasses 6129 }) 6130 } 6131 6132 @helper RenderSearchBox() 6133 { 6134 <div class="impersonation__search-wrap"> 6135 <input placeholder="@Translate("Search users")" type="text" class="impersonation__search-field dw-mod" onkeyup="searchKeyUpHandler(event)" id="ImpersonationBoxSearchField"> 6136 <div id="ImpersonationBoxSearchFind" class="impersonation__search-icon dw-mod" onclick="updateResults(document.getElementById('ImpersonationBoxSearchField').value)"> 6137 <i class="fal fa-search"></i> 6138 </div> 6139 <div id="ImpersonationBoxSearchClear" class="impersonation__search-icon u-hidden dw-mod" onclick="clearResults();"> 6140 <i class="fal fa-times"></i> 6141 </div> 6142 </div> 6143 } 6144 6145 @helper RenderTypeaheadSearch() 6146 { 6147 <div class="typeahead u-ta-right impersonation__typeahead js-typeahead dw-mod" id="ImpersonationSearchBar" 6148 data-page-size="5" 6149 data-search-feed-id="@impersonationFeed" 6150 data-result-page-id="@impersonationPageId" 6151 data-search-type="user-search" 6152 data-search-parameter-name="q"> 6153 6154 <div class="typeahead-search-field"> 6155 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" placeholder="@Translate("Search users")"> 6156 <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> 6157 </div> 6158 </div> 6159 } 6160 6161 @helper RenderResultsList() 6162 { 6163 <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> 6164 } 6165 6166 @helper RenderSearchResultTemplate() 6167 { 6168 <script id="ImpersonationSearchResult" type="text/x-template"> 6169 {{#.}} 6170 {{#Users}} 6171 <li class="impersonation__search-results-item impersonation-user"> 6172 <form method="post" class="impersonation-user__form" name="account{{id}}"> 6173 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 6174 <div class="impersonation-user__info"> 6175 <div class="impersonation-user__name">{{userName}}</div> 6176 <div class="impersonation-user__number">{{customerNumber}}</div> 6177 </div> 6178 @Render(new Button 6179 { 6180 ButtonType = ButtonType.Submit, 6181 ButtonLayout = ButtonLayout.Secondary, 6182 Title = Translate("Sign in as"), 6183 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 6184 }) 6185 </form> 6186 </li> 6187 {{/Users}} 6188 {{#unless Users}} 6189 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 6190 @Translate("Your search gave 0 results") 6191 </li> 6192 {{/unless}} 6193 {{/.}} 6194 </script> 6195 } 6196 6197 @helper RenderSearchScripts() 6198 { 6199 <script> 6200 let inputDelayTimer; 6201 function searchKeyUpHandler(e) { 6202 clearTimeout(inputDelayTimer); 6203 let value = e.target.value; 6204 if (value != "") { 6205 inputDelayTimer = setTimeout(function () { 6206 updateResults(value); 6207 }, 500); 6208 } else { 6209 clearResults(); 6210 } 6211 }; 6212 6213 function updateResults(value) { 6214 if (value == "") { 6215 return null; 6216 } 6217 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 6218 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 6219 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 6220 } 6221 6222 function clearResults() { 6223 document.getElementById("ImpersonationBoxSearchField").value = ""; 6224 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 6225 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 6226 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 6227 } 6228 </script> 6229 } 6230 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6231 6232 @using System 6233 @using System.Web 6234 @using System.Collections.Generic 6235 @using Dynamicweb.Rapido.Blocks.Extensibility 6236 @using Dynamicweb.Rapido.Blocks 6237 6238 @{ 6239 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 6240 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 6241 6242 Block orderLines = new Block 6243 { 6244 Id = "MiniCartOrderLines", 6245 SkipRenderBlocksList = true, 6246 BlocksList = new List<Block> 6247 { 6248 new Block { 6249 Id = "MiniCartOrderLinesList", 6250 SortId = 20, 6251 Template = RenderMiniCartOrderLinesList() 6252 } 6253 } 6254 }; 6255 6256 Block orderlinesScriptTemplates = new Block 6257 { 6258 Id = "OrderlinesScriptTemplates" 6259 }; 6260 6261 if (orderlinesView == "table") 6262 { 6263 orderLines.Template = RenderMiniCartOrderLinesTable(); 6264 orderLines.BlocksList.Add( 6265 new Block 6266 { 6267 Id = "MiniCartOrderlinesTableHeader", 6268 SortId = 10, 6269 Template = RenderMiniCartOrderLinesHeader() 6270 } 6271 ); 6272 6273 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6274 } 6275 else 6276 { 6277 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6278 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6279 } 6280 6281 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6282 6283 Block miniCartScriptTemplates = new Block() 6284 { 6285 Id = "MasterMiniCartTemplates", 6286 SortId = 1, 6287 Template = RenderMiniCartScriptTemplates(), 6288 SkipRenderBlocksList = true, 6289 BlocksList = new List<Block> 6290 { 6291 orderLines, 6292 new Block { 6293 Id = "MiniCartFooter", 6294 Template = RenderMiniCartFooter(), 6295 SortId = 50, 6296 SkipRenderBlocksList = true, 6297 BlocksList = new List<Block> 6298 { 6299 new Block { 6300 Id = "MiniCartSubTotal", 6301 Template = RenderMiniCartSubTotal(), 6302 SortId = 30 6303 }, 6304 new Block { 6305 Id = "MiniCartFees", 6306 Template = RenderMiniCartFees(), 6307 SortId = 40 6308 }, 6309 new Block { 6310 Id = "MiniCartPoints", 6311 Template = RenderMiniCartPoints(), 6312 SortId = 50 6313 }, 6314 new Block { 6315 Id = "MiniCartTotal", 6316 Template = RenderMiniCartTotal(), 6317 SortId = 60 6318 }, 6319 new Block { 6320 Id = "MiniCartDisclaimer", 6321 Template = RenderMiniCartDisclaimer(), 6322 SortId = 70 6323 }, 6324 new Block { 6325 Id = "MiniCartActions", 6326 Template = RenderMiniCartActions(), 6327 SortId = 80 6328 } 6329 } 6330 } 6331 } 6332 }; 6333 6334 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6335 } 6336 6337 @helper RenderMiniCartScriptsTableTemplates() 6338 { 6339 <script id="MiniCartOrderline" type="text/x-template"> 6340 {{#unless isEmpty}} 6341 <tr> 6342 <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> 6343 <td class="u-va-middle"> 6344 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6345 {{#if variantname}} 6346 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6347 {{/if}} 6348 {{#if unitname}} 6349 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6350 {{/if}} 6351 </td> 6352 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6353 <td class="u-ta-right u-va-middle"> 6354 {{#if pointsTotal}} 6355 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6356 {{else}} 6357 {{totalprice}} 6358 {{/if}} 6359 </td> 6360 </tr> 6361 {{/unless}} 6362 </script> 6363 6364 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6365 {{#unless isEmpty}} 6366 <tr class="table__row--no-border"> 6367 <td class="u-w60px">&nbsp;</td> 6368 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6369 <td class="u-ta-right">&nbsp;</td> 6370 <td class="u-ta-right">{{totalprice}}</td> 6371 </tr> 6372 {{/unless}} 6373 </script> 6374 } 6375 6376 @helper RenderMiniCartScriptsListTemplates() 6377 { 6378 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6379 6380 <script id="MiniCartOrderline" type="text/x-template"> 6381 {{#unless isEmpty}} 6382 <div class="mini-cart-orderline grid dw-mod"> 6383 <div class="grid__col-4"> 6384 <a href="{{link}}" class="{{hideimage}}"> 6385 <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}}"> 6386 </a> 6387 </div> 6388 <div class="grid__col-8"> 6389 <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> 6390 {{#if variantname}} 6391 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6392 {{/if}} 6393 {{#if unitname}} 6394 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6395 {{/if}} 6396 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6397 6398 <div class="grid__cell-footer"> 6399 <div class="grid__cell"> 6400 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6401 {{#if pointsTotal}} 6402 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6403 {{else}} 6404 {{totalprice}} 6405 {{/if}} 6406 </div> 6407 <button type="button" 6408 title="@Translate("Remove orderline")" 6409 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 6410 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 6411 </div> 6412 </div> 6413 </div> 6414 </div> 6415 {{/unless}} 6416 </script> 6417 6418 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6419 {{#unless isEmpty}} 6420 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6421 <div class="grid__col-4"> 6422 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6423 </div> 6424 <div class="grid__col-8">{{totalprice}}</div> 6425 </div> 6426 {{/unless}} 6427 </script> 6428 } 6429 6430 @helper RenderMiniCartScriptTemplates() 6431 { 6432 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6433 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6434 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6435 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6436 6437 <script id="MiniCartContent" type="text/x-template"> 6438 {{#.}} 6439 {{#unless isEmpty}} 6440 @if (miniCartUseGoogleTagManager) 6441 { 6442 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 6443 } 6444 @RenderBlockList(subBlocks) 6445 {{/unless}} 6446 {{/.}} 6447 </script> 6448 } 6449 6450 @helper RenderMiniCartOrderLinesTable() 6451 { 6452 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6453 6454 <div class="u-overflow-auto"> 6455 <table class="table mini-cart-table dw-mod"> 6456 @RenderBlockList(subBlocks) 6457 </table> 6458 </div> 6459 } 6460 6461 @helper RenderMiniCartOrderLinesBlocks() 6462 { 6463 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6464 6465 <div class="u-overflow-auto"> 6466 @RenderBlockList(subBlocks) 6467 </div> 6468 } 6469 6470 @helper RenderMiniCartOrderLinesHeader() 6471 { 6472 <thead> 6473 <tr> 6474 <td>&nbsp;</td> 6475 <td>@Translate("Product")</td> 6476 <td class="u-ta-right">@Translate("Qty")</td> 6477 <td class="u-ta-right" width="120">@Translate("Price")</td> 6478 </tr> 6479 </thead> 6480 } 6481 6482 @helper RenderMiniCartOrderLinesList() 6483 { 6484 <text> 6485 {{#OrderLines}} 6486 {{#ifCond template "===" "CartOrderline"}} 6487 {{>MiniCartOrderline}} 6488 {{/ifCond}} 6489 {{#ifCond template "===" "CartOrderlineMobile"}} 6490 {{>MiniCartOrderline}} 6491 {{/ifCond}} 6492 {{#ifCond template "===" "CartOrderlineDiscount"}} 6493 {{>MiniCartOrderlineDiscount}} 6494 {{/ifCond}} 6495 {{/OrderLines}} 6496 </text> 6497 } 6498 6499 @helper RenderMiniCartFees() 6500 { 6501 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6502 if (!pointShop) 6503 { 6504 <text> 6505 {{#unless hidePaymentfee}} 6506 <div class="grid"> 6507 <div class="grid__col-6 grid__col--bleed-y"> 6508 {{paymentmethod}} 6509 </div> 6510 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6511 </div> 6512 {{/unless}} 6513 </text> 6514 } 6515 <text> 6516 {{#unless hideShippingfee}} 6517 <div class="grid"> 6518 <div class="grid__col-6 grid__col--bleed-y"> 6519 {{shippingmethod}} 6520 </div> 6521 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6522 </div> 6523 {{/unless}} 6524 </text> 6525 <text> 6526 {{#if hasTaxSettings}} 6527 <div class="grid"> 6528 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6529 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6530 </div> 6531 {{/if}} 6532 </text> 6533 } 6534 6535 @helper RenderMiniCartFooter() 6536 { 6537 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6538 6539 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6540 @RenderBlockList(subBlocks) 6541 </div> 6542 } 6543 6544 @helper RenderMiniCartActions() 6545 { 6546 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6547 6548 <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> 6549 <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> 6550 } 6551 6552 @helper RenderMiniCartPoints() 6553 { 6554 <text> 6555 {{#if earnings}} 6556 <div class="grid"> 6557 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6558 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6559 <div> 6560 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6561 </div> 6562 </div> 6563 </div> 6564 {{/if}} 6565 </text> 6566 } 6567 6568 @helper RenderMiniCartSubTotal() 6569 { 6570 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6571 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6572 if (!pointShop) 6573 { 6574 <text> 6575 {{#unless hideSubTotal}} 6576 <div class="grid dw-mod u-bold"> 6577 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6578 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6579 @if (hasTaxSettings) 6580 { 6581 <text>{{subtotalpricewithouttaxes}}</text> 6582 } 6583 else 6584 { 6585 <text>{{subtotalprice}}</text> 6586 } 6587 </div> 6588 </div> 6589 {{/unless}} 6590 </text> 6591 } 6592 } 6593 6594 @helper RenderMiniCartTotal() 6595 { 6596 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6597 6598 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6599 <div class="grid__col-6">@Translate("Total")</div> 6600 <div class="grid__col-6 grid--align-end"> 6601 <div> 6602 @if (pointShop) 6603 { 6604 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6605 } 6606 else 6607 { 6608 <text>{{totalprice}}</text> 6609 } 6610 </div> 6611 </div> 6612 </div> 6613 } 6614 6615 @helper RenderMiniCartDisclaimer() 6616 { 6617 <text> 6618 {{#if showCheckoutDisclaimer}} 6619 <div class="grid u-margin-bottom u-ta-right"> 6620 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6621 </div> 6622 {{/if}} 6623 </text> 6624 } 6625 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6626 6627 @using Dynamicweb.Rapido.Blocks.Extensibility 6628 @using Dynamicweb.Rapido.Blocks 6629 @using Dynamicweb.Rapido.Blocks.Components.General 6630 @using Dynamicweb.Rapido.Blocks.Components 6631 @using Dynamicweb.Rapido.Services 6632 6633 @{ 6634 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6635 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6636 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6637 6638 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6639 { 6640 if (addToCartNotificationType == "modal") 6641 { 6642 Block addToCartNotificationModal = new Block 6643 { 6644 Id = "AddToCartNotificationModal", 6645 Template = RenderAddToCartNotificationModal() 6646 }; 6647 6648 Block addToCartNotificationScript = new Block 6649 { 6650 Id = "AddToCartNotificationScript", 6651 Template = RenderAddToCartNotificationModalScript() 6652 }; 6653 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6654 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6655 } 6656 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6657 { 6658 Block addToCartNotificationScript = new Block 6659 { 6660 Id = "AddToCartNotificationScript", 6661 Template = RenderAddToCartNotificationToggleScript() 6662 }; 6663 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6664 } 6665 } 6666 } 6667 6668 @helper RenderAddToCartNotificationModal() 6669 { 6670 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6671 } 6672 6673 @helper RenderAddToCartNotificationModalScript() 6674 { 6675 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6676 6677 <script id="LastAddedProductTemplate" type="text/x-template"> 6678 @{ 6679 6680 Modal lastAddedProduct = new Modal 6681 { 6682 Id = "LastAddedProduct", 6683 Heading = new Heading 6684 { 6685 Level = 2, 6686 Title = Translate("Product is added to the cart") 6687 }, 6688 Width = ModalWidth.Md, 6689 BodyTemplate = RenderModalContent() 6690 }; 6691 6692 lastAddedProduct.AddActions( 6693 new Button 6694 { 6695 ButtonType = ButtonType.Button, 6696 ButtonLayout = ButtonLayout.Secondary, 6697 Title = Translate("Continue shopping"), 6698 CssClass = "u-pull--left u-no-margin btn--sm", 6699 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6700 }, 6701 new Link 6702 { 6703 Href = "/Default.aspx?ID=" + cartPageId, 6704 ButtonLayout = ButtonLayout.Secondary, 6705 CssClass = "u-pull--right u-no-margin btn--sm", 6706 Title = Translate("Proceed to checkout"), 6707 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6708 } 6709 ); 6710 6711 @Render(lastAddedProduct) 6712 } 6713 </script> 6714 <script> 6715 document.addEventListener('addToCart', function (event) { 6716 Cart.ShowLastAddedProductModal(event.detail); 6717 }); 6718 </script> 6719 } 6720 6721 @helper RenderModalContent() 6722 { 6723 <div class="grid"> 6724 <div class="grid__col-2"> 6725 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6726 </div> 6727 <div class="u-padding grid--align-self-center"> 6728 <span>{{quantity}}</span> x 6729 </div> 6730 <div class="grid__col-auto grid--align-self-center"> 6731 <div>{{productInfo.name}}</div> 6732 {{#if productInfo.variantName}} 6733 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6734 {{/if}} 6735 {{#if productInfo.unitName}} 6736 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6737 {{/if}} 6738 </div> 6739 </div> 6740 } 6741 6742 @helper RenderAddToCartNotificationToggleScript() 6743 { 6744 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6745 6746 <script> 6747 document.addEventListener('addToCart', function () { 6748 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6749 }); 6750 </script> 6751 } 6752 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6753 6754 @using System 6755 @using System.Web 6756 @using System.Collections.Generic 6757 @using Dynamicweb.Rapido.Blocks.Extensibility 6758 @using Dynamicweb.Rapido.Blocks 6759 @using Dynamicweb.Rapido.Blocks.Components.General 6760 6761 @functions { 6762 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6763 } 6764 6765 @{ 6766 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6767 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6768 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6769 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6770 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6771 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6772 6773 Block masterFooterContent = new Block() 6774 { 6775 Id = "MasterFooterContent", 6776 SortId = 10, 6777 Template = RenderFooter(), 6778 SkipRenderBlocksList = true 6779 }; 6780 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6781 6782 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6783 { 6784 Block masterFooterColumnOne = new Block 6785 { 6786 Id = "MasterFooterColumnOne", 6787 SortId = 10, 6788 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6789 Design = new Design 6790 { 6791 Size = "auto", 6792 RenderType = RenderType.Column 6793 } 6794 }; 6795 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6796 } 6797 6798 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6799 { 6800 Block masterFooterColumnTwo = new Block 6801 { 6802 Id = "MasterFooterColumnTwo", 6803 SortId = 20, 6804 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6805 Design = new Design 6806 { 6807 Size = "auto", 6808 RenderType = RenderType.Column 6809 } 6810 }; 6811 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6812 } 6813 6814 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6815 { 6816 Block masterFooterColumnThree = new Block 6817 { 6818 Id = "MasterFooterColumnThree", 6819 SortId = 30, 6820 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6821 Design = new Design 6822 { 6823 Size = "auto", 6824 RenderType = RenderType.Column 6825 } 6826 }; 6827 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6828 } 6829 6830 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6831 { 6832 Block masterFooterNewsletterSignUp = new Block 6833 { 6834 Id = "MasterFooterNewsletterSignUp", 6835 SortId = 40, 6836 Template = RenderFooterNewsletterSignUp(), 6837 Design = new Design 6838 { 6839 Size = "auto", 6840 RenderType = RenderType.Column 6841 } 6842 }; 6843 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6844 } 6845 6846 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6847 { 6848 Block masterFooterSocialLinks = new Block 6849 { 6850 Id = "MasterFooterSocialLinks", 6851 SortId = 50, 6852 Template = RenderFooterSocialLinks(), 6853 Design = new Design 6854 { 6855 Size = "auto", 6856 RenderType = RenderType.Column 6857 } 6858 }; 6859 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6860 } 6861 6862 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6863 { 6864 Block masterFooterPayments = new Block 6865 { 6866 Id = "MasterFooterPayments", 6867 SortId = 60, 6868 Template = RenderFooterPayments(), 6869 Design = new Design 6870 { 6871 Size = "12", 6872 RenderType = RenderType.Column 6873 } 6874 }; 6875 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6876 } 6877 6878 Block masterFooterCopyright = new Block 6879 { 6880 Id = "MasterFooterCopyright", 6881 SortId = 70, 6882 Template = RenderFooterCopyright(), 6883 Design = new Design 6884 { 6885 Size = "12", 6886 RenderType = RenderType.Column 6887 } 6888 }; 6889 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6890 } 6891 6892 @helper RenderFooter() 6893 { 6894 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6895 6896 <footer class="footer no-print dw-mod"> 6897 <div class="center-container top-container__center-container dw-mod"> 6898 <div class="grid grid--external-bleed-x"> 6899 @RenderBlockList(subBlocks) 6900 </div> 6901 </div> 6902 </footer> 6903 } 6904 6905 @helper RenderFooterColumn(string header, string content) 6906 { 6907 <h3 class="footer__heading dw-mod">@header</h3> 6908 <div class="footer__content dw-mod"> 6909 @content 6910 </div> 6911 } 6912 6913 @helper RenderFooterNewsletterSignUp() 6914 { 6915 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6916 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 6917 6918 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6919 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6920 form.Add(new TextField { 6921 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 6922 Type = TextFieldType.Email, 6923 ActionButton = new Button { 6924 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 6925 } 6926 }); 6927 6928 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6929 <div class="footer__content dw-mod"> 6930 @Render(form) 6931 </div> 6932 } 6933 6934 @helper RenderFooterSocialLinks() 6935 { 6936 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6937 <div class="footer__content dw-mod"> 6938 <div class="collection dw-mod"> 6939 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6940 { 6941 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6942 string socialIconClass = socialIcon.SelectedValue; 6943 string socialIconTitle = socialIcon.SelectedName; 6944 string socialLink = socialitem.GetString("Link"); 6945 6946 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6947 } 6948 </div> 6949 </div> 6950 } 6951 6952 @helper RenderFooterPayments() 6953 { 6954 <div class="footer__content dw-mod"> 6955 <div class="collection dw-mod"> 6956 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6957 { 6958 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6959 string paymentImage = null; 6960 string paymentTitle = paymentItem.SelectedName; 6961 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6962 if (selected != null) 6963 { 6964 paymentImage = selected.Icon; 6965 } 6966 6967 <div class="footer__card-type"> 6968 <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" /> 6969 </div> 6970 } 6971 </div> 6972 </div> 6973 } 6974 6975 @helper RenderFooterCopyright() 6976 { 6977 <div class="grid__col-12 footer__copyright dw-mod"> 6978 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6979 </div> 6980 } 6981 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6982 6983 @using System 6984 @using System.Web 6985 @using System.Collections.Generic 6986 @using Dynamicweb.Rapido.Blocks.Extensibility 6987 @using Dynamicweb.Rapido.Blocks 6988 @using Dynamicweb.Ecommerce.Common 6989 6990 @{ 6991 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 6992 6993 Block masterScriptReferences = new Block() 6994 { 6995 Id = "MasterScriptReferences", 6996 SortId = 1, 6997 Template = RenderMasterScriptReferences() 6998 }; 6999 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 7000 } 7001 7002 @helper RenderMasterScriptReferences() { 7003 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 7004 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 7005 7006 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 7007 { 7008 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 7009 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 7010 } 7011 7012 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 7013 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 7014 } 7015 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7016 7017 @using System 7018 @using System.Web 7019 @using System.Collections.Generic 7020 @using Dynamicweb.Rapido.Blocks.Extensibility 7021 @using Dynamicweb.Rapido.Blocks 7022 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7023 @using Dynamicweb.Rapido.Services 7024 7025 @{ 7026 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 7027 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 7028 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 7029 7030 if (!navigationItemsHideSearch || isFavoriteList) 7031 { 7032 Block masterSearchScriptTemplates = new Block() 7033 { 7034 Id = "MasterSearchScriptTemplates", 7035 SortId = 1, 7036 Template = RenderSearchScriptTemplates() 7037 }; 7038 7039 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 7040 } 7041 } 7042 7043 @helper RenderSearchScriptTemplates() 7044 { 7045 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7046 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7047 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7048 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7049 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7050 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7051 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7052 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7053 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7054 7055 <script id="SearchGroupsTemplate" type="text/x-template"> 7056 {{#.}} 7057 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7058 {{/.}} 7059 </script> 7060 7061 <script id="SearchProductsTemplate" type="text/x-template"> 7062 {{#each .}} 7063 {{#Product}} 7064 {{#ifCond template "!==" "SearchMore"}} 7065 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7066 @if (useFacebookPixel) 7067 { 7068 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7069 } 7070 @if (useGoogleTagManager) 7071 { 7072 <text>{{{googleEnchantImpression googleImpression}}}</text> 7073 } 7074 <div> 7075 <a href="{{link}}" 7076 class="js-typeahead-link u-color-inherit u-pull--left" 7077 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 7078 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7079 <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> 7080 <div class="u-pull--left"> 7081 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7082 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7083 { 7084 if (pointShopOnly) 7085 { 7086 <text> 7087 {{#if havePointPrice}} 7088 <div> 7089 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7090 </div> 7091 {{else}} 7092 <small class="help-text u-no-margin">@Translate("Not available")</small> 7093 {{/if}} 7094 {{#unless canBePurchasedWithPoints}} 7095 {{#if havePointPrice}} 7096 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7097 {{/if}} 7098 {{/unless}} 7099 </text> 7100 } 7101 else 7102 { 7103 <div>{{price}}</div> 7104 } 7105 } 7106 </div> 7107 </a> 7108 <div class="u-margin-left u-pull--right"> 7109 @{ 7110 var viewBtn = new Link 7111 { 7112 Href = "{{link}}", 7113 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 7114 ButtonLayout = ButtonLayout.Secondary, 7115 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7116 Title = Translate("View") 7117 }; 7118 } 7119 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7120 { 7121 <text>{{#if hideAddToCartButton}}</text> 7122 @Render(viewBtn) 7123 <text>{{else}}</text> 7124 @Render(new AddToCartButton 7125 { 7126 HideTitle = true, 7127 ProductId = "{{productId}}", 7128 ProductInfo = "{{productInfo}}", 7129 BuyForPoints = pointShopOnly, 7130 OnClick = "{{facebookPixelAction}}", 7131 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 7132 Icon = new Icon { 7133 CssClass = "js-ignore-click-outside" 7134 }, 7135 ExtraAttributes = new Dictionary<string, string> 7136 { 7137 { "{{disabledBuyButton}}", "" } 7138 } 7139 }) 7140 <text>{{/if}}</text> 7141 } 7142 else if (showViewButton) 7143 { 7144 @Render(viewBtn) 7145 } 7146 @if (showAddToDownloadButton) 7147 { 7148 <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}}"> 7149 <i class="fas fa-plus js-button-icon"></i> 7150 </button> 7151 } 7152 </div> 7153 </div> 7154 </li> 7155 {{/ifCond}} 7156 {{#ifCond template "===" "SearchMore"}} 7157 {{>SearchMoreProducts}} 7158 {{/ifCond}} 7159 {{/Product}} 7160 {{else}} 7161 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7162 @Translate("Your search gave 0 results") 7163 </li> 7164 {{/each}} 7165 </script> 7166 7167 <script id="SearchMoreProducts" type="text/x-template"> 7168 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7169 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7170 @Translate("View all") 7171 </a> 7172 </li> 7173 </script> 7174 7175 <script id="SearchMorePages" type="text/x-template"> 7176 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7177 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7178 @Translate("View all") 7179 </a> 7180 </li> 7181 </script> 7182 7183 <script id="SearchPagesTemplate" type="text/x-template"> 7184 {{#each .}} 7185 {{#ifCond template "!==" "SearchMore"}} 7186 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 7187 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 7188 <div class="u-margin-right u-inline"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7189 <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> 7190 </a> 7191 </li> 7192 {{/ifCond}} 7193 {{#ifCond template "===" "SearchMore"}} 7194 {{>SearchMorePages}} 7195 {{/ifCond}} 7196 {{else}} 7197 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7198 @Translate("Your search gave 0 results") 7199 </li> 7200 {{/each}} 7201 </script> 7202 7203 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7204 <div class="dropdown__column-header">@Translate("Pages")</div> 7205 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7206 {{>SearchPagesTemplate}} 7207 </ul> 7208 </script> 7209 7210 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7211 <div class="dropdown__column-header">@Translate("Products")</div> 7212 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7213 {{>SearchProductsTemplate}} 7214 </ul> 7215 </script> 7216 } 7217 7218 @using Dynamicweb.Rapido.Blocks.Components 7219 @using Dynamicweb.Rapido.Blocks.Components.General 7220 @using Dynamicweb.Rapido.Blocks 7221 @using System.IO 7222 7223 7224 @using Dynamicweb.Rapido.Blocks.Components.General 7225 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7226 7227 7228 @* Component *@ 7229 7230 @helper RenderVariantMatrix(VariantMatrix settings) { 7231 if (settings != null) 7232 { 7233 int productLoopCounter = 0; 7234 int groupCount = 0; 7235 List<VariantOption> firstDimension = new List<VariantOption>(); 7236 List<VariantOption> secondDimension = new List<VariantOption>(); 7237 List<VariantOption> thirdDimension = new List<VariantOption>(); 7238 7239 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 7240 { 7241 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 7242 { 7243 if (groupCount == 0) { 7244 firstDimension.Add(variantOptions); 7245 } 7246 if (groupCount == 1) 7247 { 7248 secondDimension.Add(variantOptions); 7249 } 7250 if (groupCount == 2) 7251 { 7252 thirdDimension.Add(variantOptions); 7253 } 7254 } 7255 groupCount++; 7256 } 7257 7258 int rowCount = 0; 7259 int columnCount = 0; 7260 7261 <script> 7262 var variantsCollection = []; 7263 </script> 7264 7265 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 7266 @if (groupCount == 1) 7267 { 7268 <tbody> 7269 @foreach (VariantOption firstVariantOption in firstDimension) 7270 { 7271 var variantId = firstVariantOption.Id; 7272 <tr> 7273 <td class="u-bold"> 7274 @firstVariantOption.Name 7275 </td> 7276 <td> 7277 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7278 </td> 7279 </tr> 7280 productLoopCounter++; 7281 } 7282 7283 <tr> 7284 <td>&nbsp;</td> 7285 <td> 7286 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7287 </td> 7288 </tr> 7289 </tbody> 7290 } 7291 @if (groupCount == 2) 7292 { 7293 <thead> 7294 <tr> 7295 <td>&nbsp;</td> 7296 @foreach (VariantOption variant in secondDimension) 7297 { 7298 <td>@variant.Name</td> 7299 } 7300 </tr> 7301 </thead> 7302 <tbody> 7303 @foreach (VariantOption firstVariantOption in firstDimension) 7304 { 7305 string variantId = ""; 7306 columnCount = 0; 7307 7308 <tr> 7309 <td class="u-min-w120px">@firstVariantOption.Name</td> 7310 7311 @foreach (VariantOption secondVariantOption in secondDimension) 7312 { 7313 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7314 <td> 7315 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7316 </td> 7317 7318 columnCount++; 7319 7320 productLoopCounter++; 7321 } 7322 7323 <td> 7324 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7325 </td> 7326 </tr> 7327 7328 rowCount++; 7329 } 7330 7331 @{ 7332 columnCount = 0; 7333 } 7334 7335 <tr> 7336 <td>&nbsp;</td> 7337 @foreach (VariantOption secondVariantOption in secondDimension) 7338 { 7339 <td> 7340 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7341 </td> 7342 7343 columnCount++; 7344 } 7345 <td>&nbsp;</td> 7346 </tr> 7347 </tbody> 7348 } 7349 @if (groupCount == 3) 7350 { 7351 <thead> 7352 <tr> 7353 <td>&nbsp;</td> 7354 @foreach (VariantOption thirdVariantOption in thirdDimension) 7355 { 7356 <td>@thirdVariantOption.Name</td> 7357 } 7358 </tr> 7359 </thead> 7360 <tbody> 7361 @foreach (VariantOption firstVariantOption in firstDimension) 7362 { 7363 int colspan = (thirdDimension.Count + 1); 7364 7365 <tr> 7366 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7367 </tr> 7368 7369 foreach (VariantOption secondVariantOption in secondDimension) 7370 { 7371 string variantId = ""; 7372 columnCount = 0; 7373 7374 <tr> 7375 <td class="u-min-w120px">@secondVariantOption.Name</td> 7376 7377 @foreach (VariantOption thirdVariantOption in thirdDimension) 7378 { 7379 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7380 7381 <td> 7382 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7383 </td> 7384 7385 columnCount++; 7386 productLoopCounter++; 7387 } 7388 7389 <td> 7390 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7391 </td> 7392 </tr> 7393 rowCount++; 7394 } 7395 } 7396 7397 @{ 7398 columnCount = 0; 7399 } 7400 7401 <tr> 7402 <td>&nbsp;</td> 7403 @foreach (VariantOption thirdVariantOption in thirdDimension) 7404 { 7405 <td> 7406 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7407 </td> 7408 7409 columnCount++; 7410 } 7411 <td>&nbsp;</td> 7412 </tr> 7413 </tbody> 7414 } 7415 </table> 7416 7417 <script> 7418 document.addEventListener("DOMContentLoaded", function (event) { 7419 MatrixUpdateQuantity("@settings.ProductId"); 7420 }); 7421 7422 MatrixUpdateQuantity = function (productId) { 7423 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7424 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7425 7426 var qtyRowArr = []; 7427 var qtyColumnArr = []; 7428 7429 var totalQty = 0; 7430 7431 for (var i = 0; i < allQtyFields.length; i++) { 7432 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7433 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7434 } 7435 7436 for (var i = 0; i < allQtyFields.length; i++) { 7437 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7438 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7439 totalQty += parseFloat(allQtyFields[i].value); 7440 } 7441 7442 //Update row counters 7443 for (var i = 0; i < qtyRowArr.length; i++) { 7444 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7445 7446 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7447 var currentCount = qtyCounter.innerHTML; 7448 qtyCounter.innerHTML = qtyRowArr[i]; 7449 7450 if (currentCount != qtyCounter.innerHTML) { 7451 qtyCounter.classList.add("qty-field--active"); 7452 } 7453 } 7454 7455 } 7456 7457 //Update column counters 7458 for (var i = 0; i < qtyColumnArr.length; i++) { 7459 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7460 7461 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7462 var currentCount = qtyCounter.innerHTML; 7463 qtyCounter.innerHTML = qtyColumnArr[i]; 7464 7465 if (currentCount != qtyCounter.innerHTML) { 7466 qtyCounter.classList.add("qty-field--active"); 7467 } 7468 } 7469 } 7470 7471 if (document.getElementById("TotalQtyCount_" + productId)) { 7472 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7473 } 7474 7475 //Clean up animations 7476 setTimeout(function () { 7477 for (var i = 0; i < qtyRowArr.length; i++) { 7478 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7479 if (qtyCounter != null) { 7480 qtyCounter.classList.remove("qty-field--active"); 7481 } 7482 } 7483 for (var i = 0; i < qtyColumnArr.length; i++) { 7484 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7485 if (qtyCounter != null) { 7486 qtyCounter.classList.remove("qty-field--active"); 7487 } 7488 } 7489 }, 1000); 7490 } 7491 </script> 7492 } 7493 } 7494 7495 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7496 { 7497 string loopCount = productLoopCounter.ToString(); 7498 7499 bool combinationFound = false; 7500 double stock = 0; 7501 double quantityValue = 0; 7502 string note = ""; 7503 7504 VariantProduct variantProduct = null; 7505 7506 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7507 { 7508 stock = variantProduct.Stock; 7509 quantityValue = variantProduct.Quantity; 7510 combinationFound = true; 7511 } 7512 7513 if (combinationFound) 7514 { 7515 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7516 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7517 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7518 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7519 <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"> 7520 7521 if (stock != 0) 7522 { 7523 <small>@Translate("Stock") @stock</small> 7524 } 7525 7526 <script> 7527 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7528 variantsCollection.push(variants); 7529 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7530 </script> 7531 } 7532 else 7533 { 7534 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7535 } 7536 } 7537 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7538 7539 @* Component *@ 7540 7541 @helper RenderAddToCart(AddToCart settings) 7542 { 7543 //set Id for quantity selector to get it's value from button 7544 if (settings.QuantitySelector != null) 7545 { 7546 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7547 { 7548 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7549 } 7550 7551 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7552 7553 if (settings.Disabled) 7554 { 7555 settings.QuantitySelector.Disabled = true; 7556 } 7557 7558 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7559 { 7560 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7561 } 7562 } 7563 7564 if (settings.Disabled) 7565 { 7566 settings.AddButton.Disabled = true; 7567 } 7568 7569 settings.AddButton.CssClass += " btn--condensed"; 7570 7571 //unitsSelector 7572 if (settings.UnitSelector != null) 7573 { 7574 if (settings.Disabled) 7575 { 7576 settings.QuantitySelector.Disabled = true; 7577 } 7578 } 7579 7580 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7581 @if (settings.UnitSelector != null) 7582 { 7583 @Render(settings.UnitSelector) 7584 } 7585 @if (settings.QuantitySelector != null) 7586 { 7587 @Render(settings.QuantitySelector) 7588 } 7589 @Render(settings.AddButton) 7590 </div> 7591 } 7592 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7593 7594 @* Component *@ 7595 7596 @helper RenderAddToCartButton(AddToCartButton settings) 7597 { 7598 if (!settings.HideTitle) 7599 { 7600 if (string.IsNullOrEmpty(settings.Title)) 7601 { 7602 if (settings.BuyForPoints) 7603 { 7604 settings.Title = Translate("Buy with points"); 7605 } 7606 else 7607 { 7608 settings.Title = Translate("Add to cart"); 7609 } 7610 } 7611 } 7612 else 7613 { 7614 settings.Title = ""; 7615 } 7616 7617 if (settings.Icon == null) 7618 { 7619 settings.Icon = new Icon(); 7620 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7621 } 7622 7623 if (string.IsNullOrEmpty(settings.Icon.Name)) 7624 { 7625 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7626 } 7627 7628 settings.OnClick = "Cart.AddToCart(event, { " + 7629 "id: '" + settings.ProductId + "'," + 7630 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7631 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7632 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7633 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7634 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7635 "});" + settings.OnClick; 7636 7637 @RenderButton(settings) 7638 } 7639 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7640 7641 @* Component *@ 7642 7643 @helper RenderUnitSelector(UnitSelector settings) 7644 { 7645 if (string.IsNullOrEmpty(settings.Id)) 7646 { 7647 settings.Id = Guid.NewGuid().ToString("N"); 7648 } 7649 var disabledClass = settings.Disabled ? "disabled" : ""; 7650 7651 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 7652 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7653 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 7654 <div class="dropdown__content dw-mod"> 7655 @settings.OptionsContent 7656 </div> 7657 <label class="dropdown-trigger-off" for="@settings.Id"></label> 7658 </div> 7659 } 7660 @using System.Reflection 7661 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7662 7663 @* Component *@ 7664 7665 @helper RenderQuantitySelector(QuantitySelector settings) 7666 { 7667 var attributes = new Dictionary<string, string>(); 7668 7669 /*base settings*/ 7670 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7671 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7672 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7673 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7674 if (settings.Required) { attributes.Add("required", "true"); } 7675 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7676 /*end*/ 7677 7678 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7679 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7680 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7681 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7682 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7683 if (settings.Min == null) { settings.Min = 1; } 7684 attributes.Add("min", settings.Min.ToString()); 7685 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7686 if (settings.Value == null) { settings.Value = 1; } 7687 attributes.Add("value", settings.Value.ToString()); 7688 attributes.Add("type", "number"); 7689 7690 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7691 7692 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7693 } 7694 @using Dynamicweb.Rapido.Blocks.Components 7695 7696 @using Dynamicweb.Frontend 7697 @using Dynamicweb.Frontend.Devices 7698 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7699 @using Dynamicweb.Rapido.Blocks.Components.General 7700 @using System.Collections.Generic; 7701 7702 @* Component *@ 7703 7704 @helper RenderCustomerCenterList(CustomerCenterList settings) 7705 { 7706 bool isTouchDevice = Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet" ? true : false; 7707 string hideActions = isTouchDevice ? "u-block" : ""; 7708 7709 <table class="table data-list dw-mod"> 7710 @if (settings.GetHeaders().Length > 0) { 7711 <thead> 7712 <tr class="u-bold"> 7713 @foreach (CustomerCenterListHeaderItem header in settings.GetHeaders()) 7714 { 7715 var attributes = new Dictionary<string, string>(); 7716 if (!string.IsNullOrEmpty(header.Id)) { attributes.Add("id", header.Id); } 7717 if (!string.IsNullOrEmpty(header.CssClass)) { attributes.Add("class", header.CssClass); } 7718 attributes.Add("align", header.Align.ToString()); 7719 attributes = attributes.Concat(header.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7720 7721 <td @ComponentMethods.AddAttributes(attributes)>@header.Title</td> 7722 } 7723 </tr> 7724 </thead> 7725 } 7726 @foreach (CustomerCenterListItem listItem in settings.GetItems()) 7727 { 7728 int columnCount = 0; 7729 int totalColumns = listItem.GetInfoItems().Length; 7730 string rowHasActions = listItem.GetActions().Length > 0 ? "data-list__item--has-actions" : ""; 7731 listItem.Id = !string.IsNullOrEmpty(listItem.Id) ? listItem.Id : Guid.NewGuid().ToString("N"); 7732 7733 var attributes = new Dictionary<string, string>(); 7734 if (!string.IsNullOrEmpty(listItem.Title)) { attributes.Add("title", listItem.Title); }; 7735 7736 attributes = attributes.Concat(listItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7737 <tbody class="data-list__item @rowHasActions @listItem.CssClass dw-mod" @ComponentMethods.AddAttributes(attributes)> 7738 <tr> 7739 @if (!string.IsNullOrEmpty(listItem.Title) || !string.IsNullOrEmpty(listItem.Description)) { 7740 string onClick = !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 7741 7742 <td rowspan="2" @onClick class="data-list__main-item dw-mod"> 7743 @if (!string.IsNullOrEmpty(listItem.Title)) { 7744 <div class="u-bold">@listItem.Title</div> 7745 } 7746 @if (!string.IsNullOrEmpty(listItem.Description)) { 7747 <div>@listItem.Description</div> 7748 } 7749 </td> 7750 } 7751 7752 @foreach (CustomerCenterListInfoItem infoItem in listItem.GetInfoItems()) 7753 { 7754 var infoAttributes = new Dictionary<string, string>(); 7755 if (!string.IsNullOrEmpty(infoItem.Id)) { infoAttributes.Add("id", infoItem.Id); }; 7756 if (!string.IsNullOrEmpty(infoItem.OnClick)) { infoAttributes.Add("onclick", infoItem.OnClick); }; 7757 infoAttributes.Add("align", infoItem.Align.ToString()); 7758 7759 infoAttributes = infoAttributes.Concat(infoItem.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7760 string columnClick = columnCount < (totalColumns-1) && !string.IsNullOrEmpty(listItem.OnClick) ? "onclick=\"" + listItem.OnClick + "\"" : ""; 7761 7762 <td @ComponentMethods.AddAttributes(infoAttributes) @columnClick class="data-list__info-item dw-mod"> 7763 @if (!string.IsNullOrEmpty(infoItem.Title)) { 7764 <div>@infoItem.Title</div> 7765 } 7766 @if (!string.IsNullOrEmpty(infoItem.Subtitle)) { 7767 <div><small>@infoItem.Subtitle</small></div> 7768 } 7769 </td> 7770 7771 columnCount++; 7772 } 7773 </tr> 7774 <tr> 7775 <td colspan="7" align="right" class="u-va-bottom u-no-border"> 7776 <div class="data-list__actions @hideActions dw-mod" id="ActionsMenu_@listItem.Id"> 7777 @foreach (ButtonBase action in listItem.GetActions()) 7778 { 7779 action.ButtonLayout = ButtonLayout.LinkClean; 7780 action.Icon.CssClass += " u-full-height"; 7781 action.CssClass += " data-list__action-button link"; 7782 7783 @Render(action) 7784 } 7785 </div> 7786 </td> 7787 </tr> 7788 </tbody> 7789 } 7790 </table> 7791 } 7792 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7793 7794 @using System 7795 @using System.Web 7796 @using System.Collections.Generic 7797 @using Dynamicweb.Rapido.Blocks.Extensibility 7798 @using Dynamicweb.Rapido.Blocks 7799 7800 @{ 7801 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7802 7803 Block primaryBottomSnippets = new Block() 7804 { 7805 Id = "MasterJavascriptInitializers", 7806 SortId = 100, 7807 Template = RenderPrimaryBottomSnippets() 7808 }; 7809 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7810 7811 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7812 { 7813 Block miniCartPageId = new Block 7814 { 7815 Id = "MiniCartPageId", 7816 Template = RenderMiniCartPageId() 7817 }; 7818 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, miniCartPageId); 7819 } 7820 } 7821 7822 @helper RenderPrimaryBottomSnippets() 7823 { 7824 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7825 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7826 7827 if (isWireframeMode) 7828 { 7829 <script> 7830 Wireframe.Init(true); 7831 </script> 7832 } 7833 7834 7835 if (useGoogleTagManager) 7836 { 7837 <script> 7838 document.addEventListener('addToCart', function(event) { 7839 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7840 if (typeof googleImpression == "string") { 7841 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7842 } 7843 dataLayer.push({ 7844 'event': 'addToCart', 7845 'ecommerce': { 7846 'currencyCode': googleImpression.currency, 7847 'add': { 7848 'products': [{ 7849 'name': googleImpression.name, 7850 'id': googleImpression.id, 7851 'price': googleImpression.price, 7852 'brand': googleImpression.brand, 7853 'category': googleImpression.category, 7854 'variant': googleImpression.variant, 7855 'quantity': event.detail.quantity 7856 }] 7857 } 7858 } 7859 }); 7860 }); 7861 </script> 7862 } 7863 7864 //if digitalwarehouse 7865 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7866 { 7867 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7868 7869 if (string.IsNullOrEmpty(cartContextId)) 7870 { 7871 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7872 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7873 cartContextId = cartSettings.OrderContextID; 7874 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7875 } 7876 7877 <script> 7878 let downloadCart = new DownloadCart({ 7879 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7880 contextId: "@cartContextId", 7881 addButtonText: "@Translate("Add")", 7882 removeButtonText: "@Translate("Remove")" 7883 }); 7884 </script> 7885 } 7886 7887 <!--$$Javascripts--> 7888 } 7889 7890 @helper RenderMiniCartPageId() 7891 { 7892 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 7893 <script> 7894 window.cartId = "@miniCartFeedPageId"; 7895 </script> 7896 } 7897 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7898 7899 @using System 7900 @using System.Web 7901 @using System.Collections.Generic 7902 @using Dynamicweb.Rapido.Blocks 7903 7904 @{ 7905 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 7906 } 7907 7908 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7909 @using Dynamicweb.Core 7910 @using System 7911 @using System.Web 7912 @using System.Collections.Generic 7913 @using Dynamicweb.Rapido.Blocks 7914 7915 @{ 7916 Block blkPageHeadScripts = new Block 7917 { 7918 Id = "WEHPageHeadScripts", 7919 SortId = 0, 7920 Template = RenderWEHPageHeadScripts() 7921 }; 7922 7923 masterCustomBlocksPage.Add("Head", blkPageHeadScripts); 7924 } 7925 7926 @helper RenderWEHPageHeadScripts() 7927 { 7928 var wehDomain = HttpContext.Current.Request.Url.Host.Split('.').Last(); 7929 <!--Cookie Bar: @wehDomain --> 7930 var wehURL = HttpContext.Current.Request.Url; 7931 <!--Cookie Bar: @wehURL --> 7932 7933 if (!HttpContext.Current.Request.Url.ToString().ToLower().Contains("weh.staging.dynamicweb-cms")) 7934 { 7935 switch (wehDomain) 7936 { 7937 case "com": 7938 { 7939 if (!HttpContext.Current.Request.Url.ToString().ToLower().Contains("weh.cloud.dynamicweb-cms")) 7940 { 7941 <!-- Start cookieyes banner - COM --> 7942 <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/15b265794c8ad8f2f1b2f096/script.js"></script> 7943 <!-- End cookieyes banner --> 7944 } 7945 break; 7946 } 7947 case "de": 7948 { 7949 <!-- Start cookieyes banner - DE --> 7950 <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/2dfde73180ae534b7d83f0ae/script.js"></script> 7951 <!-- End cookieyes banner --> 7952 break; 7953 } 7954 case "es": 7955 { 7956 <!-- Start cookieyes banner - ES --> 7957 <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/ad3c46ea57bc5495d6ddc1b1/script.js"></script> 7958 <!-- End cookieyes banner --> 7959 break; 7960 } 7961 case "fr": 7962 { 7963 <!-- Start cookieyes banner - FR --> 7964 <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/5ec030db138ece58d1eec822/script.js"></script> 7965 <!-- End cookieyes banner --> 7966 break; 7967 } 7968 case "it": 7969 { 7970 <!-- Start cookieyes banner - IT --> 7971 <script id="cookieyes" type="text/javascript" src="https://cdn-cookieyes.com/client_data/7afa877129c03d7bfbbb8db7/script.js"></script> 7972 <!-- End cookieyes banner --> 7973 break; 7974 } 7975 default: 7976 { break; } 7977 } 7978 } 7979 } 7980 7981 7982 @functions { 7983 public class ManifestIcon 7984 { 7985 public string src { get; set; } 7986 public string type { get; set; } 7987 public string sizes { get; set; } 7988 } 7989 7990 public class Manifest 7991 { 7992 public string name { get; set; } 7993 public string short_name { get; set; } 7994 public string start_url { get; set; } 7995 public string display { get; set; } 7996 public string background_color { get; set; } 7997 public string theme_color { get; set; } 7998 public List<ManifestIcon> icons { get; set; } 7999 } 8000 } 8001 8002 <!DOCTYPE html> 8003 8004 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 8005 8006 8007 8008 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8009 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 8010 8011 8012 8013 @helper RenderMasterHead() { 8014 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 8015 8016 <head> 8017 <!-- Rapido version 3.4.2 --> 8018 8019 @RenderBlockList(subBlocks) 8020 </head> 8021 } 8022 8023 @helper RenderMasterMetadata() { 8024 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 8025 var brandColors = swatches.GetColorSwatch(1); 8026 string brandColorOne = brandColors.Palette["BrandColor1"]; 8027 8028 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 8029 Manifest manifest = new Manifest 8030 { 8031 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 8032 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"), 8033 start_url = "/", 8034 display = "standalone", 8035 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 8036 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 8037 }; 8038 8039 manifest.icons = new List<ManifestIcon> { 8040 new ManifestIcon { 8041 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8042 sizes = "192x192", 8043 type = "image/png" 8044 }, 8045 new ManifestIcon { 8046 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8047 sizes = "512x512", 8048 type = "image/png" 8049 }, 8050 new ManifestIcon { 8051 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 8052 sizes = "1024x1024", 8053 type = "image/png" 8054 } 8055 }; 8056 8057 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 8058 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 8059 string currentManifest = File.ReadAllText(manifestFilePath); 8060 8061 if (manifestJSON != currentManifest) 8062 { 8063 File.WriteAllText(manifestFilePath, manifestJSON); 8064 } 8065 } 8066 8067 <meta charset="utf-8" /> 8068 <title>@Model.Title</title> 8069 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8070 <meta name="robots" content="index, follow"> 8071 <meta name="theme-color" content="@brandColorOne" /> 8072 8073 if (Model.MetaTags != null && !Model.MetaTags.Contains("og:image") && Model.PropertyItem != null && Model.PropertyItem.GetFile("OpenGraphImage") != null) 8074 { 8075 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"))); 8076 } 8077 8078 if (!Model.MetaTags.Contains("og:description") && !string.IsNullOrEmpty(Model.Description)) 8079 { 8080 Pageview.Meta.AddTag("og:description", Model.Description); 8081 } 8082 8083 Pageview.Meta.AddTag("og:title", Model.Title); 8084 Pageview.Meta.AddTag("og:site_name", Model.Name); 8085 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 8086 Pageview.Meta.AddTag("og:type", "Website"); 8087 8088 if (!string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("FacebookAppID"))) { 8089 Pageview.Meta.AddTag("fb:app_id", Model.Area.Item.GetItem("Settings").GetString("FacebookAppID")); 8090 } 8091 8092 @Model.MetaTags 8093 } 8094 8095 @helper RenderMasterCss() { 8096 var fonts = new string[] { 8097 getFontFamily("Layout", "HeaderFont"), 8098 getFontFamily("Layout", "SubheaderFont"), 8099 getFontFamily("Layout", "TertiaryHeaderFont"), 8100 getFontFamily("Layout", "BodyText"), 8101 getFontFamily("Layout", "Header", "ToolsFont"), 8102 getFontFamily("Layout", "Header", "NavigationFont"), 8103 getFontFamily("Layout", "MobileNavigation", "Font"), 8104 getFontFamily("ProductList", "Facets", "HeaderFont"), 8105 getFontFamily("ProductPage", "PriceFontDesign"), 8106 getFontFamily("Ecommerce", "SaleSticker", "Font"), 8107 getFontFamily("Ecommerce", "NewSticker", "Font"), 8108 getFontFamily("Ecommerce", "CustomSticker", "Font") 8109 }; 8110 8111 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 8112 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 8113 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 8114 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 8115 if (useFontAwesomePro) 8116 { 8117 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 8118 } 8119 8120 //Favicon 8121 <link href="@favicon" rel="icon" type="image/png"> 8122 8123 //Base (Default, wireframe) styles 8124 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 8125 8126 //Rapido Css from Website Settings 8127 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 8128 8129 //Ignite Css (Custom site specific styles) 8130 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 8131 8132 //Font awesome 8133 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 8134 8135 //Flag icon 8136 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 8137 8138 //Google fonts 8139 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))); 8140 8141 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 8142 8143 PushPromise(favicon); 8144 PushPromise(fontAwesomeCssLink); 8145 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 8146 PushPromise(autoCssLink); 8147 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 8148 PushPromise("/Files/Images/placeholder.gif"); 8149 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 8150 } 8151 8152 @helper RenderMasterManifest() { 8153 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 8154 { 8155 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 8156 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 8157 } 8158 } 8159 8160 @helper RenderMasterBody() { 8161 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 8162 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 8163 if (!String.IsNullOrEmpty(designLayout)) { 8164 designLayout = "class=\"" + designLayout + "\""; 8165 } 8166 8167 <body @designLayout> 8168 @RenderBlockList(subBlocks) 8169 </body> 8170 } 8171 8172 @helper RenderMasterHeader() 8173 { 8174 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 8175 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8176 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 8177 8178 <header class="top-container @stickyTop no-print dw-mod" id="Top"> 8179 @RenderBlockList(subBlocks) 8180 </header> 8181 } 8182 8183 @helper RenderMain() 8184 { 8185 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 8186 8187 <main class="site dw-mod"> 8188 @RenderBlockList(subBlocks) 8189 </main> 8190 } 8191 8192 @helper RenderPageContent() 8193 { 8194 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8195 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 8196 8197 <div id="Page" class="page @pagePos"> 8198 <div id="content"> 8199 @RenderSnippet("Content") 8200 </div> 8201 </div> 8202 } 8203 8204 @* Hack to support nested helpers *@ 8205 @SnippetStart("Content") 8206 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8207 8208 8209 8210 @* Render the grid *@ 8211 @Model.Grid("Grid", "Grid", "default:true;sort:1", "Pages") 8212 8213 @SnippetEnd("Content") 8214 8215 @helper RenderIosTabletFix() { 8216 if (Pageview.Device != Dynamicweb.Frontend.Devices.DeviceType.Tablet && Pageview.Platform != Dynamicweb.Frontend.Devices.PlatformType.Ios) 8217 { 8218 <script> 8219 let isIpadIOS = (/iPad/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream; 8220 if (isIpadIOS) { 8221 var separator = (window.location.href.indexOf("?") === -1) ? "?" : "&"; 8222 window.location.href = window.location.href + separator + "DeviceType=Tablet&PlatformType=Ios"; 8223 } 8224 </script> 8225 } 8226 } 8227 8228 </html> 8229 8230