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