Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<RenderMasterMetadata>b__224_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8968
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<RenderMasterHead>b__223_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8913
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_afcc78a737d744e9988851493a48b6a7.Execute() in D:\dynamicweb.net\Solutions\Solteq\Norskstaal.staging.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8903
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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