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_ff588140600e4809908b30a41f306a01.<RenderMasterMetadata>b__201_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7829
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<RenderMasterHead>b__200_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7774
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_ff588140600e4809908b30a41f306a01.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\trac.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7762
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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