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

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