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