Error executing template "Designs/Rapido/_parsed/DynamicArticle_Custom.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_3a3884309e57437f8e4e56c2c496b07d.Execute() in D:\dynamicweb.net\Solutions\Skabertrang\assens.dw9.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\DynamicArticle_Custom.parsed.cshtml:line 8268
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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