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