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