Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at Custom.Thermex.Seo.Canonical.Url(PageView pageView, String domain, String rawUrl) in D:\a\1\s\Custom.Thermex\Seo\Canonical.cs:line 24
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<RenderMasterMetadata>b__202_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8024
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<RenderMasterHead>b__201_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8005
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 255
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 293
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 165
   at CompiledRazorTemplates.Dynamic.RazorEngine_d73d99cafe5f4432a4b6c8e06f1df805.Execute() in D:\Dynamicweb.net\Solutions\S_DW_Thermex\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7994
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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