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_28e02ee294be46e596a13c8fa5675732.<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 7895
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.<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 7840
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.<>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_28e02ee294be46e596a13c8fa5675732.Execute() in D:\dynamicweb.net\Solutions\TCOG\pronails.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7830
   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"> 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 <script id="ImpersonationSearchResult" type="text/x-template"> 5897 {{#.}} 5898 {{#Users}} 5899 <li class="impersonation__search-results-item impersonation-user"> 5900 <form method="post" class="impersonation-user__form" name="account{{id}}"> 5901 <input type="hidden" id="DWExtranetSecondaryUserSelector" name="DWExtranetSecondaryUserSelector" value="{{id}}"> 5902 <div class="impersonation-user__info"> 5903 <div class="impersonation-user__name">{{userName}}</div> 5904 <div class="impersonation-user__number">{{customerNumber}}</div> 5905 </div> 5906 @Render(new Button 5907 { 5908 ButtonType = ButtonType.Submit, 5909 ButtonLayout = ButtonLayout.Secondary, 5910 Title = Translate("Sign in as"), 5911 CssClass = "impersonation-user__sign-in-btn" + (impersonationLayout != "bar" ? " btn--impersonation" : "") 5912 }) 5913 </form> 5914 </li> 5915 {{/Users}} 5916 {{#unless Users}} 5917 <li class="impersonation__search-results-item impersonation__search-results-item--not-found"> 5918 @Translate("Your search gave 0 results") 5919 </li> 5920 {{/unless}} 5921 {{/.}} 5922 </script> 5923 } 5924 5925 @helper RenderSearchScripts() 5926 { 5927 <script> 5928 let inputDelayTimer; 5929 function searchKeyUpHandler(e) { 5930 clearTimeout(inputDelayTimer); 5931 let value = e.target.value; 5932 if (value != "") { 5933 inputDelayTimer = setTimeout(function () { 5934 updateResults(value); 5935 }, 500); 5936 } else { 5937 clearResults(); 5938 } 5939 }; 5940 5941 function updateResults(value) { 5942 if (value == "") { 5943 return null; 5944 } 5945 HandlebarsBolt.UpdateContent("ImpersonationBoxSearchResults", "/Default.aspx?ID=@impersonationFeed&q=" + value); 5946 document.getElementById("ImpersonationBoxSearchFind").classList.add("u-hidden"); 5947 document.getElementById("ImpersonationBoxSearchClear").classList.remove("u-hidden"); 5948 } 5949 5950 function clearResults() { 5951 document.getElementById("ImpersonationBoxSearchField").value = ""; 5952 HandlebarsBolt.CleanContainer("ImpersonationBoxSearchResults"); 5953 document.getElementById("ImpersonationBoxSearchFind").classList.remove("u-hidden"); 5954 document.getElementById("ImpersonationBoxSearchClear").classList.add("u-hidden"); 5955 } 5956 </script> 5957 } 5958 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5959 5960 @using System 5961 @using System.Web 5962 @using System.Collections.Generic 5963 @using Dynamicweb.Rapido.Blocks.Extensibility 5964 @using Dynamicweb.Rapido.Blocks 5965 5966 @{ 5967 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 5968 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 5969 5970 Block orderLines = new Block 5971 { 5972 Id = "MiniCartOrderLines", 5973 SkipRenderBlocksList = true, 5974 BlocksList = new List<Block> 5975 { 5976 new Block { 5977 Id = "MiniCartOrderLinesList", 5978 SortId = 20, 5979 Template = RenderMiniCartOrderLinesList() 5980 } 5981 } 5982 }; 5983 5984 Block orderlinesScriptTemplates = new Block 5985 { 5986 Id = "OrderlinesScriptTemplates" 5987 }; 5988 5989 if (orderlinesView == "table") 5990 { 5991 orderLines.Template = RenderMiniCartOrderLinesTable(); 5992 orderLines.BlocksList.Add( 5993 new Block 5994 { 5995 Id = "MiniCartOrderlinesTableHeader", 5996 SortId = 10, 5997 Template = RenderMiniCartOrderLinesHeader() 5998 } 5999 ); 6000 6001 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 6002 } 6003 else 6004 { 6005 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 6006 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 6007 } 6008 6009 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 6010 6011 Block miniCartScriptTemplates = new Block() 6012 { 6013 Id = "MasterMiniCartTemplates", 6014 SortId = 1, 6015 Template = RenderMiniCartScriptTemplates(), 6016 SkipRenderBlocksList = true, 6017 BlocksList = new List<Block> 6018 { 6019 orderLines, 6020 new Block { 6021 Id = "MiniCartFooter", 6022 Template = RenderMiniCartFooter(), 6023 SortId = 50, 6024 SkipRenderBlocksList = true, 6025 BlocksList = new List<Block> 6026 { 6027 new Block { 6028 Id = "MiniCartSubTotal", 6029 Template = RenderMiniCartSubTotal(), 6030 SortId = 30 6031 }, 6032 new Block { 6033 Id = "MiniCartFees", 6034 Template = RenderMiniCartFees(), 6035 SortId = 40 6036 }, 6037 new Block { 6038 Id = "MiniCartPoints", 6039 Template = RenderMiniCartPoints(), 6040 SortId = 50 6041 }, 6042 new Block { 6043 Id = "MiniCartTotal", 6044 Template = RenderMiniCartTotal(), 6045 SortId = 60 6046 }, 6047 new Block { 6048 Id = "MiniCartDisclaimer", 6049 Template = RenderMiniCartDisclaimer(), 6050 SortId = 70 6051 }, 6052 new Block { 6053 Id = "MiniCartActions", 6054 Template = RenderMiniCartActions(), 6055 SortId = 80 6056 } 6057 } 6058 } 6059 } 6060 }; 6061 6062 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 6063 } 6064 6065 @helper RenderMiniCartScriptsTableTemplates() 6066 { 6067 <script id="MiniCartOrderline" type="text/x-template"> 6068 {{#unless isEmpty}} 6069 <tr> 6070 <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> 6071 <td class="u-va-middle"> 6072 <a href="{{link}}" class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 6073 {{#if variantname}} 6074 <a href="{{link}}" class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 6075 {{/if}} 6076 {{#if unitname}} 6077 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 6078 {{/if}} 6079 </td> 6080 <td class="u-ta-right u-va-middle">{{quantity}}</td> 6081 <td class="u-ta-right u-va-middle"> 6082 {{#if pointsTotal}} 6083 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6084 {{else}} 6085 {{totalprice}} 6086 {{/if}} 6087 </td> 6088 </tr> 6089 {{/unless}} 6090 </script> 6091 6092 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6093 {{#unless isEmpty}} 6094 <tr class="table__row--no-border"> 6095 <td class="u-w60px">&nbsp;</td> 6096 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 6097 <td class="u-ta-right">&nbsp;</td> 6098 <td class="u-ta-right">{{totalprice}}</td> 6099 </tr> 6100 {{/unless}} 6101 </script> 6102 } 6103 6104 @helper RenderMiniCartScriptsListTemplates() 6105 { 6106 int cartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6107 6108 <script id="MiniCartOrderline" type="text/x-template"> 6109 {{#unless isEmpty}} 6110 <div class="mini-cart-orderline grid dw-mod"> 6111 <div class="grid__col-4"> 6112 <a href="{{link}}" class="{{hideimage}}"> 6113 <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}}"> 6114 </a> 6115 </div> 6116 <div class="grid__col-8"> 6117 <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> 6118 {{#if variantname}} 6119 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 6120 {{/if}} 6121 {{#if unitname}} 6122 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 6123 {{/if}} 6124 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 6125 6126 <div class="grid__cell-footer"> 6127 <div class="grid__cell"> 6128 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 6129 {{#if pointsTotal}} 6130 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 6131 {{else}} 6132 {{totalprice}} 6133 {{/if}} 6134 </div> 6135 <button type="button" 6136 title="@Translate("Remove orderline")" 6137 class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" 6138 onclick="{{#if googleImpression}}googleImpressionRemoveFromCart({{googleImpression}});{{/if}}Cart.UpdateCart('miniCartContent', '/Default.aspx?ID=@cartFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&redirect=false', true);">@Translate("Remove")</button> 6139 </div> 6140 </div> 6141 </div> 6142 </div> 6143 {{/unless}} 6144 </script> 6145 6146 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 6147 {{#unless isEmpty}} 6148 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 6149 <div class="grid__col-4"> 6150 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 6151 </div> 6152 <div class="grid__col-8">{{totalprice}}</div> 6153 </div> 6154 {{/unless}} 6155 </script> 6156 } 6157 6158 @helper RenderMiniCartScriptTemplates() 6159 { 6160 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 6161 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6162 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 6163 bool miniCartUseGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 6164 6165 <script id="MiniCartContent" type="text/x-template"> 6166 {{#.}} 6167 {{#unless isEmpty}} 6168 @if (miniCartUseGoogleTagManager) 6169 { 6170 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 6171 } 6172 @RenderBlockList(subBlocks) 6173 {{/unless}} 6174 {{/.}} 6175 </script> 6176 } 6177 6178 @helper RenderMiniCartOrderLinesTable() 6179 { 6180 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6181 6182 <div class="u-overflow-auto"> 6183 <table class="table mini-cart-table dw-mod"> 6184 @RenderBlockList(subBlocks) 6185 </table> 6186 </div> 6187 } 6188 6189 @helper RenderMiniCartOrderLinesBlocks() 6190 { 6191 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 6192 6193 <div class="u-overflow-auto"> 6194 @RenderBlockList(subBlocks) 6195 </div> 6196 } 6197 6198 @helper RenderMiniCartOrderLinesHeader() 6199 { 6200 <thead> 6201 <tr> 6202 <td>&nbsp;</td> 6203 <td>@Translate("Product")</td> 6204 <td class="u-ta-right">@Translate("Qty")</td> 6205 <td class="u-ta-right" width="120">@Translate("Price")</td> 6206 </tr> 6207 </thead> 6208 } 6209 6210 @helper RenderMiniCartOrderLinesList() 6211 { 6212 <text> 6213 {{#OrderLines}} 6214 {{#ifCond template "===" "CartOrderline"}} 6215 {{>MiniCartOrderline}} 6216 {{/ifCond}} 6217 {{#ifCond template "===" "CartOrderlineMobile"}} 6218 {{>MiniCartOrderline}} 6219 {{/ifCond}} 6220 {{#ifCond template "===" "CartOrderlineDiscount"}} 6221 {{>MiniCartOrderlineDiscount}} 6222 {{/ifCond}} 6223 {{/OrderLines}} 6224 </text> 6225 } 6226 6227 @helper RenderMiniCartFees() 6228 { 6229 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6230 if (!pointShop) 6231 { 6232 <text> 6233 {{#unless hidePaymentfee}} 6234 <div class="grid"> 6235 <div class="grid__col-6 grid__col--bleed-y"> 6236 {{paymentmethod}} 6237 </div> 6238 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{paymentfee}}</div> 6239 </div> 6240 {{/unless}} 6241 </text> 6242 } 6243 <text> 6244 {{#unless hideShippingfee}} 6245 <div class="grid"> 6246 <div class="grid__col-6 grid__col--bleed-y"> 6247 {{shippingmethod}} 6248 </div> 6249 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{shippingfee}}</div> 6250 </div> 6251 {{/unless}} 6252 </text> 6253 <text> 6254 {{#if hasTaxSettings}} 6255 <div class="grid"> 6256 <div class="grid__col-6 grid__col--bleed-y">@Translate("Sales Tax")</div> 6257 <div class="grid__col-6 grid__col--bleed-y grid--align-end">{{totaltaxes}}</div> 6258 </div> 6259 {{/if}} 6260 </text> 6261 } 6262 6263 @helper RenderMiniCartFooter() 6264 { 6265 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 6266 6267 <div class="mini-cart__footer u-border-top u-padding-top dw-mod"> 6268 @RenderBlockList(subBlocks) 6269 </div> 6270 } 6271 6272 @helper RenderMiniCartActions() 6273 { 6274 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6275 6276 <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> 6277 <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> 6278 } 6279 6280 @helper RenderMiniCartPoints() 6281 { 6282 <text> 6283 {{#if earnings}} 6284 <div class="grid"> 6285 <div class="grid__col-6 grid__col--bleed-y">@Translate("Earnings")</div> 6286 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6287 <div> 6288 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 6289 </div> 6290 </div> 6291 </div> 6292 {{/if}} 6293 </text> 6294 } 6295 6296 @helper RenderMiniCartSubTotal() 6297 { 6298 bool hasTaxSettings = Dynamicweb.Rapido.Services.Countries.HasTaxSettings(Model.Cart.ID); 6299 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6300 if (!pointShop) 6301 { 6302 <text> 6303 {{#unless hideSubTotal}} 6304 <div class="grid dw-mod u-bold"> 6305 <div class="grid__col-6 grid__col--bleed-y">@Translate("Subtotal")</div> 6306 <div class="grid__col-6 grid__col--bleed-y grid--align-end"> 6307 @if (hasTaxSettings) 6308 { 6309 <text>{{subtotalpricewithouttaxes}}</text> 6310 } 6311 else 6312 { 6313 <text>{{subtotalprice}}</text> 6314 } 6315 </div> 6316 </div> 6317 {{/unless}} 6318 </text> 6319 } 6320 } 6321 6322 @helper RenderMiniCartTotal() 6323 { 6324 bool pointShop = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6325 6326 <div class="mini-cart-totals grid u-border-top u-margin-top dw-mod"> 6327 <div class="grid__col-6">@Translate("Total")</div> 6328 <div class="grid__col-6 grid--align-end"> 6329 <div> 6330 @if (pointShop) 6331 { 6332 <span class="u-color--loyalty-points">{{pointsUsedInCart}}</span> @Translate("points") 6333 } 6334 else 6335 { 6336 <text>{{totalprice}}</text> 6337 } 6338 </div> 6339 </div> 6340 </div> 6341 } 6342 6343 @helper RenderMiniCartDisclaimer() 6344 { 6345 <text> 6346 {{#if showCheckoutDisclaimer}} 6347 <div class="grid u-margin-bottom u-ta-right"> 6348 <small class="grid__col-12">{{checkoutDisclaimer}}</small> 6349 </div> 6350 {{/if}} 6351 </text> 6352 } 6353 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6354 6355 @using Dynamicweb.Rapido.Blocks.Extensibility 6356 @using Dynamicweb.Rapido.Blocks 6357 @using Dynamicweb.Rapido.Blocks.Components.General 6358 @using Dynamicweb.Rapido.Blocks.Components 6359 @using Dynamicweb.Rapido.Services 6360 6361 @{ 6362 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 6363 string addToCartNotificationMiniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 6364 bool addToCartHideCartIcon = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 6365 6366 if (Dynamicweb.Rapido.Services.User.IsBuyingAllowed() && !string.IsNullOrEmpty(addToCartNotificationType)) 6367 { 6368 if (addToCartNotificationType == "modal") 6369 { 6370 Block addToCartNotificationModal = new Block 6371 { 6372 Id = "AddToCartNotificationModal", 6373 Template = RenderAddToCartNotificationModal() 6374 }; 6375 6376 Block addToCartNotificationScript = new Block 6377 { 6378 Id = "AddToCartNotificationScript", 6379 Template = RenderAddToCartNotificationModalScript() 6380 }; 6381 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 6382 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6383 } 6384 else if (addToCartNotificationType == "toggle" && addToCartNotificationMiniCartLayout != "none" && !addToCartHideCartIcon && Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 6385 { 6386 Block addToCartNotificationScript = new Block 6387 { 6388 Id = "AddToCartNotificationScript", 6389 Template = RenderAddToCartNotificationToggleScript() 6390 }; 6391 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 6392 } 6393 } 6394 } 6395 6396 @helper RenderAddToCartNotificationModal() 6397 { 6398 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 6399 } 6400 6401 @helper RenderAddToCartNotificationModalScript() 6402 { 6403 int cartPageId = GetPageIdByNavigationTag("CartPage"); 6404 6405 <script id="LastAddedProductTemplate" type="text/x-template"> 6406 @{ 6407 6408 Modal lastAddedProduct = new Modal 6409 { 6410 Id = "LastAddedProduct", 6411 Heading = new Heading 6412 { 6413 Level = 2, 6414 Title = Translate("Product is added to the cart") 6415 }, 6416 Width = ModalWidth.Md, 6417 BodyTemplate = RenderModalContent() 6418 }; 6419 6420 lastAddedProduct.AddActions( 6421 new Button 6422 { 6423 ButtonType = ButtonType.Button, 6424 ButtonLayout = ButtonLayout.Secondary, 6425 Title = Translate("Continue shopping"), 6426 CssClass = "u-pull--left u-no-margin btn--sm", 6427 OnClick = "document.getElementById('LastAddedProductModalTrigger').checked = false" 6428 }, 6429 new Link 6430 { 6431 Href = "/Default.aspx?ID=" + cartPageId, 6432 ButtonLayout = ButtonLayout.Secondary, 6433 CssClass = "u-pull--right u-no-margin btn--sm", 6434 Title = Translate("Proceed to checkout") 6435 } 6436 ); 6437 6438 @Render(lastAddedProduct) 6439 } 6440 </script> 6441 <script> 6442 document.addEventListener('addToCart', function (event) { 6443 Cart.ShowLastAddedProductModal(event.detail); 6444 }); 6445 </script> 6446 } 6447 6448 @helper RenderModalContent() 6449 { 6450 <div class="grid"> 6451 <div class="grid__col-2"> 6452 @Render(new Image { Path = "{{ productInfo.image }}", Link = "{{ productInfo.link }}", Title = "{{ productInfo.name }}", DisableImageEngine = true }) 6453 </div> 6454 <div class="u-padding grid--align-self-center"> 6455 <span>{{quantity}}</span> x 6456 </div> 6457 <div class="grid__col-auto grid--align-self-center"> 6458 <div>{{productInfo.name}}</div> 6459 {{#if productInfo.variantName}} 6460 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 6461 {{/if}} 6462 {{#if productInfo.unitName}} 6463 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 6464 {{/if}} 6465 </div> 6466 </div> 6467 } 6468 6469 @helper RenderAddToCartNotificationToggleScript() 6470 { 6471 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 6472 6473 <script> 6474 document.addEventListener('addToCart', function () { 6475 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 6476 }); 6477 </script> 6478 } 6479 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6480 6481 @using System 6482 @using System.Web 6483 @using System.Collections.Generic 6484 @using Dynamicweb.Rapido.Blocks.Extensibility 6485 @using Dynamicweb.Rapido.Blocks 6486 @using Dynamicweb.Rapido.Blocks.Components.General 6487 6488 @functions { 6489 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 6490 } 6491 6492 @{ 6493 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 6494 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 6495 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 6496 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 6497 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 6498 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 6499 6500 Block masterFooterContent = new Block() 6501 { 6502 Id = "MasterFooterContent", 6503 SortId = 10, 6504 Template = RenderFooter(), 6505 SkipRenderBlocksList = true 6506 }; 6507 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 6508 6509 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 6510 { 6511 Block masterFooterColumnOne = new Block 6512 { 6513 Id = "MasterFooterColumnOne", 6514 SortId = 10, 6515 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 6516 Design = new Design 6517 { 6518 Size = "auto", 6519 RenderType = RenderType.Column 6520 } 6521 }; 6522 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 6523 } 6524 6525 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 6526 { 6527 Block masterFooterColumnTwo = new Block 6528 { 6529 Id = "MasterFooterColumnTwo", 6530 SortId = 20, 6531 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 6532 Design = new Design 6533 { 6534 Size = "auto", 6535 RenderType = RenderType.Column 6536 } 6537 }; 6538 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 6539 } 6540 6541 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 6542 { 6543 Block masterFooterColumnThree = new Block 6544 { 6545 Id = "MasterFooterColumnThree", 6546 SortId = 30, 6547 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 6548 Design = new Design 6549 { 6550 Size = "auto", 6551 RenderType = RenderType.Column 6552 } 6553 }; 6554 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 6555 } 6556 6557 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 6558 { 6559 Block masterFooterNewsletterSignUp = new Block 6560 { 6561 Id = "MasterFooterNewsletterSignUp", 6562 SortId = 40, 6563 Template = RenderFooterNewsletterSignUp(), 6564 Design = new Design 6565 { 6566 Size = "auto", 6567 RenderType = RenderType.Column 6568 } 6569 }; 6570 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 6571 } 6572 6573 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 6574 { 6575 Block masterFooterSocialLinks = new Block 6576 { 6577 Id = "MasterFooterSocialLinks", 6578 SortId = 50, 6579 Template = RenderFooterSocialLinks(), 6580 Design = new Design 6581 { 6582 Size = "auto", 6583 RenderType = RenderType.Row 6584 } 6585 }; 6586 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 6587 } 6588 6589 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 6590 { 6591 Block masterFooterPayments = new Block 6592 { 6593 Id = "MasterFooterPayments", 6594 SortId = 60, 6595 Template = RenderFooterPayments(), 6596 Design = new Design 6597 { 6598 Size = "12", 6599 RenderType = RenderType.Column 6600 } 6601 }; 6602 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 6603 } 6604 6605 Block masterFooterCopyright = new Block 6606 { 6607 Id = "MasterFooterCopyright", 6608 SortId = 70, 6609 Template = RenderFooterCopyright(), 6610 Design = new Design 6611 { 6612 Size = "12", 6613 RenderType = RenderType.Column 6614 } 6615 }; 6616 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 6617 } 6618 6619 @helper RenderFooter() 6620 { 6621 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 6622 6623 <footer class="footer dw-mod"> 6624 <div class="center-container top-container__center-container dw-mod"> 6625 <div class="grid grid--external-bleed-x"> 6626 @RenderBlockList(subBlocks) 6627 </div> 6628 </div> 6629 </footer> 6630 } 6631 6632 @helper RenderFooterColumn(string header, string content) 6633 { 6634 <h3 class="footer__heading dw-mod">@header</h3> 6635 <div class="footer__content dw-mod"> 6636 @content 6637 </div> 6638 } 6639 6640 @helper RenderFooterNewsletterSignUp() 6641 { 6642 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 6643 Form form = new Form { Action = "/Default.aspx", Method = FormMethod.Get, Enctype = FormEnctype.multipart }; 6644 6645 form.Add(new HiddenField { Name = "ID", Value = newsletterSignUpPageId }); 6646 form.Add(new Text { Content = "<p>" + Translate("Sign up if you would like to receive occasional treats from us") + "</p>" }); 6647 form.Add(new TextField { 6648 Id = "NewsletterEmail", Name = "NewsletterEmail", Placeholder = Translate("Your email address"), 6649 Type = TextFieldType.Email, 6650 ActionButton = new Button { 6651 ButtonType = ButtonType.Submit, Id="Submitter", Title = Translate("Go"), OnClick = "Buttons.LockButton(event)", CssClass = "btn--condensed" 6652 } 6653 }); 6654 6655 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 6656 <div class="footer__content dw-mod"> 6657 @Render(form) 6658 </div> 6659 } 6660 6661 @helper RenderFooterSocialLinks() 6662 { 6663 <h3 class="footer__heading dw-mod">@Translate("Social links")</h3> 6664 <div class="footer__content dw-mod"> 6665 <div class="collection dw-mod"> 6666 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 6667 { 6668 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 6669 string socialIconClass = socialIcon.SelectedValue; 6670 string socialIconTitle = socialIcon.SelectedName; 6671 string socialLink = socialitem.GetString("Link"); 6672 6673 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 6674 } 6675 </div> 6676 </div> 6677 } 6678 6679 @helper RenderFooterPayments() 6680 { 6681 <div class="footer__content dw-mod"> 6682 <div class="collection dw-mod"> 6683 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 6684 { 6685 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 6686 string paymentImage = null; 6687 string paymentTitle = paymentItem.SelectedName; 6688 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 6689 if (selected != null) 6690 { 6691 paymentImage = selected.Icon; 6692 } 6693 6694 <div class="footer__card-type"> 6695 <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" /> 6696 </div> 6697 } 6698 </div> 6699 </div> 6700 } 6701 6702 @helper RenderFooterCopyright() 6703 { 6704 <div class="grid__col-12 footer__copyright dw-mod"> 6705 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 6706 </div> 6707 } 6708 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 6709 6710 @using System 6711 @using System.Web 6712 @using System.Collections.Generic 6713 @using Dynamicweb.Rapido.Blocks.Extensibility 6714 @using Dynamicweb.Rapido.Blocks 6715 @using Dynamicweb.Ecommerce.Common 6716 6717 @{ 6718 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 6719 6720 Block masterScriptReferences = new Block() 6721 { 6722 Id = "MasterScriptReferences", 6723 SortId = 1, 6724 Template = RenderMasterScriptReferences() 6725 }; 6726 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 6727 } 6728 6729 @helper RenderMasterScriptReferences() { 6730 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 6731 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 6732 6733 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 6734 { 6735 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 6736 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 6737 } 6738 6739 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 6740 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 6741 } 6742 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6743 6744 @using System 6745 @using System.Web 6746 @using System.Collections.Generic 6747 @using Dynamicweb.Rapido.Blocks.Extensibility 6748 @using Dynamicweb.Rapido.Blocks 6749 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6750 @using Dynamicweb.Rapido.Services 6751 6752 @{ 6753 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 6754 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 6755 bool isFavoriteList = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("ListID")); 6756 6757 if (!navigationItemsHideSearch || isFavoriteList) 6758 { 6759 Block masterSearchScriptTemplates = new Block() 6760 { 6761 Id = "MasterSearchScriptTemplates", 6762 SortId = 1, 6763 Template = RenderSearchScriptTemplates() 6764 }; 6765 6766 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 6767 } 6768 } 6769 6770 @helper RenderSearchScriptTemplates() 6771 { 6772 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 6773 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 6774 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 6775 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 6776 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 6777 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 6778 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 6779 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 6780 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 6781 6782 <script id="SearchGroupsTemplate" type="text/x-template"> 6783 {{#.}} 6784 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 6785 {{/.}} 6786 </script> 6787 6788 <script id="SearchProductsTemplate" type="text/x-template"> 6789 {{#each .}} 6790 {{#Product}} 6791 {{#ifCond template "!==" "SearchMore"}} 6792 <li class="dropdown__item dropdown__item--seperator dw-mod"> 6793 @if (useFacebookPixel) 6794 { 6795 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 6796 } 6797 @if (useGoogleTagManager) 6798 { 6799 <text>{{{googleEnchantImpression googleImpression}}}</text> 6800 } 6801 <div> 6802 <a href="{{link}}" 6803 class="js-typeahead-link u-color-inherit u-pull--left" 6804 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 6805 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 6806 <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> 6807 <div class="u-pull--left"> 6808 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 6809 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 6810 { 6811 if (pointShopOnly) 6812 { 6813 <text> 6814 {{#if havePointPrice}} 6815 <div> 6816 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 6817 </div> 6818 {{else}} 6819 <small class="help-text u-no-margin">@Translate("Not available")</small> 6820 {{/if}} 6821 {{#unless canBePurchasedWithPoints}} 6822 {{#if havePointPrice}} 6823 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 6824 {{/if}} 6825 {{/unless}} 6826 </text> 6827 } 6828 else 6829 { 6830 <div>{{price}}</div> 6831 } 6832 } 6833 </div> 6834 </a> 6835 <div class="u-margin-left u-pull--right"> 6836 @{ 6837 var viewBtn = new Link 6838 { 6839 Href = "{{link}}", 6840 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 6841 ButtonLayout = ButtonLayout.Secondary, 6842 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 6843 Title = Translate("View") 6844 }; 6845 } 6846 {{#unless isTraining}} 6847 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 6848 { 6849 <text>{{#if hideAddToCartButton}}</text> 6850 @Render(viewBtn) 6851 <text>{{else}}</text> 6852 @Render(new AddToCartButton 6853 { 6854 HideTitle = true, 6855 ProductId = "{{productId}}", 6856 ProductInfo = "{{productInfo}}", 6857 BuyForPoints = pointShopOnly, 6858 OnClick = "{{facebookPixelAction}}", 6859 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 6860 Icon = new Icon { 6861 CssClass = "js-ignore-click-outside" 6862 }, 6863 ExtraAttributes = new Dictionary<string, string> 6864 { 6865 { "{{disabledBuyButton}}", "" } 6866 } 6867 }) 6868 <text>{{/if}}</text> 6869 } 6870 else if (showViewButton) 6871 { 6872 @Render(viewBtn) 6873 } 6874 @if (showAddToDownloadButton) 6875 { 6876 <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}}"> 6877 <i class="fas fa-plus js-button-icon"></i> 6878 </button> 6879 } 6880 {{else}} 6881 <a href="{{link}}" class="btn btn--primary dw-mod">@Translate("Sign-up")</a> 6882 {{/unless}} 6883 </div> 6884 </div> 6885 </li> 6886 {{/ifCond}} 6887 {{#ifCond template "===" "SearchMore"}} 6888 {{>SearchMoreProducts}} 6889 {{/ifCond}} 6890 {{/Product}} 6891 {{else}} 6892 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 6893 @Translate("Your search gave 0 results") 6894 </li> 6895 {{/each}} 6896 </script> 6897 6898 <script id="SearchMoreProducts" type="text/x-template"> 6899 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 6900 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6901 @Translate("View all") 6902 </a> 6903 </li> 6904 </script> 6905 6906 <script id="SearchMorePages" type="text/x-template"> 6907 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 6908 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 6909 @Translate("View all") 6910 </a> 6911 </li> 6912 </script> 6913 6914 <script id="SearchPagesTemplate" type="text/x-template"> 6915 {{#each .}} 6916 {{#ifCond template "!==" "SearchMore"}} 6917 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 6918 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 6919 <div class="u-margin-right"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 6920 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 6921 </a> 6922 </li> 6923 {{/ifCond}} 6924 {{#ifCond template "===" "SearchMore"}} 6925 {{>SearchMorePages}} 6926 {{/ifCond}} 6927 {{else}} 6928 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 6929 @Translate("Your search gave 0 results") 6930 </li> 6931 {{/each}} 6932 </script> 6933 6934 <script id="SearchPagesTemplateWrap" type="text/x-template"> 6935 <div class="dropdown__column-header">@Translate("Pages")</div> 6936 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 6937 {{>SearchPagesTemplate}} 6938 </ul> 6939 </script> 6940 6941 <script id="SearchProductsTemplateWrap" type="text/x-template"> 6942 <div class="dropdown__column-header">@Translate("Products")</div> 6943 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 6944 {{>SearchProductsTemplate}} 6945 </ul> 6946 </script> 6947 } 6948 6949 @using Dynamicweb.Rapido.Blocks.Components 6950 @using Dynamicweb.Rapido.Blocks.Components.General 6951 @using Dynamicweb.Rapido.Blocks 6952 @using System.IO 6953 6954 6955 @using Dynamicweb.Rapido.Blocks.Components.General 6956 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 6957 6958 6959 @* Component *@ 6960 6961 @helper RenderVariantMatrix(VariantMatrix settings) { 6962 if (settings != null) 6963 { 6964 int productLoopCounter = 0; 6965 int groupCount = 0; 6966 List<VariantOption> firstDimension = new List<VariantOption>(); 6967 List<VariantOption> secondDimension = new List<VariantOption>(); 6968 List<VariantOption> thirdDimension = new List<VariantOption>(); 6969 6970 foreach (VariantGroup variantGroup in settings.GetVariantGroups()) 6971 { 6972 foreach (VariantOption variantOptions in variantGroup.GetVariantOptions()) 6973 { 6974 if (groupCount == 0) { 6975 firstDimension.Add(variantOptions); 6976 } 6977 if (groupCount == 1) 6978 { 6979 secondDimension.Add(variantOptions); 6980 } 6981 if (groupCount == 2) 6982 { 6983 thirdDimension.Add(variantOptions); 6984 } 6985 } 6986 groupCount++; 6987 } 6988 6989 int rowCount = 0; 6990 int columnCount = 0; 6991 6992 <script> 6993 var variantsCollection = []; 6994 </script> 6995 6996 <table class="table table--compact js-variants-matrix dw-mod" id="VariantMatrixTable_@settings.ProductId"> 6997 @if (groupCount == 1) 6998 { 6999 <tbody> 7000 @foreach (VariantOption firstVariantOption in firstDimension) 7001 { 7002 var variantId = firstVariantOption.Id; 7003 <tr> 7004 <td class="u-bold"> 7005 @firstVariantOption.Name 7006 </td> 7007 <td> 7008 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7009 </td> 7010 </tr> 7011 productLoopCounter++; 7012 } 7013 7014 <tr> 7015 <td>&nbsp;</td> 7016 <td> 7017 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7018 </td> 7019 </tr> 7020 </tbody> 7021 } 7022 @if (groupCount == 2) 7023 { 7024 <thead> 7025 <tr> 7026 <td>&nbsp;</td> 7027 @foreach (VariantOption variant in secondDimension) 7028 { 7029 <td>@variant.Name</td> 7030 } 7031 </tr> 7032 </thead> 7033 <tbody> 7034 @foreach (VariantOption firstVariantOption in firstDimension) 7035 { 7036 string variantId = ""; 7037 columnCount = 0; 7038 7039 <tr> 7040 <td class="u-min-w120px">@firstVariantOption.Name</td> 7041 7042 @foreach (VariantOption secondVariantOption in secondDimension) 7043 { 7044 variantId = firstVariantOption.Id + "." + secondVariantOption.Id; 7045 <td> 7046 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7047 </td> 7048 7049 columnCount++; 7050 7051 productLoopCounter++; 7052 } 7053 7054 <td> 7055 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7056 </td> 7057 </tr> 7058 7059 rowCount++; 7060 } 7061 7062 @{ 7063 columnCount = 0; 7064 } 7065 7066 <tr> 7067 <td>&nbsp;</td> 7068 @foreach (VariantOption secondVariantOption in secondDimension) 7069 { 7070 <td> 7071 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7072 </td> 7073 7074 columnCount++; 7075 } 7076 <td>&nbsp;</td> 7077 </tr> 7078 </tbody> 7079 } 7080 @if (groupCount == 3) 7081 { 7082 <thead> 7083 <tr> 7084 <td>&nbsp;</td> 7085 @foreach (VariantOption thirdVariantOption in thirdDimension) 7086 { 7087 <td>@thirdVariantOption.Name</td> 7088 } 7089 </tr> 7090 </thead> 7091 <tbody> 7092 @foreach (VariantOption firstVariantOption in firstDimension) 7093 { 7094 int colspan = (thirdDimension.Count + 1); 7095 7096 <tr> 7097 <td colspan="@colspan" class="u-color-light-gray--bg u-bold">@firstVariantOption.Name</td> 7098 </tr> 7099 7100 foreach (VariantOption secondVariantOption in secondDimension) 7101 { 7102 string variantId = ""; 7103 columnCount = 0; 7104 7105 <tr> 7106 <td class="u-min-w120px">@secondVariantOption.Name</td> 7107 7108 @foreach (VariantOption thirdVariantOption in thirdDimension) 7109 { 7110 variantId = firstVariantOption.Id + "." + secondVariantOption.Id + "." + thirdVariantOption.Id; 7111 7112 <td> 7113 @RenderVariantMatrixQuantityField(variantId, settings, productLoopCounter, rowCount, columnCount) 7114 </td> 7115 7116 columnCount++; 7117 productLoopCounter++; 7118 } 7119 7120 <td> 7121 <div class="qty-field js-total-qty-row-@rowCount dw-mod">0</div> 7122 </td> 7123 </tr> 7124 rowCount++; 7125 } 7126 } 7127 7128 @{ 7129 columnCount = 0; 7130 } 7131 7132 <tr> 7133 <td>&nbsp;</td> 7134 @foreach (VariantOption thirdVariantOption in thirdDimension) 7135 { 7136 <td> 7137 <div class="qty-field js-total-qty-column-@columnCount dw-mod">0</div> 7138 </td> 7139 7140 columnCount++; 7141 } 7142 <td>&nbsp;</td> 7143 </tr> 7144 </tbody> 7145 } 7146 </table> 7147 7148 <script> 7149 document.addEventListener("DOMContentLoaded", function (event) { 7150 MatrixUpdateQuantity("@settings.ProductId"); 7151 }); 7152 7153 MatrixUpdateQuantity = function (productId) { 7154 var currentMatrix = document.getElementById("VariantMatrixTable_" + productId); 7155 var allQtyFields = currentMatrix.getElementsByClassName("js-qty"); 7156 7157 var qtyRowArr = []; 7158 var qtyColumnArr = []; 7159 7160 var totalQty = 0; 7161 7162 for (var i = 0; i < allQtyFields.length; i++) { 7163 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] = 0; 7164 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] = 0; 7165 } 7166 7167 for (var i = 0; i < allQtyFields.length; i++) { 7168 qtyRowArr[allQtyFields[i].getAttribute("data-qty-row-group")] += parseFloat(allQtyFields[i].value); 7169 qtyColumnArr[allQtyFields[i].getAttribute("data-qty-column-group")] += parseFloat(allQtyFields[i].value); 7170 totalQty += parseFloat(allQtyFields[i].value); 7171 } 7172 7173 //Update row counters 7174 for (var i = 0; i < qtyRowArr.length; i++) { 7175 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7176 7177 if (qtyRowArr[i] != undefined && qtyCounter != null) { 7178 var currentCount = qtyCounter.innerHTML; 7179 qtyCounter.innerHTML = qtyRowArr[i]; 7180 7181 if (currentCount != qtyCounter.innerHTML) { 7182 qtyCounter.classList.add("qty-field--active"); 7183 } 7184 } 7185 7186 } 7187 7188 //Update column counters 7189 for (var i = 0; i < qtyColumnArr.length; i++) { 7190 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7191 7192 if (qtyColumnArr[i] != undefined && qtyCounter != null) { 7193 var currentCount = qtyCounter.innerHTML; 7194 qtyCounter.innerHTML = qtyColumnArr[i]; 7195 7196 if (currentCount != qtyCounter.innerHTML) { 7197 qtyCounter.classList.add("qty-field--active"); 7198 } 7199 } 7200 } 7201 7202 if (document.getElementById("TotalQtyCount_" + productId)) { 7203 document.getElementById("TotalQtyCount_" + productId).innerHTML = totalQty; 7204 } 7205 7206 //Clean up animations 7207 setTimeout(function () { 7208 for (var i = 0; i < qtyRowArr.length; i++) { 7209 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-row-" + i)[0]; 7210 if (qtyCounter != null) { 7211 qtyCounter.classList.remove("qty-field--active"); 7212 } 7213 } 7214 for (var i = 0; i < qtyColumnArr.length; i++) { 7215 var qtyCounter = currentMatrix.getElementsByClassName("js-total-qty-column-" + i)[0]; 7216 if (qtyCounter != null) { 7217 qtyCounter.classList.remove("qty-field--active"); 7218 } 7219 } 7220 }, 1000); 7221 } 7222 </script> 7223 } 7224 } 7225 7226 @helper RenderVariantMatrixQuantityField(string variantId, VariantMatrix settings, int productLoopCounter, int rowCount, int columnCount) 7227 { 7228 string loopCount = productLoopCounter.ToString(); 7229 7230 bool combinationFound = false; 7231 double stock = 0; 7232 double quantityValue = 0; 7233 string note = ""; 7234 7235 VariantProduct variantProduct = null; 7236 7237 if (settings.GetVariantProducts().TryGetValue(variantId, out variantProduct)) 7238 { 7239 stock = variantProduct.Stock; 7240 quantityValue = variantProduct.Quantity; 7241 combinationFound = true; 7242 } 7243 7244 if (combinationFound) 7245 { 7246 <input type="hidden" name="ProductLoopCounter@(loopCount)" value="@loopCount" /> 7247 <input type="hidden" name="ProductID@(loopCount)" value="@settings.ProductId" /> 7248 <input type="hidden" name="VariantID@(loopCount)" value="@variantId" /> 7249 <input type="hidden" name="CurrentNote@(loopCount)" id="CurrentNote_@(settings.ProductId)_@variantId" value="@note" /> 7250 <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"> 7251 7252 if (stock != 0) 7253 { 7254 <small>@Translate("Stock") @stock</small> 7255 } 7256 7257 <script> 7258 var variants = '{ "ProductId" :' + '"@settings.ProductId"' + ', "VariantId": ' + '"@variantId"' +'}'; 7259 variantsCollection.push(variants); 7260 document.getElementById("Quantity_@(settings.ProductId)_@variantId").closest(".js-variants-matrix").setAttribute("data-variants-collection", "[" + variantsCollection + "]" ); 7261 </script> 7262 } 7263 else 7264 { 7265 <div class="use-btn-height" style="background-color: #a8a8a8"></div> 7266 } 7267 } 7268 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7269 7270 @* Component *@ 7271 7272 @helper RenderAddToCart(AddToCart settings) 7273 { 7274 //set Id for quantity selector to get it's value from button 7275 if (settings.QuantitySelector != null) 7276 { 7277 if (string.IsNullOrEmpty(settings.QuantitySelector.Id)) 7278 { 7279 settings.QuantitySelector.Id = Guid.NewGuid().ToString("N"); 7280 } 7281 7282 settings.AddButton.QuantitySelectorId = settings.QuantitySelector.Id; 7283 7284 if (settings.Disabled) 7285 { 7286 settings.QuantitySelector.Disabled = true; 7287 } 7288 7289 if (string.IsNullOrEmpty(settings.QuantitySelector.Name)) 7290 { 7291 settings.QuantitySelector.Name = settings.QuantitySelector.Id; 7292 } 7293 } 7294 7295 if (settings.Disabled) 7296 { 7297 settings.AddButton.Disabled = true; 7298 } 7299 7300 settings.AddButton.CssClass += " btn--condensed"; 7301 7302 //unitsSelector 7303 if (settings.UnitSelector != null) 7304 { 7305 if (settings.Disabled) 7306 { 7307 settings.QuantitySelector.Disabled = true; 7308 } 7309 } 7310 7311 <div class="buttons-collection @settings.WrapperCssClass" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7312 @if (settings.UnitSelector != null) 7313 { 7314 @Render(settings.UnitSelector) 7315 } 7316 @if (settings.QuantitySelector != null) 7317 { 7318 @Render(settings.QuantitySelector) 7319 } 7320 @Render(settings.AddButton) 7321 </div> 7322 } 7323 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7324 7325 @* Component *@ 7326 7327 @helper RenderAddToCartButton(AddToCartButton settings) 7328 { 7329 if (!settings.HideTitle) 7330 { 7331 if (string.IsNullOrEmpty(settings.Title)) 7332 { 7333 if (settings.BuyForPoints) 7334 { 7335 settings.Title = Translate("Buy with points"); 7336 } 7337 else 7338 { 7339 settings.Title = Translate("Add to cart"); 7340 } 7341 } 7342 } 7343 else 7344 { 7345 settings.Title = ""; 7346 } 7347 7348 if (settings.Icon == null) 7349 { 7350 settings.Icon = new Icon(); 7351 settings.Icon.LabelPosition = Dynamicweb.Rapido.Blocks.Components.General.IconLabelPosition.After; 7352 } 7353 7354 if (string.IsNullOrEmpty(settings.Icon.Name)) 7355 { 7356 settings.Icon.Name = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue; 7357 } 7358 7359 settings.OnClick = "Cart.AddToCart(event, { " + 7360 "id: '" + settings.ProductId + "'," + 7361 (!string.IsNullOrEmpty(settings.VariantId) ? "variantId: '" + settings.VariantId + "'," : "") + 7362 (!string.IsNullOrEmpty(settings.UnitId) ? "unitId: '" + settings.UnitId + "'," : "") + 7363 (settings.BuyForPoints ? "buyForPoints: true," : "") + 7364 (!string.IsNullOrEmpty(settings.ProductInfo) ? "productInfo: " + settings.ProductInfo + "," : "") + 7365 "quantity: " + (string.IsNullOrEmpty(settings.QuantitySelectorId) ? "1" : "parseFloat(document.getElementById('" + settings.QuantitySelectorId + "').value)") + 7366 "});" + settings.OnClick; 7367 7368 @RenderButton(settings) 7369 } 7370 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7371 7372 @* Component *@ 7373 7374 @helper RenderUnitSelector(UnitSelector settings) 7375 { 7376 if (string.IsNullOrEmpty(settings.Id)) 7377 { 7378 settings.Id = Guid.NewGuid().ToString("N"); 7379 } 7380 var disabledClass = settings.Disabled ? "disabled" : ""; 7381 7382 <input type="checkbox" id="@settings.Id" class="dropdown-trigger" /> 7383 <div class="dropdown unit-selector @settings.CssClass @disabledClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 7384 <label class="dropdown__header dropdown__btn dropdown__btn--unit-selector dw-mod" for="@settings.Id">@settings.SelectedOption</label> 7385 <div class="dropdown__content dw-mod"> 7386 @settings.OptionsContent 7387 </div> 7388 <label class="dropdown-trigger-off" for="@settings.Id"></label> 7389 </div> 7390 } 7391 @using System.Reflection 7392 @using Dynamicweb.Rapido.Blocks.Components.Ecommerce 7393 7394 @* Component *@ 7395 7396 @helper RenderQuantitySelector(QuantitySelector settings) 7397 { 7398 var attributes = new Dictionary<string, string>(); 7399 7400 /*base settings*/ 7401 if (!string.IsNullOrEmpty(settings.Id)) { attributes.Add("id", settings.Id); } 7402 if (!string.IsNullOrEmpty(settings.OnClick)) { attributes.Add("onclick", settings.OnClick); } 7403 if (!string.IsNullOrEmpty(settings.OnChange)) { attributes.Add("onchange", settings.OnChange); } 7404 if (settings.Disabled) { attributes.Add("disabled", "true"); } 7405 if (settings.Required) { attributes.Add("required", "true"); } 7406 if (!string.IsNullOrEmpty(settings.Name)) { attributes.Add("name", settings.Name); } 7407 /*end*/ 7408 7409 if (!string.IsNullOrEmpty(settings.OnKeyUp)) { attributes.Add("onkeyup", settings.OnKeyUp); } 7410 if (!string.IsNullOrEmpty(settings.OnInput)) { attributes.Add("oninput", settings.OnInput); } 7411 if (!string.IsNullOrEmpty(settings.OnFocus)) { attributes.Add("onfocus", settings.OnFocus); } 7412 if (settings.ReadOnly) { attributes.Add("readonly", "true"); } 7413 if (settings.Max != null) { attributes.Add("max", settings.Max.ToString()); } 7414 if (settings.Min == null) { settings.Min = 1; } 7415 attributes.Add("min", settings.Min.ToString()); 7416 if (settings.Step != null && !string.IsNullOrEmpty(settings.Step.ToString())) { attributes.Add("step", settings.Step.ToString()); } 7417 if (settings.Value == null) { settings.Value = 1; } 7418 attributes.Add("value", settings.Value.ToString()); 7419 attributes.Add("type", "number"); 7420 7421 var resultAttributes = attributes.Concat(settings.ExtraAttributes).GroupBy(d => d.Key).ToDictionary (d => d.Key, d => d.Last().Value); 7422 7423 <input @ComponentMethods.AddAttributes(resultAttributes) class="@settings.CssClass dw-mod" /> 7424 } 7425 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7426 7427 @using System 7428 @using System.Web 7429 @using System.Collections.Generic 7430 @using Dynamicweb.Rapido.Blocks.Extensibility 7431 @using Dynamicweb.Rapido.Blocks 7432 7433 @{ 7434 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 7435 7436 Block primaryBottomSnippets = new Block() 7437 { 7438 Id = "MasterJavascriptInitializers", 7439 SortId = 100, 7440 Template = RenderPrimaryBottomSnippets() 7441 }; 7442 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 7443 } 7444 7445 @helper RenderPrimaryBottomSnippets() 7446 { 7447 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 7448 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 7449 7450 if (isWireframeMode) 7451 { 7452 <script> 7453 Wireframe.Init(true); 7454 </script> 7455 } 7456 7457 7458 if (useGoogleTagManager) 7459 { 7460 <script> 7461 document.addEventListener('addToCart', function(event) { 7462 var googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7463 if (typeof googleImpression == "string") { 7464 googleImpression = JSON.parse(event.detail.productInfo.googleImpression); 7465 } 7466 dataLayer.push({ 7467 'event': 'addToCart', 7468 'ecommerce': { 7469 'currencyCode': googleImpression.currency, 7470 'add': { 7471 'products': [{ 7472 'name': googleImpression.name, 7473 'id': googleImpression.id, 7474 'price': googleImpression.price, 7475 'brand': googleImpression.brand, 7476 'category': googleImpression.category, 7477 'variant': googleImpression.variant, 7478 'quantity': event.detail.quantity 7479 }] 7480 } 7481 } 7482 }); 7483 }); 7484 </script> 7485 } 7486 7487 //if digitalwarehouse 7488 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 7489 { 7490 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 7491 7492 if (string.IsNullOrEmpty(cartContextId)) 7493 { 7494 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 7495 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 7496 cartContextId = cartSettings.OrderContextID; 7497 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 7498 } 7499 7500 <script> 7501 let downloadCart = new DownloadCart({ 7502 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 7503 contextId: "@cartContextId", 7504 addButtonText: "@Translate("Add")", 7505 removeButtonText: "@Translate("Remove")" 7506 }); 7507 </script> 7508 } 7509 7510 <!--$$Javascripts--> 7511 } 7512 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 7513 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 7514 @using System 7515 @using System.Web 7516 @using System.Collections.Generic 7517 @using Dynamicweb.Rapido.Blocks 7518 7519 @{ 7520 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 7521 7522 Block miniCartCustom = new Block() 7523 { 7524 Id = "MiniCartActions", 7525 Template = RenderMiniCartActionsCustom(), 7526 SortId = 80 7527 }; 7528 masterCustomBlocksPage.ReplaceBlock(miniCartCustom); 7529 if (!navigationItemsHideSearch || isFavoriteList) 7530 { 7531 Block masterSearchScriptTemplatesCustom = new Block() 7532 { 7533 Id = "MasterSearchScriptTemplates", 7534 SortId = 1, 7535 Template = RenderSearchScriptTemplatesCustom() 7536 }; 7537 7538 masterCustomBlocksPage.ReplaceBlock(masterSearchScriptTemplatesCustom); 7539 } 7540 if (masterCustomBlocksPage.GetBlockById("MasterFooterNewsletterSignUp") != null) 7541 { 7542 masterCustomBlocksPage.RemoveBlockById("MasterFooterNewsletterSignUp"); 7543 } 7544 if (masterCustomBlocksPage.GetBlockById("MasterFooterSocialLinks") != null) 7545 { 7546 masterCustomBlocksPage.RemoveBlockById("MasterFooterSocialLinks"); 7547 } 7548 7549 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); 7550 7551 if (NewsLetterSignUp_Or_SocialIcons_AreEnabled) 7552 { 7553 Block FooterNewsletterSignUpAndSocialIcons = new Block 7554 { 7555 Id = "MasterFooterNewsletterSignUpAndSocialIcons", 7556 SortId = 5, 7557 Template = RenderFooterNewsletterSignUpAndSocialMediaIcons(), 7558 Design = new Design 7559 { 7560 Size = "auto", 7561 RenderType = RenderType.Column 7562 } 7563 }; 7564 masterCustomBlocksPage.Add("MasterFooterContent", FooterNewsletterSignUpAndSocialIcons); 7565 } 7566 7567 @helper RenderCustomFooterSocialLinks() 7568 { 7569 <div class="footer__content dw-mod" style=" 7570 display: flex;"> 7571 7572 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 7573 { 7574 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 7575 string socialIconClass = socialIcon.SelectedValue; 7576 string socialIconTitle = socialIcon.SelectedName; 7577 string socialLink = socialitem.GetString("Link"); 7578 7579 <a style="width:50px;" href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-2x"></i></a> 7580 } 7581 7582 </div> 7583 } 7584 7585 @helper RenderFooterNewsletterSignUpAndSocialMediaIcons() 7586 { 7587 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 7588 { 7589 <div class="dw-mod"> 7590 @RenderFooterNewsletterSignUp() 7591 </div> 7592 7593 } 7594 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 7595 { 7596 <div class="grid grid--align-content-start dw-mod"> 7597 @RenderCustomFooterSocialLinks() 7598 </div> 7599 } 7600 7601 7602 } 7603 7604 7605 } 7606 @helper RenderMiniCartActionsCustom() 7607 { 7608 var emptyOrContinueBtn = Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage") != null ? Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetList("CheckoutPage").SelectedValue : "empty"; 7609 int cartPageId = GetPageIdByNavigationTag("CartPage"); 7610 if (emptyOrContinueBtn == "empty") 7611 { 7612 <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> 7613 <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> 7614 } 7615 else 7616 { 7617 <button class="btn btn--secondary u-full-width dw-mod u-no-margin u-margin-bottom"><label for="miniCartTrigger">@Translate("Continue shopping")</label></button> 7618 <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> 7619 } 7620 7621 } 7622 @helper RenderSearchScriptTemplatesCustom() 7623 { 7624 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 7625 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 7626 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 7627 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 7628 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 7629 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 7630 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 7631 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 7632 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 7633 7634 <script id="SearchGroupsTemplate" type="text/x-template"> 7635 {{#.}} 7636 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 7637 {{/.}} 7638 </script> 7639 7640 <script id="SearchProductsTemplate" type="text/x-template"> 7641 {{#each .}} 7642 {{#Product}} 7643 {{#ifCond template "!==" "SearchMore"}} 7644 <li class="dropdown__item dropdown__item--seperator dw-mod"> 7645 @if (useFacebookPixel) 7646 { 7647 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 7648 } 7649 @if (useGoogleTagManager) 7650 { 7651 <text>{{{googleEnchantImpression googleImpression}}}</text> 7652 } 7653 <div> 7654 <a href="{{link}}" 7655 class="js-typeahead-link u-color-inherit u-pull--left" 7656 onclick="{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}" 7657 title="{{name}}{{#if variantName}}, {{variantName}}{{/if}}"> 7658 <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> 7659 <div class="u-pull--left"> 7660 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}{{#if variantName}}, {{variantName}}{{/if}}</div> 7661 @if (showPrice && Dynamicweb.Rapido.Services.User.IsPricesAllowed()) 7662 { 7663 if (pointShopOnly) 7664 { 7665 <text> 7666 {{#if havePointPrice}} 7667 <div> 7668 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 7669 </div> 7670 {{else}} 7671 <small class="help-text u-no-margin">@Translate("Not available")</small> 7672 {{/if}} 7673 {{#unless canBePurchasedWithPoints}} 7674 {{#if havePointPrice}} 7675 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 7676 {{/if}} 7677 {{/unless}} 7678 </text> 7679 } 7680 else 7681 { 7682 <div>{{price}}</div> 7683 } 7684 } 7685 </div> 7686 </a> 7687 <div class="u-margin-left u-pull--right"> 7688 @{ 7689 var viewBtn = new Link 7690 { 7691 Href = "{{link}}", 7692 OnClick = "{{#if googleImpression}}googleEnchantImpressionClick({{googleImpression}}, event){{/if}}", 7693 ButtonLayout = ButtonLayout.Secondary, 7694 CssClass = "btn--condensed u-no-margin u-w80px js-ignore-click-outside", 7695 Title = Translate("View") 7696 }; 7697 } 7698 {{#unless isTraining}} 7699 @if (showAddToCartButton && Dynamicweb.Rapido.Services.User.IsBuyingAllowed()) 7700 { 7701 <text>{{#if hideAddToCartButton}}</text> 7702 @Render(viewBtn) 7703 <text>{{else}}</text> 7704 @Render(new AddToCartButton 7705 { 7706 HideTitle = true, 7707 ProductId = "{{productId}}", 7708 VariantId = "{{variantid}}", 7709 ProductInfo = "{{productInfo}}", 7710 BuyForPoints = pointShopOnly, 7711 OnClick = "{{facebookPixelAction}}", 7712 CssClass = "u-w80px u-no-margin js-ignore-click-outside", 7713 Icon = new Icon { 7714 CssClass = "js-ignore-click-outside" 7715 }, 7716 ExtraAttributes = new Dictionary<string, string> 7717 { 7718 { "{{disabledBuyButton}}", "" } 7719 } 7720 }) 7721 <text>{{/if}}</text> 7722 } 7723 else if (showViewButton) 7724 { 7725 @Render(viewBtn) 7726 } 7727 @if (showAddToDownloadButton) 7728 { 7729 <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}}"> 7730 <i class="fas fa-plus js-button-icon"></i> 7731 </button> 7732 } 7733 {{else}} 7734 <a href="{{link}}" class="btn btn--primary dw-mod">@Translate("Sign-up")</a> 7735 {{/unless}} 7736 </div> 7737 </div> 7738 </li> 7739 {{/ifCond}} 7740 {{#ifCond template "===" "SearchMore"}} 7741 {{>SearchMoreProducts}} 7742 {{/ifCond}} 7743 {{/Product}} 7744 {{else}} 7745 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7746 @Translate("Your search gave 0 results") 7747 </li> 7748 {{/each}} 7749 </script> 7750 7751 <script id="SearchMoreProducts" type="text/x-template"> 7752 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7753 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7754 @Translate("View all") 7755 </a> 7756 </li> 7757 </script> 7758 7759 <script id="SearchMorePages" type="text/x-template"> 7760 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 7761 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 7762 @Translate("View all") 7763 </a> 7764 </li> 7765 </script> 7766 7767 <script id="SearchPagesTemplate" type="text/x-template"> 7768 {{#each .}} 7769 {{#ifCond template "!==" "SearchMore"}} 7770 <li class="dropdown__item dropdown__item--seperator dropdown__item--no-padding dw-mod"> 7771 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link dropdown__link u-color-inherit"> 7772 <div class="u-margin-right"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 7773 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 7774 </a> 7775 </li> 7776 {{/ifCond}} 7777 {{#ifCond template "===" "SearchMore"}} 7778 {{>SearchMorePages}} 7779 {{/ifCond}} 7780 {{else}} 7781 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable js-no-result dw-mod"> 7782 @Translate("Your search gave 0 results") 7783 </li> 7784 {{/each}} 7785 </script> 7786 7787 <script id="SearchPagesTemplateWrap" type="text/x-template"> 7788 <div class="dropdown__column-header">@Translate("Pages")</div> 7789 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7790 {{>SearchPagesTemplate}} 7791 </ul> 7792 </script> 7793 7794 <script id="SearchProductsTemplateWrap" type="text/x-template"> 7795 <div class="dropdown__column-header">@Translate("Products")</div> 7796 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom u-height--auto u-flex-grow--1 dw-mod"> 7797 {{>SearchProductsTemplate}} 7798 </ul> 7799 </script> 7800 } 7801 7802 7803 @functions { 7804 public class ManifestIcon 7805 { 7806 public string src { get; set; } 7807 public string type { get; set; } 7808 public string sizes { get; set; } 7809 } 7810 7811 public class Manifest 7812 { 7813 public string name { get; set; } 7814 public string short_name { get; set; } 7815 public string start_url { get; set; } 7816 public string display { get; set; } 7817 public string background_color { get; set; } 7818 public string theme_color { get; set; } 7819 public List<ManifestIcon> icons { get; set; } 7820 } 7821 } 7822 7823 <!DOCTYPE html> 7824 7825 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 7826 7827 7828 7829 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 7830 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 7831 7832 7833 7834 @helper RenderMasterHead() { 7835 List<Block> subBlocks = this.masterPage.GetBlockListById("Head").OrderBy(item => item.SortId).ToList(); 7836 7837 <head> 7838 <!-- Rapido version 3.2.1 --> 7839 7840 @RenderBlockList(subBlocks) 7841 </head> 7842 } 7843 7844 @helper RenderMasterMetadata() { 7845 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 7846 var brandColors = swatches.GetColorSwatch(1); 7847 string brandColorOne = brandColors.Palette["BrandColor1"]; 7848 7849 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 7850 Manifest manifest = new Manifest 7851 { 7852 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 7853 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"), 7854 start_url = "/", 7855 display = "standalone", 7856 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 7857 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 7858 }; 7859 7860 manifest.icons = new List<ManifestIcon> { 7861 new ManifestIcon { 7862 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7863 sizes = "192x192", 7864 type = "image/png" 7865 }, 7866 new ManifestIcon { 7867 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7868 sizes = "512x512", 7869 type = "image/png" 7870 }, 7871 new ManifestIcon { 7872 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 7873 sizes = "1024x1024", 7874 type = "image/png" 7875 } 7876 }; 7877 7878 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 7879 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 7880 string currentManifest = File.ReadAllText(manifestFilePath); 7881 7882 if (manifestJSON != currentManifest) 7883 { 7884 File.WriteAllText(manifestFilePath, manifestJSON); 7885 } 7886 } 7887 7888 <meta charset="utf-8" /> 7889 <title>@Model.Title</title> 7890 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7891 <meta name="robots" content="index, follow"> 7892 <meta name="theme-color" content="@brandColorOne" /> 7893 7894 if (!Model.MetaTags.Contains("og:image")) { 7895 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"))); 7896 } 7897 7898 if (!Model.MetaTags.Contains("og:description")) { 7899 Pageview.Meta.AddTag("og:description", Model.Description); 7900 } 7901 7902 Pageview.Meta.AddTag("og:title", Model.Title); 7903 Pageview.Meta.AddTag("og:site_name", Model.Name); 7904 Pageview.Meta.AddTag("og:url", HttpContext.Current.Request.Url.ToString()); 7905 Pageview.Meta.AddTag("og:type", "Website"); 7906 Pageview.Meta.AddTag("fb:page_id", Model.ID.ToString()); 7907 7908 @Model.MetaTags 7909 } 7910 7911 @helper RenderMasterCss() { 7912 var fonts = new string[] { 7913 getFontFamily("Layout", "HeaderFont"), 7914 getFontFamily("Layout", "SubheaderFont"), 7915 getFontFamily("Layout", "TertiaryHeaderFont"), 7916 getFontFamily("Layout", "BodyText"), 7917 getFontFamily("Layout", "Header", "ToolsFont"), 7918 getFontFamily("Layout", "Header", "NavigationFont"), 7919 getFontFamily("Layout", "MobileNavigation", "Font"), 7920 getFontFamily("ProductList", "Facets", "HeaderFont"), 7921 getFontFamily("ProductPage", "PriceFontDesign"), 7922 getFontFamily("Ecommerce", "SaleSticker", "Font"), 7923 getFontFamily("Ecommerce", "NewSticker", "Font"), 7924 getFontFamily("Ecommerce", "CustomSticker", "Font") 7925 }; 7926 7927 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 7928 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 7929 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 7930 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 7931 if (useFontAwesomePro) 7932 { 7933 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 7934 } 7935 7936 //Favicon 7937 <link href="@favicon" rel="icon" type="image/png"> 7938 7939 //Base (Default, wireframe) styles 7940 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 7941 7942 //Rapido Css from Website Settings 7943 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 7944 7945 //Ignite Css (Custom site specific styles) 7946 <link rel="stylesheet" id="igniteCss" type="text/css" href="/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"> 7947 7948 //Font awesome 7949 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 7950 7951 //Flag icon 7952 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 7953 7954 //Google fonts 7955 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))); 7956 7957 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 7958 7959 PushPromise(favicon); 7960 PushPromise(fontAwesomeCssLink); 7961 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 7962 PushPromise(autoCssLink); 7963 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 7964 PushPromise("/Files/Images/placeholder.gif"); 7965 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 7966 } 7967 7968 @helper RenderMasterManifest() { 7969 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 7970 { 7971 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 7972 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 7973 } 7974 } 7975 7976 @helper RenderMasterBody() { 7977 List<Block> subBlocks = this.masterPage.GetBlockListById("Body").OrderBy(item => item.SortId).ToList(); 7978 string designLayout = Model.PropertyItem.GetItem("CustomSettings") != null ? Model.PropertyItem.GetItem("CustomSettings").GetString("DesignLayout") != null ? Model.PropertyItem.GetItem("CustomSettings").GetList("DesignLayout").SelectedValue : "" : ""; 7979 if (!String.IsNullOrEmpty(designLayout)) { 7980 designLayout = "class=\"" + designLayout + "\""; 7981 } 7982 7983 <body @designLayout> 7984 @RenderBlockList(subBlocks) 7985 </body> 7986 } 7987 7988 @helper RenderMasterHeader() 7989 { 7990 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 7991 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 7992 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 7993 7994 <header class="top-container @stickyTop dw-mod" id="Top"> 7995 @RenderBlockList(subBlocks) 7996 </header> 7997 } 7998 7999 @helper RenderMain() 8000 { 8001 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 8002 8003 <main class="site dw-mod"> 8004 @RenderBlockList(subBlocks) 8005 </main> 8006 } 8007 8008 @helper RenderPageContent() 8009 { 8010 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 8011 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 8012 8013 <div id="Page" class="page @pagePos"> 8014 <section class="center-container content-container dw-mod" id="content"> 8015 8016 @RenderSnippet("Content") 8017 </section> 8018 </div> 8019 } 8020 8021 @* Hack to support nested helpers *@ 8022 @SnippetStart("Content") 8023 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 8024 8025 8026 8027 @using Dynamicweb.Rapido.Blocks.Components.General 8028 @using Dynamicweb.Rapido.Blocks 8029 8030 @functions { 8031 BlocksPage page = BlocksPage.GetBlockPage("Page"); 8032 } 8033 8034 @{ 8035 bool isProductPage = HttpContext.Current.Request.QueryString.Get("ProductID") != null; 8036 string backgroundColorClass = Model.PropertyItem.GetList("BackgroundColor") != null && !isProductPage ? "u-" + Model.PropertyItem.GetList("BackgroundColor").SelectedValue + "--bg" : ""; 8037 string navigationMarkup = ""; 8038 8039 Block pageContainer = new Block 8040 { 8041 Id = "PageContainer", 8042 SortId = 10, 8043 BlocksList = new List<Block> { 8044 new Block { 8045 Id = "PageRow", 8046 SortId = 20, 8047 Design = new Design { 8048 RenderType = RenderType.Row 8049 } 8050 } 8051 } 8052 }; 8053 page.Add(pageContainer); 8054 8055 if (Model.PropertyItem.GetList("ShowBreadcrumb") != null && Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 8056 { 8057 Block breadcrumbNavigation = new Block 8058 { 8059 Id = "PageBreadcrumbNavigation", 8060 SortId = 10, 8061 Component = new BreadcrumbNavigation { Id = "breadcrumb", Template = "Breadcrumb.xslt", SitemapMode = true } 8062 }; 8063 page.Add("PageContainer", breadcrumbNavigation); 8064 } 8065 8066 if (Model.PropertyItem.GetList("LeftMenu") != null && Model.PropertyItem.GetList("LeftMenu").SelectedValue == "True" && (Pageview.Page.NavigationSettings == null || !Pageview.Page.NavigationSettings.UseEcomGroups)) 8067 { 8068 navigationMarkup = RenderNavigation(new 8069 { 8070 id = "leftnav", 8071 cssclass = "dwnavigation", 8072 startLevel = 2, 8073 expandmode = "all", 8074 endlevel = 5, 8075 template = "LeftNavigation.xslt" 8076 }); 8077 8078 if (!string.IsNullOrEmpty(navigationMarkup)) 8079 { 8080 Block leftNavigation = new Block 8081 { 8082 Id = "PageLeftNavigation", 8083 SortId = 10, 8084 Component = new LeftNavigation { Id = "leftnav", CssClass = "dwnavigation", StartLevel = 2, EndLevel = 5, Expandmode = "all", Template = "LeftNavigation.xslt" }, 8085 Design = new Design 8086 { 8087 RenderType = RenderType.Column, 8088 Size = "3" 8089 } 8090 }; 8091 page.Add("PageRow", leftNavigation); 8092 } 8093 } 8094 8095 string contentColumnSize = !string.IsNullOrEmpty(navigationMarkup) ? "9" : "12"; 8096 8097 Block pageContent = new Block 8098 { 8099 Id = "PageContent", 8100 SortId = 20, 8101 Design = new Design 8102 { 8103 RenderType = RenderType.Column, 8104 Size = contentColumnSize, 8105 CssClass = "grid__col--bleed" 8106 }, 8107 BlocksList = new List<Block> { 8108 new Block { 8109 Id = "PageContentRow", 8110 SortId = 10, 8111 Component = new Text { Content = @Model.Placeholder("dwcontent", "content", "default:true;sort:1") }, 8112 Design = new Design { 8113 RenderType = RenderType.Row 8114 } 8115 } 8116 } 8117 }; 8118 page.Add("PageRow", pageContent); 8119 } 8120 8121 @using System 8122 @using System.Web 8123 @using System.Collections.Generic 8124 @using Dynamicweb.Rapido.Blocks 8125 8126 @{ 8127 BlocksPage pageCustomBlocksPage = BlocksPage.GetBlockPage("Page"); 8128 8129 } 8130 8131 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 8132 @RenderBlockList(page.BlocksRoot.BlocksList) 8133 8134 8135 @* Very small hack to make it cleanly, and easily possible to change the background color on a single page *@ 8136 @if (backgroundColorClass != "") 8137 { 8138 <script> 8139 document.getElementById("Page").classList.add("@backgroundColorClass"); 8140 </script> 8141 } 8142 @SnippetEnd("Content") 8143 8144 @{ 8145 if (Pageview.AreaSettings.GetItem("Custom") != null && 8146 Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings") != null && 8147 Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetItem("CustomScripts") != null) 8148 { 8149 @Pageview.AreaSettings.GetItem("Custom").GetItem("CustomSettings").GetItem("CustomScripts").GetValue("FooterScript") 8150 } 8151 } 8152 </html> 8153 8154