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