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_5d8844f3accb46d389414d06a84aa67f.<RenderMasterHeader>b__199_0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<RenderMain>b__200_0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<RenderMasterBody>b__198_0(TextWriter __razor_helper_writer)
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d8844f3accb46d389414d06a84aa67f.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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