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