Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.<RenderMasterBody>b__210_0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8295
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_2ddbbb23e19744d9b6d8e97492b606e0.Execute() in E:\dynamicweb.net\Solutions\www.3d-dental.dk\Application\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8134
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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