Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<RenderMasterMetadataCustom>b__212_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9032
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 258
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<RenderMasterHead>b__225_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9530
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 258
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass4_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 296
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.<>c__DisplayClass3_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 168
   at CompiledRazorTemplates.Dynamic.RazorEngine_65c0428eec5c45259a4ee66e6fd8ddbb.Execute() in D:\dynamicweb.net\Solutions\danishagro-machinery.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9519
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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