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