Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<RenderMasterHeader>b__202_0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8087
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 256
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<RenderMain>b__203_0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8099
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 256
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 294
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<RenderMasterBody>b__201_0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8076
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 256
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 294
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 166
   at CompiledRazorTemplates.Dynamic.RazorEngine_ae3dc95d3d3b4d44b87f5675f2f984e4.Execute() in D:\web\denform.dk\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 7897
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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