Error executing template "Designs/Rapido/_parsed/NewsArticle.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.b__148_0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6137
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 228
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 140
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.b__146_0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6113
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 228
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 140
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 248
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.WriteTo(TextWriter writer, TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 140
   at RazorEngine.Templating.TemplateWriter.WriteTo(TextWriter writer)
   at RazorEngine.Templating.TemplateBase.Write(TemplateWriter helper)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5d0010b7b2f64ed6831f17fcfc30da64.Execute() in Z:\Sites\_dotFusion\incarca-prepay\Files\Templates\Designs\Rapido\_parsed\NewsArticle.parsed.cshtml:line 6094
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineCore.RunTemplate(ICompiledTemplate template, TextWriter writer, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.DynamicWrapperService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.RunCompile(IRazorEngineService service, ITemplateSource templateSource, String name, Type modelType, Object model, DynamicViewBag viewBag)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2 3 @using System.Web; 4 @using Dynamicweb.Frontend 5 @using Dynamicweb.Frontend.Devices 6 @using Dynamicweb.Extensibility 7 @using Dynamicweb.Content 8 @using Dynamicweb.Security 9 @using Dynamicweb.Core 10 @using System 11 @using System.Web 12 @using System.IO 13 @using Dynamicweb.Rapido.Blocks 14 @using System.Net 15 16 @{ 17 18 } 19 20 21 @functions { 22 BlocksPage masterPage = BlocksPage.GetBlockPage("Master"); 23 24 string getFontFamily(params string[] items) 25 { 26 var itemParent = Pageview.AreaSettings; 27 foreach (var item in items) 28 { 29 itemParent = itemParent.GetItem(item); 30 if (itemParent == null) 31 { 32 return null; 33 } 34 } 35 36 var googleFont = itemParent.GetGoogleFont("FontFamily"); 37 if (googleFont == null) 38 { 39 return null; 40 } 41 return googleFont.Family.Replace(" ", "+"); 42 } 43 } 44 45 @{ 46 //Font settings 47 var fonts = new string[] { 48 getFontFamily("Layout", "HeaderFont"), 49 getFontFamily("Layout", "SubheaderFont"), 50 getFontFamily("Layout", "TertiaryHeaderFont"), 51 getFontFamily("Layout", "Header", "ToolsFont"), 52 getFontFamily("Layout", "Header", "NavigationFont"), 53 getFontFamily("Layout", "MobileNavigation", "Font"), 54 getFontFamily("ProductList", "Facets", "HeaderFont"), 55 getFontFamily("ProductPage", "PriceFontDesign"), 56 getFontFamily("Ecommerce", "SaleSticker", "Font"), 57 getFontFamily("Ecommerce", "NewSticker", "Font"), 58 getFontFamily("Ecommerce", "CustomSticker", "Font") 59 }; 60 61 string autoCssLink = "/Files/Templates/Designs/Rapido/css/rapido/rapido_" + Model.Area.ID.ToString() + ".min.css?ticks=" + Model.Area.UpdatedDate.Ticks; 62 string favicon = Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoFavicon").Path : "/Files/Images/favicon.png"; 63 bool useFontAwesomePro = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetBoolean("UseFontAwesomePro"); 64 string fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomeFree/css/fontawesome-all.min.css"; 65 if (useFontAwesomePro) 66 { 67 fontAwesomeCssLink = "/Files/Templates/Designs/Rapido/css/fonts/FontAwesomePro/css/fontawesome-all.min.css"; 68 } 69 } 70 71 @{ 72 Block master = new Block() 73 { 74 Id = "Master", 75 BlocksList = new List<Block> { 76 new Block { 77 Id = "MasterTopSnippets", 78 SortId = 10 79 }, 80 new Block { 81 Id = "MasterMain", 82 SortId = 20, 83 Template = RenderMain(), 84 SkipRenderBlocksList = true, 85 BlocksList = new List<Block> { 86 new Block { 87 Id = "MasterHeader", 88 SortId = 10, 89 Template = RenderMasterHeader(), 90 SkipRenderBlocksList = true 91 }, 92 new Block { 93 Id = "MasterPageContent", 94 SortId = 20, 95 Template = RenderPageContent() 96 } 97 } 98 }, 99 new Block { 100 Id = "MasterFooter", 101 SortId = 30 102 }, 103 new Block { 104 Id = "MasterReferences", 105 SortId = 40 106 }, 107 new Block { 108 Id = "MasterBottomSnippets", 109 SortId = 50 110 } 111 } 112 }; 113 114 masterPage.Add(master); 115 } 116 117 @* Include the required Grid builder (Contains the methods @RenderBlockList and @RenderBlock) *@ 118 @using System.Text.RegularExpressions 119 @using System.Collections.Generic 120 @using System.Reflection 121 @using System.Web.UI.HtmlControls 122 @using Dynamicweb.Rapido.Blocks.Components 123 @using Dynamicweb.Rapido.Blocks.Components.Articles 124 @using Dynamicweb.Rapido.Blocks.Components.Documentation 125 @using Dynamicweb.Rapido.Blocks 126 127 128 @*--- START: Base block renderers ---*@ 129 130 @helper RenderBlockList(List<Block> blocks) 131 { 132 blocks = blocks.OrderBy(item => item.SortId).ToList(); 133 134 foreach (Block item in blocks) 135 { 136 <!-- START: @item.Id --> 137 138 if (item.Design == null) 139 { 140 @RenderBlock(item) 141 } 142 else if (item.Design.RenderType == RenderType.None) { 143 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 144 145 <div class="@cssClass dw-mod"> 146 @RenderBlock(item) 147 </div> 148 } 149 else if (item.Design.RenderType != RenderType.Hide) 150 { 151 string cssClass = item.Design.CssClass != null ? item.Design.CssClass : ""; 152 153 if (!item.SkipRenderBlocksList) { 154 if (item.Design.RenderType == RenderType.Row) 155 { 156 <div class="grid grid--align-content-start @cssClass dw-mod" id="Block__@item.Id"> 157 @RenderBlock(item) 158 </div> 159 } 160 161 if (item.Design.RenderType == RenderType.Column) 162 { 163 string hidePadding = item.Design.HidePadding ? "u-no-padding" : ""; 164 string size = item.Design.Size ?? "12"; 165 size = Regex.IsMatch(size, @"\d") ? "md-" + item.Design.Size : item.Design.Size; 166 167 <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"> 168 @RenderBlock(item) 169 </div> 170 } 171 172 if (item.Design.RenderType == RenderType.Table) 173 { 174 <table class="table @cssClass dw-mod" id="Block__@item.Id"> 175 @RenderBlock(item) 176 </table> 177 } 178 179 if (item.Design.RenderType == RenderType.TableRow) 180 { 181 <tr class="@cssClass dw-mod" id="Block__@item.Id"> 182 @RenderBlock(item) 183 </tr> 184 } 185 186 if (item.Design.RenderType == RenderType.TableColumn) 187 { 188 <td class="@cssClass dw-mod" id="Block__@item.Id"> 189 @RenderBlock(item) 190 </td> 191 } 192 193 if (item.Design.RenderType == RenderType.CardHeader) 194 { 195 <div class="card-header @cssClass dw-mod"> 196 @RenderBlock(item) 197 </div> 198 } 199 200 if (item.Design.RenderType == RenderType.CardBody) 201 { 202 <div class="card @cssClass dw-mod"> 203 @RenderBlock(item) 204 </div> 205 } 206 207 if (item.Design.RenderType == RenderType.CardFooter) 208 { 209 <div class="card-footer @cssClass dw-mod"> 210 @RenderBlock(item) 211 </div> 212 } 213 } 214 else 215 { 216 @RenderBlock(item) 217 } 218 } 219 220 <!-- END: @item.Id --> 221 } 222 } 223 224 @helper RenderBlock(Block item) 225 { 226 if (item.Template != null) 227 { 228 @BlocksPage.RenderTemplate(item.Template) 229 } 230 231 if (item.Component != null) 232 { 233 string methodName = item.Component.HelperName; 234 dynamic[] methodParameters = new dynamic[1]; 235 methodParameters[0] = item.Component; 236 Type methodType = this.GetType(); 237 MethodInfo generalMethod = methodType.GetMethod(methodName); 238 239 if (generalMethod != null) { 240 @generalMethod.Invoke(this, methodParameters).ToString(); 241 } else { 242 throw new Exception(item.Component.GetType().Name + " method '" + methodName +"' could not be invoked"); 243 } 244 } 245 246 if (item.BlocksList.Count > 0 && !item.SkipRenderBlocksList) 247 { 248 @RenderBlockList(item.BlocksList) 249 } 250 } 251 252 @*--- END: Base block renderers ---*@ 253 254 255 @* Include the components *@ 256 @using Dynamicweb.Rapido.Blocks.Components 257 @using Dynamicweb.Rapido.Blocks.Components.General 258 @using Dynamicweb.Rapido.Blocks 259 260 261 @* Components *@ 262 @using System.Reflection 263 @using Dynamicweb.Rapido.Blocks.Components.General 264 265 266 @* Component *@ 267 268 @helper RenderIcon(Icon settings) { 269 if (settings != null) 270 { 271 dynamic[] methodParameters = new dynamic[1]; 272 methodParameters[0] = settings; 273 MethodInfo customMethod = this.GetType().GetMethod("RenderIconCustom"); 274 275 if (customMethod != null) 276 { 277 @customMethod.Invoke(this, methodParameters).ToString(); 278 } else { 279 string color = settings.Color != null ? "style=\"color: " + settings.Color + "\"" : ""; 280 281 if (settings.Name != null) 282 { 283 if (String.IsNullOrEmpty(settings.Label)) { 284 <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> 285 } else { 286 if (settings.LabelPosition == IconLabelPosition.Before) { 287 <span>@settings.Label <i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i></span> 288 } else { 289 <span><i class="@settings.Prefix @settings.Name @settings.CssClass" @color></i> @settings.Label</span> 290 } 291 } 292 } 293 } 294 } 295 } 296 @using System.Reflection 297 @using Dynamicweb.Rapido.Blocks.Components.General 298 @using Dynamicweb.Rapido.Blocks.Components 299 300 301 @* Component *@ 302 303 @helper RenderButton(Button settings) { 304 dynamic[] methodParameters = new dynamic[1]; 305 methodParameters[0] = settings; 306 MethodInfo customMethod = this.GetType().GetMethod("RenderButtonCustom"); 307 308 if (customMethod != null) 309 { 310 @customMethod.Invoke(this, methodParameters).ToString(); 311 } 312 else 313 { 314 string target; 315 string disabled = settings.Disabled ? "disabled" : ""; 316 string buttonType = settings.ButtonType == ButtonType.Submit ? "submit" : "button"; 317 buttonType = settings.ButtonType == ButtonType.Reset ? "reset" : buttonType; 318 string buttonLayout = settings.ButtonLayout.ToString().ToLower(); 319 320 switch (settings.Target) 321 { 322 case LinkTargetType.Blank: 323 target = "_blank"; 324 break; 325 case LinkTargetType.Parent: 326 target = "_parent"; 327 break; 328 case LinkTargetType.Self: 329 target = "_self"; 330 break; 331 case LinkTargetType.Top: 332 target = "_top"; 333 break; 334 default: 335 target = "_self"; 336 break; 337 } 338 339 string onClickAction = settings.OnClick != null ? settings.OnClick : ""; 340 string noOpener = target == "_blank" ? "rel=\"noopener\"" : ""; 341 342 if (!String.IsNullOrEmpty(settings.ConfirmText)) 343 { 344 string modalId = settings.Id; 345 @RenderConfirmDialog(settings); 346 onClickAction = "document.getElementById('" + modalId + "ModalTrigger').checked = true"; 347 } 348 349 if (settings.Icon != null) 350 { 351 if (settings.IconPosition == null) { 352 settings.Icon.LabelPosition = IconLabelPosition.After; 353 } else { 354 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 355 } 356 if (settings.Icon.Label == null) { 357 settings.Icon.Label = settings.Title; 358 } 359 } 360 string content = settings.Icon == null ? settings.Title : Convert.ToString(RenderIcon(settings.Icon)); 361 362 if (!String.IsNullOrEmpty(settings.Link) && String.IsNullOrEmpty(settings.ConfirmText)) 363 { 364 <a href="@settings.Link" target="@target" @noOpener class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</a> 365 } 366 else 367 { 368 <button type="@buttonType" class="btn btn--@buttonLayout @settings.CssClass @disabled dw-mod" onclick="@onClickAction" @ComponentMethods.AddAttributes(settings.ExtraAttributes) @disabled>@content</button> 369 } 370 } 371 } 372 373 374 @helper RenderConfirmDialog(Button settings) { 375 dynamic[] methodParameters = new dynamic[1]; 376 methodParameters[0] = settings; 377 MethodInfo customMethod = this.GetType().GetMethod("RenderConfirmDialogCustom"); 378 379 if (customMethod != null) 380 { 381 @customMethod.Invoke(this, methodParameters).ToString(); 382 } else { 383 string modalTriggerId = settings.Id + "ModalTrigger"; 384 385 <!-- Trigger for the confirm modal --> 386 <input type="checkbox" id="@modalTriggerId" class="modal-trigger" /> 387 388 <!-- Login modal --> 389 <div class="modal-container"> 390 <label for="@modalTriggerId" class="modal-overlay"></label> 391 <div class="modal modal--xs"> 392 <div class="modal__header"> 393 <h2>@settings.ConfirmText</h2> 394 </div> 395 <div class="modal__body"> 396 @RenderButton(new Button { Title = Translate("OK"), ButtonLayout = ButtonLayout.Primary, OnClick = settings.OnClick, CssClass = "u-full-width", Link = settings.Link }) 397 </div> 398 </div> 399 </div> 400 } 401 } 402 @using System.Reflection 403 @using Dynamicweb.Rapido.Blocks.Components 404 @using Dynamicweb.Rapido.Blocks.Components.General 405 @using Dynamicweb.Rapido.Blocks 406 407 408 @* Component *@ 409 410 @helper RenderRating(Rating settings) 411 { 412 dynamic[] methodParameters = new dynamic[1]; 413 methodParameters[0] = settings; 414 MethodInfo customMethod = this.GetType().GetMethod("RenderRatingCustom"); 415 416 if (customMethod != null) 417 { 418 @customMethod.Invoke(this, methodParameters).ToString(); 419 } else { 420 if (settings.Score > 0) 421 { 422 int rating = settings.Score; 423 string iconType = "fa-star"; 424 425 switch (settings.Type.ToString()) { 426 case "Stars": 427 iconType = "fa-star"; 428 break; 429 case "Hearts": 430 iconType = "fa-heart"; 431 break; 432 case "Lemons": 433 iconType = "fa-lemon"; 434 break; 435 case "Bombs": 436 iconType = "fa-bomb"; 437 break; 438 } 439 440 <div class="u-ta-right"> 441 @for (int i = 0; i < settings.OutOf; i++) 442 { 443 <i class="@(rating > i ? "fas" : "far") @iconType"></i> 444 } 445 </div> 446 } 447 } 448 } 449 @using System.Reflection 450 @using Dynamicweb.Rapido.Blocks.Components.General 451 @using Dynamicweb.Rapido.Blocks.Components 452 453 454 @* Component *@ 455 456 @helper RenderFieldListOption(FieldListOption settings) { 457 dynamic[] methodParameters = new dynamic[1]; 458 methodParameters[0] = settings; 459 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldListOptionCustom"); 460 461 if (customMethod != null) 462 { 463 @customMethod.Invoke(this, methodParameters).ToString(); 464 } else { 465 string disabled = settings.Disabled ? "disabled" : ""; 466 string selected = settings.Checked ? "checked" : ""; 467 468 if (settings.Type.ToString() == "RadioButton") 469 { 470 <input class="form__control @disabled dw-mod" onchange="@settings.OnChange" onclick="@settings.OnClick" type="radio" name="@settings.Name" id="@settings.Id" value="@settings.Value" @selected @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 471 <label for="@settings.Id" class="u-inline @disabled dw-mod">@settings.Label</label> 472 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 473 } 474 475 if (settings.Type.ToString() == "Checkbox") 476 { 477 @RenderCheckboxField(settings) 478 } 479 480 if (settings.Type.ToString() == "SelectOption") 481 { 482 <option value="@settings.Value" id="@settings.Id" onclick="@settings.OnClick" class="@disabled" @disabled @selected @ComponentMethods.AddAttributes(settings.ExtraAttributes) >@settings.Name</option> 483 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 484 } 485 } 486 } 487 488 @using System.Reflection 489 @using Dynamicweb.Rapido.Blocks.Components.General 490 @using Dynamicweb.Rapido.Blocks.Components 491 492 493 @* Component *@ 494 495 @helper RenderNavigation(Navigation settings) { 496 dynamic[] methodParameters = new dynamic[1]; 497 methodParameters[0] = settings; 498 MethodInfo customMethod = this.GetType().GetMethod("RenderNavigationCustom"); 499 500 if (customMethod != null) 501 { 502 @customMethod.Invoke(this, methodParameters).ToString(); 503 } else { 504 @RenderNavigation(new 505 { 506 id = settings.Id, 507 cssclass = settings.CssClass, 508 startLevel = settings.StartLevel, 509 endlevel = settings.EndLevel, 510 expandmode = settings.Expandmode, 511 template = settings.Template 512 }) 513 } 514 } 515 @using System.Reflection 516 @using Dynamicweb.Rapido.Blocks.Components.General 517 @using Dynamicweb.Rapido.Blocks.Components 518 519 520 @* Component *@ 521 522 @helper RenderBreadcrumbNavigation(BreadcrumbNavigation settings) { 523 dynamic[] methodParameters = new dynamic[1]; 524 methodParameters[0] = settings; 525 MethodInfo customMethod = this.GetType().GetMethod("RenderBreadcrumbNavigationCustom"); 526 527 if (customMethod != null) 528 { 529 @customMethod.Invoke(this, methodParameters).ToString(); 530 } else { 531 settings.Id = String.IsNullOrEmpty(settings.Id) ? "breadcrumb" : settings.Id; 532 settings.Template = String.IsNullOrEmpty(settings.Template) ? "Breadcrumb.xslt" : settings.Template; 533 settings.StartLevel = settings.StartLevel == 0 ? 1 : settings.StartLevel; 534 settings.EndLevel = settings.EndLevel == 10 ? 1 : settings.EndLevel; 535 settings.Expandmode = String.IsNullOrEmpty(settings.Expandmode) ? "all" : settings.Expandmode; 536 537 @RenderNavigation(settings) 538 } 539 } 540 @using System.Reflection 541 @using Dynamicweb.Rapido.Blocks.Components.General 542 543 544 @* Component *@ 545 546 @helper RenderHeading(Heading settings) { 547 dynamic[] methodParameters = new dynamic[1]; 548 methodParameters[0] = settings; 549 MethodInfo customMethod = this.GetType().GetMethod("RenderHeadingCustom"); 550 551 if (customMethod != null) 552 { 553 @customMethod.Invoke(this, methodParameters).ToString(); 554 } else { 555 string startTag = "<h" + settings.Level.ToString() + " class=\"" + settings.CssClass + "\">"; 556 string endTag = "</h" + settings.Level.ToString() + "\">"; 557 558 if (settings.Icon != null) 559 { 560 if (settings.IconPosition == null) { 561 settings.Icon.LabelPosition = IconLabelPosition.After; 562 } else { 563 settings.Icon.LabelPosition = settings.IconPosition == IconPosition.Before ? IconLabelPosition.After : IconLabelPosition.Before; 564 } 565 if (settings.Icon.Label == null) { 566 settings.Icon.Label = settings.Title; 567 } 568 569 @startTag@RenderIcon(settings.Icon)@endTag 570 } else { 571 @startTag@settings.Title@endTag 572 } 573 } 574 } 575 @using System.Reflection 576 @using Dynamicweb.Rapido.Blocks.Components 577 @using Dynamicweb.Rapido.Blocks.Components.General 578 @using Dynamicweb.Rapido.Blocks 579 580 581 @* Component *@ 582 583 @helper RenderImage(Image settings) 584 { 585 if (settings.Path != null) 586 { 587 dynamic[] methodParameters = new dynamic[1]; 588 methodParameters[0] = settings; 589 MethodInfo customMethod = this.GetType().GetMethod("RenderImageCustom"); 590 591 if (customMethod != null) 592 { 593 @customMethod.Invoke(this, methodParameters).ToString(); 594 } else { 595 <div> 596 @if (settings.Link != null) 597 { 598 <a href="@settings.Link"> 599 @RenderTheImage(settings); 600 </a> 601 } 602 else 603 { 604 @RenderTheImage(settings); 605 } 606 </div> 607 } 608 } 609 } 610 611 @functions { 612 string getImagePathFromSettings(ImageSettings settings) 613 { 614 string result = ""; 615 616 if (settings != null) 617 { 618 result += settings.Width != 0 ? "Width=" + settings.Width + "&" : ""; 619 result += settings.Height != 0 ? "Height=" + settings.Height + "&" : ""; 620 result += "Crop=" + settings.Crop + "&"; 621 result += "Compression=" + settings.Compression + "&"; 622 result += "DoNotUpscale=" + settings.DoNotUpscale.ToString() + "&"; 623 result += "FillCanvas=" + settings.FillCanvas.ToString() + "&"; 624 } 625 626 return result; 627 } 628 } 629 630 @helper RenderTheImage(Image settings) 631 { 632 if (settings != null) 633 { 634 dynamic[] methodParameters = new dynamic[1]; 635 methodParameters[0] = settings; 636 MethodInfo customMethod = this.GetType().GetMethod("RenderTheImageCustom"); 637 638 if (customMethod != null) 639 { 640 @customMethod.Invoke(this, methodParameters).ToString(); 641 } else { 642 string placeholderImage = "/Files/Images/placeholder.gif"; 643 string imageEngine = "/Admin/Public/GetImage.ashx?"; 644 645 string imageStyle = ""; 646 647 switch (settings.Style) 648 { 649 case ImageStyle.Ball: 650 imageStyle = "grid__cell-img--ball"; 651 break; 652 } 653 654 if (settings.Style == ImageStyle.Ball || settings.Style == ImageStyle.Circle) 655 { 656 if (settings.ImageDefault != null) 657 { 658 settings.ImageDefault.Height = settings.ImageDefault.Width; 659 } 660 if (settings.ImageMedium != null) 661 { 662 settings.ImageMedium.Height = settings.ImageMedium.Width; 663 } 664 if (settings.ImageSmall != null) 665 { 666 settings.ImageSmall.Height = settings.ImageSmall.Width; 667 } 668 } 669 670 string defaultImage = imageEngine; 671 string imageSmall = ""; 672 string imageMedium = ""; 673 674 if (settings.DisableImageEngine) { 675 defaultImage = settings.Path; 676 } else { 677 if (settings.ImageDefault != null) 678 { 679 defaultImage += getImagePathFromSettings(settings.ImageDefault); 680 681 if (settings.Path.GetType() != typeof(string)) 682 { 683 defaultImage += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 684 defaultImage += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 685 } 686 else 687 { 688 defaultImage += settings.Path != null ? "Image=" + settings.Path : ""; 689 } 690 } 691 692 if (settings.ImageSmall != null) 693 { 694 imageSmall = "data-src-small=\"" + imageEngine; 695 imageSmall += getImagePathFromSettings(settings.ImageSmall); 696 697 if (settings.Path.GetType() != typeof(string)) 698 { 699 imageSmall += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 700 imageSmall += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 701 } 702 else 703 { 704 imageSmall += settings.Path != null ? "Image=" + settings.Path : ""; 705 } 706 707 imageSmall += "\""; 708 } 709 710 if (settings.ImageMedium != null) 711 { 712 imageMedium = "data-src-medium=\"" + imageEngine; 713 imageMedium += getImagePathFromSettings(settings.ImageMedium); 714 715 if (settings.Path.GetType() != typeof(string)) 716 { 717 imageMedium += settings.Path != null ? "Image=" + settings.Path.PathUrlEncoded : ""; 718 imageMedium += settings.Path != null ? "&" + settings.Path.GetFocalPointParameters() : ""; 719 } 720 else 721 { 722 imageMedium += settings.Path != null ? "Image=" + settings.Path : ""; 723 } 724 725 imageMedium += "\""; 726 } 727 } 728 729 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 730 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick); } 731 if (!String.IsNullOrEmpty(settings.Title)) { optionalAttributes.Add("alt", settings.Title); } 732 733 if (settings.DisableLazyLoad) { 734 <img class="grid__cell-img @imageStyle @settings.CssClass dw-mod" src="@defaultImage" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 735 } else { 736 <img class="grid__cell-img b-lazy @imageStyle @settings.CssClass dw-mod" src="@placeholderImage" data-src="@defaultImage" @imageSmall @imageMedium @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 737 } 738 739 if (settings.Caption != null) 740 { 741 <span class="image-caption dw-mod">@settings.Caption</span> 742 } 743 } 744 } 745 } 746 @using System.Reflection 747 @using Dynamicweb.Rapido.Blocks.Components.General 748 @using Dynamicweb.Rapido.Blocks.Components 749 750 751 @* Component *@ 752 753 @helper RenderTextField(TextField settings) { 754 dynamic[] methodParameters = new dynamic[1]; 755 methodParameters[0] = settings; 756 MethodInfo customMethod = this.GetType().GetMethod("RenderTextFieldCustom"); 757 758 if (customMethod != null) 759 { 760 @customMethod.Invoke(this, methodParameters).ToString(); 761 } else { 762 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 763 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 764 if (settings.Type == TextFieldType.Password) { optionalAttributes.Add("autocomplete", "off"); }; 765 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 766 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 767 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 768 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 769 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 770 771 <div class="form__field-group dw-mod"> 772 @if (!String.IsNullOrEmpty(settings.Label)) 773 { 774 <label for="@settings.Id">@settings.Label</label> 775 } 776 777 <input type="@settings.Type" class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 778 779 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 780 </div> 781 } 782 } 783 @using System.Reflection 784 @using Dynamicweb.Rapido.Blocks.Components.General 785 @using Dynamicweb.Rapido.Blocks.Components 786 787 788 @* Component *@ 789 790 @helper RenderNumberField(NumberField settings) { 791 dynamic[] methodParameters = new dynamic[1]; 792 methodParameters[0] = settings; 793 MethodInfo customMethod = this.GetType().GetMethod("RenderNumberFieldCustom"); 794 795 if (customMethod != null) 796 { 797 @customMethod.Invoke(this, methodParameters).ToString(); 798 } else { 799 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 800 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 801 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 802 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 803 if (settings.Max != 0) { optionalAttributes.Add("max", settings.Max.ToString()); } 804 if (settings.Min != 0) { optionalAttributes.Add("min", settings.Min.ToString()); } 805 if (settings.Step != 0) { optionalAttributes.Add("step", settings.Step.ToString()); } 806 807 <div class="form__field-group dw-mod"> 808 @if (!String.IsNullOrEmpty(settings.Label)) 809 { 810 <div> 811 <label for="@settings.Id">@settings.Label</label> 812 </div> 813 } 814 815 <input type="Number" class="u-w70px @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 816 817 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 818 </div> 819 } 820 } 821 @using System.Reflection 822 @using Dynamicweb.Rapido.Blocks.Components.General 823 @using Dynamicweb.Rapido.Blocks.Components 824 825 826 @* Component *@ 827 828 @helper RenderTextareaField(TextareaField settings) { 829 dynamic[] methodParameters = new dynamic[1]; 830 methodParameters[0] = settings; 831 MethodInfo customMethod = this.GetType().GetMethod("RenderTextareaFieldCustom"); 832 833 if (customMethod != null) 834 { 835 @customMethod.Invoke(this, methodParameters).ToString(); 836 } else { 837 int maxLength = settings.MaxLength != 0 ? settings.MaxLength : 524288; 838 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 839 if (!String.IsNullOrEmpty(settings.OnClick)) { optionalAttributes.Add("onclick", settings.OnClick.ToString()); } 840 if (!String.IsNullOrEmpty(settings.Placeholder)) { optionalAttributes.Add("placeholder", settings.Placeholder); } 841 if (settings.Disabled) { optionalAttributes.Add("disabled", settings.Disabled.ToString()); } 842 if (settings.Required) { optionalAttributes.Add("required", settings.Required.ToString()); } 843 if (settings.MaxLength != 0) { optionalAttributes.Add("maxlength", settings.MaxLength.ToString()); } 844 if (settings.Rows != 0) { optionalAttributes.Add("rows", settings.Rows.ToString()); } 845 846 <div class="form__field-group dw-mod"> 847 @if (!String.IsNullOrEmpty(@settings.Label)) 848 { 849 <label for="@settings.Id">@settings.Label</label> 850 } 851 852 <textarea class="u-full-width @settings.CssClass dw-mod" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)></textarea> 853 854 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 855 </div> 856 } 857 } 858 @using System.Reflection 859 @using Dynamicweb.Rapido.Blocks.Components.General 860 @using Dynamicweb.Rapido.Blocks.Components 861 862 863 @* Component *@ 864 865 @helper RenderHiddenField(HiddenField settings) { 866 dynamic[] methodParameters = new dynamic[1]; 867 methodParameters[0] = settings; 868 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 869 870 if (customMethod != null) 871 { 872 @customMethod.Invoke(this, methodParameters).ToString(); 873 } else { 874 <input type="hidden" name="@settings.Id" id="@(settings.Id)" value="@settings.Value" @ComponentMethods.AddAttributes(settings.ExtraAttributes)/> 875 } 876 } 877 @using System.Reflection 878 @using Dynamicweb.Rapido.Blocks.Components.General 879 @using Dynamicweb.Rapido.Blocks.Components 880 881 882 @* Component *@ 883 884 @helper RenderCheckboxField(dynamic settings) { 885 dynamic[] methodParameters = new dynamic[1]; 886 methodParameters[0] = settings; 887 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxFieldCustom"); 888 889 if (customMethod != null) 890 { 891 @customMethod.Invoke(this, methodParameters).ToString(); 892 } else { 893 settings.Type = FieldListOptionType.Checkbox; 894 string disabled = settings.Disabled ? "disabled" : ""; 895 string required = settings.Required ? "required" : ""; 896 string checkedString = settings.Checked == true ? "checked" : ""; 897 string id = settings.Id != null ? settings.Id : settings.Label.Replace(" ", ""); 898 899 <div class="form__field-group dw-mod"> 900 <input type="checkbox" class="form__control @settings.CssClass @disabled dw-mod" name="@settings.Name" id="@id" value="@settings.Value" onclick="@settings.OnClick" @disabled @required @checkedString @ComponentMethods.AddAttributes(settings.ExtraAttributes) /> 901 902 @if (!String.IsNullOrEmpty(settings.Label)) 903 { 904 <label for="@id" class="@disabled dw-mod">@settings.Label</label> 905 } 906 907 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 908 </div> 909 } 910 } 911 @using System.Reflection 912 @using Dynamicweb.Rapido.Blocks.Components.General 913 @using Dynamicweb.Rapido.Blocks.Components 914 915 916 @* Component *@ 917 918 @helper RenderCheckboxListField(CheckboxListField settings) { 919 dynamic[] methodParameters = new dynamic[1]; 920 methodParameters[0] = settings; 921 MethodInfo customMethod = this.GetType().GetMethod("RenderCheckboxListFieldCustom"); 922 923 if (customMethod != null) 924 { 925 @customMethod.Invoke(this, methodParameters).ToString(); 926 } else { 927 string disabled = settings.Disabled ? "disabled" : ""; 928 929 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled dw-mod" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 930 @if (!String.IsNullOrEmpty(settings.Label)) 931 { 932 <div class="u-bold u-margin-bottom">@settings.Label</div> 933 } 934 935 @foreach (var item in settings.Options) 936 { 937 item.Type = FieldListOptionType.Checkbox; 938 @RenderFieldListOption(item) 939 } 940 941 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 942 </div> 943 } 944 } 945 946 @using System.Reflection 947 @using Dynamicweb.Rapido.Blocks.Components.General 948 @using Dynamicweb.Rapido.Blocks.Components 949 950 951 @* Component *@ 952 953 @helper RenderSelectField(SelectField settings) { 954 dynamic[] methodParameters = new dynamic[1]; 955 methodParameters[0] = settings; 956 MethodInfo customMethod = this.GetType().GetMethod("RenderSelectFieldCustom"); 957 958 if (customMethod != null) 959 { 960 @customMethod.Invoke(this, methodParameters).ToString(); 961 } else { 962 string disabled = settings.Disabled ? "disabled" : ""; 963 string required = settings.Required ? "required" : ""; 964 965 if (settings.Default != null) 966 { 967 settings.Default.Type = FieldListOptionType.SelectOption; 968 } 969 970 <div class="form__field-group u-full-width dw-mod"> 971 @if (!String.IsNullOrEmpty(settings.Label)) 972 { 973 <label for="@settings.Id">@settings.Label</label> 974 } 975 976 <div class="form__field-combi u-no-margin dw-mod"> 977 <select id="@settings.Id" class="u-full-width @settings.CssClass dw-mod" onchange="@settings.OnChange" @ComponentMethods.AddAttributes(settings.ExtraAttributes) > 978 @if (settings.Default.Value != null) 979 { 980 @RenderFieldListOption(settings.Default) 981 } 982 983 @foreach (var item in settings.Options) 984 { 985 item.Type = FieldListOptionType.SelectOption; 986 @RenderFieldListOption(item) 987 } 988 </select> 989 @if (settings.ActionButton.Link != null || settings.ActionButton.OnClick != null) { 990 settings.ActionButton.CssClass += " btn--condensed u-no-margin"; 991 @RenderButton(settings.ActionButton); 992 } 993 </div> 994 995 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 996 </div> 997 } 998 } 999 @using System.Reflection 1000 @using Dynamicweb.Rapido.Blocks.Components.General 1001 @using Dynamicweb.Rapido.Blocks.Components 1002 1003 1004 @* Component *@ 1005 1006 @helper RenderRadioButtonField(RadioButtonField settings) { 1007 dynamic[] methodParameters = new dynamic[1]; 1008 methodParameters[0] = settings; 1009 MethodInfo customMethod = this.GetType().GetMethod("RenderRadioButtonFieldCustom"); 1010 1011 if (customMethod != null) 1012 { 1013 @customMethod.Invoke(this, methodParameters).ToString(); 1014 } else { 1015 string disabled = settings.Disabled ? "disabled" : ""; 1016 1017 <div class="form__field-group @settings.CssClass u-margin-bottom @disabled" @disabled @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1018 @if (!String.IsNullOrEmpty(settings.Label)) 1019 { 1020 <div class="u-bold u-margin-bottom">@settings.Label</div> 1021 } 1022 1023 @foreach (var item in settings.Options) 1024 { 1025 item.Type = FieldListOptionType.RadioButton; 1026 1027 if (settings.Name != null) 1028 { 1029 item.Name = settings.Name; 1030 } 1031 1032 if (settings.RenderOptionsInline) 1033 { 1034 @RenderFieldListOption(item) 1035 } 1036 else 1037 { 1038 <div> 1039 @RenderFieldListOption(item) 1040 </div> 1041 } 1042 } 1043 1044 @RenderNotificationMessage(new NotificationMessage { Message = settings.ErrorMessage }) 1045 </div> 1046 } 1047 } 1048 @using System.Reflection 1049 @using Dynamicweb.Rapido.Blocks.Components.General 1050 @using Dynamicweb.Rapido.Blocks.Components 1051 1052 1053 @* Component *@ 1054 1055 @helper RenderNotificationMessage(NotificationMessage settings) { 1056 dynamic[] methodParameters = new dynamic[1]; 1057 methodParameters[0] = settings; 1058 MethodInfo customMethod = this.GetType().GetMethod("RenderNotificationMessageCustom"); 1059 1060 if (customMethod != null) 1061 { 1062 @customMethod.Invoke(this, methodParameters).ToString(); 1063 } else { 1064 if (!String.IsNullOrEmpty(settings.Message)) 1065 { 1066 string messageTypeClass = settings.MessageType.ToString().ToLower(); 1067 <div class="field-@messageTypeClass @settings.CssClass u-full-width dw-mod">@settings.Message</div> 1068 } 1069 } 1070 } 1071 @using System.Reflection 1072 @using Dynamicweb.Rapido.Blocks.Components.General 1073 1074 1075 @* Component *@ 1076 1077 @helper RenderHandlebarsRoot(HandlebarsRoot settings) { 1078 dynamic[] methodParameters = new dynamic[1]; 1079 methodParameters[0] = settings; 1080 MethodInfo customMethod = this.GetType().GetMethod("RenderHandlebarsRootCustom"); 1081 1082 if (customMethod != null) 1083 { 1084 @customMethod.Invoke(this, methodParameters).ToString(); 1085 } else { 1086 string preRender = !String.IsNullOrEmpty(settings.PreRenderScriptTemplate) ? "data-pre-render-template=\"" + settings.PreRenderScriptTemplate + "\"" : ""; 1087 1088 <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> 1089 @if (settings.SubBlocks != null) { 1090 @RenderBlockList(settings.SubBlocks) 1091 } 1092 </div> 1093 } 1094 } 1095 @using System.Reflection 1096 @using Dynamicweb.Rapido.Blocks.Components.General 1097 @using Dynamicweb.Rapido.Blocks.Components 1098 @using System.Text.RegularExpressions 1099 1100 1101 @* Component *@ 1102 1103 @helper RenderSticker(Sticker settings) { 1104 dynamic[] methodParameters = new dynamic[1]; 1105 methodParameters[0] = settings; 1106 MethodInfo customMethod = this.GetType().GetMethod("RenderStickerCustom"); 1107 1108 if (customMethod != null) 1109 { 1110 @customMethod.Invoke(this, methodParameters).ToString(); 1111 } 1112 else 1113 { 1114 if (!String.IsNullOrEmpty(settings.Title)) { 1115 string size = settings.Size.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Size.ToString().ToLower() : ""; 1116 string style = settings.Style.ToString() != "None" ? "" + "stickers-container__tag--" + settings.Style.ToString().ToLower() : ""; 1117 1118 Dictionary<String, String> optionalAttributes = new Dictionary<string, string>(); 1119 if (!String.IsNullOrEmpty(settings.Color) || !String.IsNullOrEmpty(settings.BackgroundColor)) { 1120 string styleTag = !String.IsNullOrEmpty(settings.Color) ? "color: " + settings.Color + "; " : ""; 1121 styleTag += !String.IsNullOrEmpty(settings.BackgroundColor) ? "background-color: " + settings.BackgroundColor + "; " : ""; 1122 optionalAttributes.Add("style", styleTag); 1123 } 1124 1125 <div class="stickers-container__tag @size @style @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(optionalAttributes) @ComponentMethods.AddAttributes(settings.ExtraAttributes)>@settings.Title</div> 1126 } 1127 } 1128 } 1129 1130 @using System.Reflection 1131 @using Dynamicweb.Rapido.Blocks.Components.General 1132 @using Dynamicweb.Rapido.Blocks.Components 1133 1134 1135 @* Component *@ 1136 1137 @helper RenderStickersCollection(StickersCollection settings) { 1138 dynamic[] methodParameters = new dynamic[1]; 1139 methodParameters[0] = settings; 1140 MethodInfo customMethod = this.GetType().GetMethod("RenderStickersCollectionCustom"); 1141 1142 if (customMethod != null) 1143 { 1144 @customMethod.Invoke(this, methodParameters).ToString(); 1145 } 1146 else 1147 { 1148 if (settings.Stickers.Count > 0) { 1149 string position = settings.Position != null ? "" + "stickers-container--" + Regex.Replace(settings.Position.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower() : ""; 1150 1151 <div class="stickers-container @position @settings.CssClass dw-mod" @ComponentMethods.AddAttributes(settings.ExtraAttributes)> 1152 @foreach (Sticker sticker in settings.Stickers) 1153 { 1154 @RenderSticker(sticker) 1155 } 1156 </div> 1157 } 1158 } 1159 } 1160 1161 @using System.Reflection 1162 @using Dynamicweb.Rapido.Blocks.Components.General 1163 @using Dynamicweb.Rapido.Blocks.Components 1164 1165 1166 1167 @* Component *@ 1168 1169 @helper RenderField(Field settings) { 1170 dynamic[] methodParameters = new dynamic[1]; 1171 methodParameters[0] = settings; 1172 MethodInfo customMethod = this.GetType().GetMethod("RenderFieldCustom"); 1173 1174 if (customMethod != null) 1175 { 1176 @customMethod.Invoke(this, methodParameters).ToString(); 1177 } else { 1178 switch (settings.FieldType) 1179 { 1180 case FieldType.Checkbox: 1181 CheckboxField checkbox = new CheckboxField 1182 { 1183 Label = settings.Label, 1184 Id = settings.Id, 1185 Name = settings.Label.Replace(" ", ""), 1186 Value = settings.Value, 1187 Checked = Convert.ToBoolean(settings.Placeholder), 1188 OnClick = settings.OnClick, 1189 Disabled = settings.Disabled, 1190 Required = settings.Required, 1191 CssClass = settings.CssClass, 1192 ExtraAttributes = settings.ExtraAttributes, 1193 ErrorMessage = settings.ErrorMessage 1194 }; 1195 1196 @RenderCheckboxField(checkbox) 1197 break; 1198 case FieldType.Email: 1199 TextField emailField = new TextField 1200 { 1201 Label = settings.Label != null ? settings.Label : Translate("Email"), 1202 Id = settings.Id, 1203 Value = settings.Value, 1204 OnClick = settings.OnClick, 1205 Disabled = settings.Disabled, 1206 Required = settings.Required, 1207 CssClass = settings.CssClass, 1208 ExtraAttributes = settings.ExtraAttributes, 1209 ErrorMessage = settings.ErrorMessage, 1210 Placeholder = settings.Placeholder, 1211 Type = TextFieldType.Email 1212 }; 1213 1214 @RenderTextField(emailField) 1215 break; 1216 case FieldType.Hidden: 1217 HiddenField hiddenField = new HiddenField 1218 { 1219 Label = settings.Label, 1220 Id = settings.Id, 1221 Value = settings.Value, 1222 Disabled = settings.Disabled, 1223 Required = settings.Required, 1224 CssClass = settings.CssClass, 1225 ExtraAttributes = settings.ExtraAttributes, 1226 ErrorMessage = settings.ErrorMessage 1227 }; 1228 1229 @RenderHiddenField(hiddenField) 1230 break; 1231 case FieldType.Integer: 1232 NumberField numberField = new NumberField 1233 { 1234 Label = settings.Label, 1235 Id = settings.Id, 1236 Value = settings.Value.GetType() == typeof(int) ? Convert.ToInt32(settings.Value) : 1, 1237 OnClick = settings.OnClick, 1238 Disabled = settings.Disabled, 1239 Required = settings.Required, 1240 CssClass = settings.CssClass, 1241 ExtraAttributes = settings.ExtraAttributes, 1242 ErrorMessage = settings.ErrorMessage, 1243 Step = 1 1244 }; 1245 1246 @RenderNumberField(numberField) 1247 break; 1248 case FieldType.Password: 1249 TextField passwordField = new TextField 1250 { 1251 Label = settings.Label != null ? settings.Label : Translate("Password"), 1252 Id = settings.Id, 1253 Value = settings.Value, 1254 OnClick = settings.OnClick, 1255 Disabled = settings.Disabled, 1256 Required = settings.Required, 1257 CssClass = settings.CssClass, 1258 ExtraAttributes = settings.ExtraAttributes, 1259 ErrorMessage = settings.ErrorMessage, 1260 Placeholder = settings.Placeholder, 1261 Type = TextFieldType.Password 1262 }; 1263 1264 @RenderTextField(passwordField) 1265 break; 1266 case FieldType.Reset: 1267 Button resetField = new Button 1268 { 1269 Title = settings.Label != null ? settings.Label : Translate("Reset"), 1270 Id = settings.Id, 1271 OnClick = settings.OnClick, 1272 Disabled = settings.Disabled, 1273 CssClass = settings.CssClass, 1274 ExtraAttributes = settings.ExtraAttributes, 1275 ButtonLayout = ButtonLayout.Secondary, 1276 ButtonType = ButtonType.Reset 1277 }; 1278 1279 @RenderButton(resetField) 1280 break; 1281 case FieldType.Submit: 1282 Button submitField = new Button 1283 { 1284 Title = settings.Label != null ? settings.Label : Translate("Submit"), 1285 Id = settings.Id, 1286 OnClick = settings.OnClick, 1287 Disabled = settings.Disabled, 1288 CssClass = settings.CssClass, 1289 ExtraAttributes = settings.ExtraAttributes, 1290 ButtonLayout = ButtonLayout.Primary, 1291 ButtonType = ButtonType.Submit 1292 }; 1293 1294 @RenderButton(submitField) 1295 break; 1296 case FieldType.Tel: 1297 TextField telField = new TextField 1298 { 1299 Label = settings.Label != null ? settings.Label : Translate("Phone"), 1300 Id = settings.Id, 1301 Value = settings.Value, 1302 OnClick = settings.OnClick, 1303 Disabled = settings.Disabled, 1304 Required = settings.Required, 1305 CssClass = settings.CssClass, 1306 ExtraAttributes = settings.ExtraAttributes, 1307 ErrorMessage = settings.ErrorMessage, 1308 Placeholder = settings.Placeholder, 1309 Type = TextFieldType.Tel 1310 }; 1311 1312 @RenderTextField(telField) 1313 break; 1314 case FieldType.Text: 1315 TextField textField = new TextField 1316 { 1317 Label = settings.Label, 1318 Id = settings.Id, 1319 Value = settings.Value, 1320 OnClick = settings.OnClick, 1321 Disabled = settings.Disabled, 1322 Required = settings.Required, 1323 CssClass = settings.CssClass, 1324 ExtraAttributes = settings.ExtraAttributes, 1325 ErrorMessage = settings.ErrorMessage, 1326 Placeholder = settings.Placeholder, 1327 Type = TextFieldType.Text 1328 }; 1329 1330 @RenderTextField(textField) 1331 break; 1332 case FieldType.Textarea: 1333 TextareaField textareaField = new TextareaField 1334 { 1335 Label = settings.Label, 1336 Id = settings.Id, 1337 Value = settings.Value, 1338 OnClick = settings.OnClick, 1339 Disabled = settings.Disabled, 1340 Required = settings.Required, 1341 CssClass = settings.CssClass, 1342 ExtraAttributes = settings.ExtraAttributes, 1343 ErrorMessage = settings.ErrorMessage, 1344 Placeholder = settings.Placeholder 1345 }; 1346 1347 @RenderTextareaField(textareaField) 1348 break; 1349 default: 1350 TextField defaultField = new TextField 1351 { 1352 Label = settings.Label, 1353 Id = settings.Id, 1354 Value = settings.Value, 1355 OnClick = settings.OnClick, 1356 Disabled = settings.Disabled, 1357 Required = settings.Required, 1358 CssClass = settings.CssClass, 1359 ExtraAttributes = settings.ExtraAttributes, 1360 ErrorMessage = settings.ErrorMessage, 1361 Placeholder = settings.Placeholder, 1362 Type = TextFieldType.Text 1363 }; 1364 1365 @RenderTextField(defaultField) 1366 break; 1367 } 1368 } 1369 } 1370 1371 1372 @using Dynamicweb.Frontend 1373 @using System.Reflection 1374 @using Dynamicweb.Content.Items 1375 @using System.Web.UI.HtmlControls 1376 @using Dynamicweb.Rapido.Blocks.Components 1377 @using Dynamicweb.Rapido.Blocks 1378 1379 1380 @* Components for the articles *@ 1381 @using System.Reflection 1382 @using Dynamicweb.Rapido.Blocks.Components.Articles 1383 1384 1385 @* Component for the articles *@ 1386 1387 @helper RenderArticleBanner(dynamic settings) { 1388 dynamic[] methodParameters = new dynamic[1]; 1389 methodParameters[0] = settings; 1390 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerCustom"); 1391 1392 if (customMethod != null) 1393 { 1394 @customMethod.Invoke(this, methodParameters).ToString(); 1395 } else { 1396 string filterClasses = "image-filter image-filter--darken"; 1397 settings.Layout = ArticleHeaderLayout.Banner; 1398 1399 if (settings.Image != null) 1400 { 1401 if (settings.Image.Path != null) 1402 { 1403 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1404 <div class="background-image @filterClasses dw-mod"> 1405 <div class="background-image__wrapper @filterClasses dw-mod"> 1406 @{ 1407 settings.Image.CssClass += "background-image__cover dw-mod"; 1408 } 1409 @RenderImage(settings.Image) 1410 </div> 1411 </div> 1412 <div class="center-container dw-mod"> 1413 <div class="grid"> 1414 <div class="grid__col-md-8 grid__col-xs-12 paragraph-container paragraph-container--height-lg"> 1415 <div class="u-left-middle"> 1416 <div> 1417 @if (!String.IsNullOrEmpty(settings.Heading)) 1418 { 1419 <h1 class="article__header article__header--giant dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1420 } 1421 @if (!String.IsNullOrEmpty(settings.Subheading)) 1422 { 1423 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1424 } 1425 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1426 { 1427 <small class="article__post-info u-margin-bottom--lg dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1428 } 1429 @if (!String.IsNullOrEmpty(settings.Link)) { 1430 <div class="grid__cell"> 1431 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1432 </div> 1433 } 1434 </div> 1435 </div> 1436 </div> 1437 @if (settings.ExternalParagraphId != 0) 1438 { 1439 <div class="grid__col-md-4 grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-auto dw-mod"> 1440 <div class="u-color-light-gray--bg u-color-dark dw-mod"> 1441 @RenderParagraphContent(settings.ExternalParagraphId) 1442 </div> 1443 </div> 1444 } 1445 </div> 1446 </div> 1447 </section> 1448 } 1449 else 1450 { 1451 settings.Layout = ArticleHeaderLayout.Clean; 1452 @RenderArticleCleanHeader(settings); 1453 } 1454 } 1455 else 1456 { 1457 settings.Layout = ArticleHeaderLayout.Clean; 1458 @RenderArticleCleanHeader(settings); 1459 } 1460 } 1461 } 1462 @using System.Reflection 1463 @using Dynamicweb.Rapido.Blocks.Components 1464 @using Dynamicweb.Rapido.Blocks.Components.General 1465 @using Dynamicweb.Rapido.Blocks.Components.Articles 1466 @using Dynamicweb.Rapido.Blocks 1467 1468 1469 @* Component for the articles *@ 1470 1471 @helper RenderArticleHeader(ArticleHeader settings) { 1472 dynamic[] methodParameters = new dynamic[1]; 1473 methodParameters[0] = settings; 1474 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleHeaderCustom"); 1475 1476 if (customMethod != null) 1477 { 1478 @customMethod.Invoke(this, methodParameters).ToString(); 1479 } else { 1480 switch (settings.Layout) 1481 { 1482 case ArticleHeaderLayout.Clean: 1483 @RenderArticleCleanHeader(settings); 1484 break; 1485 case ArticleHeaderLayout.Split: 1486 @RenderArticleSplitHeader(settings); 1487 break; 1488 case ArticleHeaderLayout.Banner: 1489 @RenderArticleBannerHeader(settings); 1490 break; 1491 case ArticleHeaderLayout.Overlay: 1492 @RenderArticleOverlayHeader(settings); 1493 break; 1494 default: 1495 @RenderArticleCleanHeader(settings); 1496 break; 1497 } 1498 } 1499 } 1500 1501 @helper RenderArticleCleanHeader(ArticleHeader settings) { 1502 dynamic[] methodParameters = new dynamic[1]; 1503 methodParameters[0] = settings; 1504 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleCleanHeaderCustom"); 1505 1506 if (customMethod != null) 1507 { 1508 @customMethod.Invoke(this, methodParameters).ToString(); 1509 } 1510 else 1511 { 1512 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1513 1514 <div class="grid grid--align-content-start grid--justify-start"> 1515 <div class="grid__col-md-@contentColumns grid__col-sm-12 u-padding--lg dw-mod"> 1516 @if (!String.IsNullOrEmpty(settings.Category) || !String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date) || settings.RatingOutOf != 0) 1517 { 1518 <div class="u-border-bottom u-padding-bottom"> 1519 @if (!String.IsNullOrEmpty(settings.Category)) 1520 { 1521 <div class="u-pull--left"> 1522 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1523 </div> 1524 } 1525 <div class="u-pull--right"> 1526 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1527 { 1528 <small class="article__post-info dw-mod">@settings.Author @settings.Date</small> 1529 } 1530 @if (settings.RatingOutOf != 0) 1531 { 1532 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1533 } 1534 </div> 1535 </div> 1536 } 1537 1538 <div class="grid__cell"> 1539 @if (!String.IsNullOrEmpty(settings.Heading)) 1540 { 1541 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1542 } 1543 @if (settings.Image != null) 1544 { 1545 if (settings.Image.Path != null) 1546 { 1547 <div class="u-padding-bottom--lg"> 1548 @RenderImage(settings.Image) 1549 </div> 1550 } 1551 } 1552 @if (!String.IsNullOrEmpty(settings.Subheading)) 1553 { 1554 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1555 } 1556 @if (!String.IsNullOrEmpty(settings.Link)) 1557 { 1558 <div class="grid__cell"> 1559 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1560 </div> 1561 } 1562 </div> 1563 </div> 1564 @if (settings.ExternalParagraphId != 0) 1565 { 1566 <div class="grid__col-md-4 grid__col-sm-12 u-padding--lg u-color-light-gray--bg dw-mod"> 1567 @RenderParagraphContent(settings.ExternalParagraphId) 1568 </div> 1569 } 1570 </div> 1571 } 1572 } 1573 1574 @helper RenderArticleSplitHeader(ArticleHeader settings) { 1575 dynamic[] methodParameters = new dynamic[1]; 1576 methodParameters[0] = settings; 1577 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSplitHeaderCustom"); 1578 1579 if (customMethod != null) 1580 { 1581 @customMethod.Invoke(this, methodParameters).ToString(); 1582 } 1583 else 1584 { 1585 string headerColumnWidth = settings.ExternalParagraphId != 0 ? "4" : "6"; 1586 1587 if (settings.Image != null) 1588 { 1589 if (settings.Image.Path != null) 1590 { 1591 <section class="multiple-paragraphs-container paragraph-container--full-width"> 1592 <div class="grid"> 1593 <div class="grid__col-md-@headerColumnWidth grid__col-sm-12 grid__col-xs-12 paragraph-container paragraph-container--height-xl dw-mod"> 1594 <div class="u-left-middle u-padding--lg"> 1595 <div> 1596 @if (!String.IsNullOrEmpty(settings.Category)) 1597 { 1598 <div class="article__category dw-mod" style="color: @settings.CategoryColor">@settings.Category</div> 1599 } 1600 @if (!String.IsNullOrEmpty(settings.Heading)) 1601 { 1602 <h1 class="article__header article__header--giant dw-mod">@settings.Heading</h1> 1603 } 1604 @if (!String.IsNullOrEmpty(settings.Subheading)) 1605 { 1606 <div class="article__leadtext dw-mod">@settings.Subheading</div> 1607 } 1608 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1609 { 1610 <small class="article__post-info u-pull--left dw-mod">@settings.Author @settings.Date</small> 1611 } 1612 @if (settings.RatingOutOf != 0) 1613 { 1614 <div class="u-pull--right"> 1615 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1616 </div> 1617 } 1618 @if (!String.IsNullOrEmpty(settings.Link)) { 1619 @RenderButton(new Button { Link = settings.Link, Title = settings.LinkText, ButtonLayout = settings.ButtonLayout }) 1620 } 1621 </div> 1622 </div> 1623 </div> 1624 <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> 1625 @if (settings.ExternalParagraphId != 0) 1626 { 1627 <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"> 1628 @RenderParagraphContent(settings.ExternalParagraphId) 1629 </div> 1630 } 1631 </div> 1632 </section> 1633 } 1634 } 1635 else 1636 { 1637 @RenderArticleCleanHeader(settings); 1638 } 1639 } 1640 } 1641 1642 @helper RenderArticleOverlayHeader(ArticleHeader settings) { 1643 dynamic[] methodParameters = new dynamic[1]; 1644 methodParameters[0] = settings; 1645 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleOverlayHeaderCustom"); 1646 1647 if (customMethod != null) 1648 { 1649 @customMethod.Invoke(this, methodParameters).ToString(); 1650 } 1651 else 1652 { 1653 string contentColumns = settings.TextLayout != ArticleHeaderTextLayout.Full ? "8" : "12"; 1654 string contentAlignment = settings.TextLayout == ArticleHeaderTextLayout.Center ? "grid--justify-center" : ""; 1655 1656 if (settings.Image != null) 1657 { 1658 if (settings.Image.Path != null) 1659 { 1660 if (settings.ExternalParagraphId == 0) 1661 { 1662 <section class="multiple-paragraphs-container u-color-light paragraph-container--full-width"> 1663 <div class="background-image image-filter image-filter--darken dw-mod"> 1664 <div class="background-image__wrapper image-filter image-filter--darken dw-mod"> 1665 @{ 1666 settings.Image.CssClass += "background-image__cover dw-mod"; 1667 } 1668 @RenderImage(settings.Image) 1669 </div> 1670 </div> 1671 <div class="center-container dw-mod"> 1672 <div class="grid @contentAlignment"> 1673 <div class="grid__col-md-@contentColumns grid__col-xs-12 paragraph-container paragraph-container--height-xl u-no-padding dw-mod"> 1674 @if (!String.IsNullOrEmpty(settings.Heading)) 1675 { 1676 <h1 class="article__header article__header--giant u-padding-top--lg dw-mod" style="color: @settings.TextColor">@settings.Heading</h1> 1677 } 1678 @if (!String.IsNullOrEmpty(settings.Subheading)) 1679 { 1680 <div class="article__leadtext dw-mod" style="color: @settings.TextColor">@settings.Subheading</div> 1681 } 1682 <div class="u-margin-top"> 1683 @if (!String.IsNullOrEmpty(settings.Author) || !String.IsNullOrEmpty(settings.Date)) 1684 { 1685 <small class="article__post-info u-pull--left dw-mod" style="color: @settings.TextColor">@settings.Author @settings.Date</small> 1686 } 1687 @if (settings.RatingOutOf != 0) 1688 { 1689 <div class="u-pull--right"> 1690 @RenderRating(new Rating { Score = settings.RatingScore, OutOf = settings.RatingOutOf }) 1691 </div> 1692 } 1693 </div> 1694 @if (!String.IsNullOrEmpty(settings.Link)) 1695 { 1696 <div class="grid__cell"> 1697 @RenderButton(new Button { Link= settings.Link, Title= settings.LinkText, ButtonLayout= settings.ButtonLayout }) 1698 </div> 1699 } 1700 </div> 1701 </div> 1702 </div> 1703 </section> 1704 } 1705 else 1706 { 1707 @RenderArticleBanner(settings); 1708 } 1709 } 1710 } 1711 else 1712 { 1713 @RenderArticleCleanHeader(settings); 1714 } 1715 } 1716 } 1717 1718 @helper RenderArticleBannerHeader(dynamic settings) { 1719 dynamic[] methodParameters = new dynamic[1]; 1720 methodParameters[0] = settings; 1721 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBannerHeaderCustom"); 1722 1723 if (customMethod != null) 1724 { 1725 @customMethod.Invoke(this, methodParameters).ToString(); 1726 } 1727 else 1728 { 1729 @RenderArticleBanner(settings); 1730 } 1731 } 1732 @using System.Reflection 1733 @using System.Text.RegularExpressions; 1734 @using Dynamicweb.Frontend 1735 @using Dynamicweb.Content.Items 1736 @using Dynamicweb.Rapido.Blocks.Components 1737 @using Dynamicweb.Rapido.Blocks.Components.Articles 1738 @using Dynamicweb.Rapido.Blocks 1739 1740 @* Component for the articles *@ 1741 1742 @helper RenderArticleBodyRow(ArticleBodyRow settings) 1743 { 1744 dynamic[] methodParameters = new dynamic[1]; 1745 methodParameters[0] = settings; 1746 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleBodyRowCustom"); 1747 1748 if (customMethod != null) 1749 { 1750 @customMethod.Invoke(this, methodParameters).ToString(); 1751 } else { 1752 string position = settings.TopLayout == "overlay" ? "article__overlay-offset" : ""; 1753 string contentAlignment = settings.TextLayout == "center" ? "grid--justify-center" : ""; 1754 1755 <div class="grid grid--align-content-start @contentAlignment @position dw-mod"> 1756 @RenderBlockList(settings.SubBlocks) 1757 </div> 1758 } 1759 } 1760 @using System.Reflection 1761 @using Dynamicweb.Rapido.Blocks.Components 1762 @using Dynamicweb.Rapido.Blocks.Components.General 1763 @using Dynamicweb.Rapido.Blocks.Components.Articles 1764 @using Dynamicweb.Rapido.Blocks 1765 1766 @* Component for the articles *@ 1767 1768 @helper RenderArticleImage(ArticleImage settings) 1769 { 1770 dynamic[] methodParameters = new dynamic[1]; 1771 methodParameters[0] = settings; 1772 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleImageCustom"); 1773 1774 if (customMethod != null) 1775 { 1776 @customMethod.Invoke(this, methodParameters).ToString(); 1777 } 1778 else 1779 { 1780 if (settings.Image != null) 1781 { 1782 if (settings.Image.Path != null) 1783 { 1784 <div class="u-margin-bottom--lg"> 1785 @RenderImage(settings.Image) 1786 </div> 1787 } 1788 } 1789 } 1790 } 1791 @using System.Reflection 1792 @using Dynamicweb.Rapido.Blocks.Components 1793 @using Dynamicweb.Rapido.Blocks.Components.Articles 1794 1795 1796 @* Component for the articles *@ 1797 1798 @helper RenderArticleSubHeader(ArticleSubHeader settings) 1799 { 1800 dynamic[] methodParameters = new dynamic[1]; 1801 methodParameters[0] = settings; 1802 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSubHeaderCustom"); 1803 1804 if (customMethod != null) 1805 { 1806 @customMethod.Invoke(this, methodParameters).ToString(); 1807 } else { 1808 if (!String.IsNullOrEmpty(settings.Title)) 1809 { 1810 <h2 class="article__header">@settings.Title</h2> 1811 } 1812 } 1813 } 1814 @using System.Reflection 1815 @using Dynamicweb.Rapido.Blocks.Components 1816 @using Dynamicweb.Rapido.Blocks.Components.Articles 1817 @using Dynamicweb.Rapido.Blocks 1818 1819 1820 @* Component for the articles *@ 1821 1822 @helper RenderArticleText(ArticleText settings) 1823 { 1824 dynamic[] methodParameters = new dynamic[1]; 1825 methodParameters[0] = settings; 1826 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 1827 1828 if (customMethod != null) 1829 { 1830 @customMethod.Invoke(this, methodParameters).ToString(); 1831 } else { 1832 if (!String.IsNullOrEmpty(settings.Text)) 1833 { 1834 string greatTextClass = settings.EnableLargeText == true ? "article__paragraph--great-text" : ""; 1835 1836 <div class="article__paragraph @greatTextClass"> 1837 @settings.Text 1838 </div> 1839 } 1840 } 1841 } 1842 @using System.Reflection 1843 @using Dynamicweb.Rapido.Blocks.Components 1844 @using Dynamicweb.Rapido.Blocks.Components.Articles 1845 @using Dynamicweb.Rapido.Blocks 1846 1847 1848 @* Component for the articles *@ 1849 1850 @helper RenderArticleQuote(ArticleQuote settings) 1851 { 1852 dynamic[] methodParameters = new dynamic[1]; 1853 methodParameters[0] = settings; 1854 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleQuoteCustom"); 1855 1856 if (customMethod != null) 1857 { 1858 @customMethod.Invoke(this, methodParameters).ToString(); 1859 } else { 1860 string text = Regex.Replace(settings.Text, "<.*?>", String.Empty); 1861 1862 <div class="grid u-padding-bottom--lg"> 1863 @if (settings.Image != null) 1864 { 1865 if (settings.Image.Path != null) { 1866 <div class="grid__col-3"> 1867 <div class="grid__cell-img"> 1868 @{ 1869 settings.Image.Title = !String.IsNullOrEmpty(settings.Image.Title) ? settings.Image.Title : settings.Author; 1870 settings.Image.CssClass += " article__image article__image--ball"; 1871 settings.Image.ImageDefault.Width = 200; 1872 settings.Image.ImageDefault.Height = 200; 1873 } 1874 @RenderImage(settings.Image) 1875 </div> 1876 </div> 1877 } 1878 } 1879 <div class="grid__col-auto"> 1880 @if (!String.IsNullOrEmpty(settings.Text)) 1881 { 1882 <div class="article__quote dw-mod"> 1883 <i class="fas fa-quote-right u-margin-bottom--lg"></i> 1884 @settings.Text 1885 <i class="fas fa-quote-right"></i> 1886 </div> 1887 } 1888 @if (!String.IsNullOrEmpty(settings.Author)) 1889 { 1890 <div class="article__quote-author dw-mod"> 1891 - @settings.Author 1892 </div> 1893 } 1894 </div> 1895 </div> 1896 } 1897 } 1898 @using System.Reflection 1899 @using Dynamicweb.Rapido.Blocks.Components 1900 @using Dynamicweb.Rapido.Blocks.Components.Articles 1901 @using Dynamicweb.Rapido.Blocks 1902 1903 @* Component for the articles *@ 1904 1905 @helper RenderArticleInfoTable(ArticleInfoTable settings) 1906 { 1907 dynamic[] methodParameters = new dynamic[1]; 1908 methodParameters[0] = settings; 1909 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleInfoTableCustom"); 1910 1911 if (customMethod != null) 1912 { 1913 @customMethod.Invoke(this, methodParameters).ToString(); 1914 } else { 1915 <table class="table table--clean"> 1916 @foreach (var row in settings.Rows) 1917 { 1918 string iconColor = row.IconColor != null ? row.IconColor : "u-brand-color-two"; 1919 1920 <tr> 1921 @if (!String.IsNullOrEmpty(row.Icon)) 1922 { 1923 <td class="u-w32px"><i class="@row.Icon fa-2x @row.IconColor"></i></td> 1924 } 1925 <td class="u-no-margin-on-p-elements"> 1926 <div class="u-bold">@row.Title</div> 1927 @if (!String.IsNullOrEmpty(row.SubTitle)) 1928 { 1929 if (row.Link == null) 1930 { 1931 <div>@row.SubTitle</div> 1932 } 1933 else 1934 { 1935 <a href="@row.Link" class="u-color-inherit">@row.SubTitle</a> 1936 } 1937 } 1938 </td> 1939 </tr> 1940 } 1941 </table> 1942 } 1943 } 1944 @using System.Reflection 1945 @using Dynamicweb.Rapido.Blocks.Components 1946 @using Dynamicweb.Rapido.Blocks.Components.Articles 1947 @using Dynamicweb.Rapido.Blocks 1948 1949 @* Component for the articles *@ 1950 1951 @helper RenderArticleGalleryModal(ArticleGalleryModal settings) 1952 { 1953 dynamic[] methodParameters = new dynamic[1]; 1954 methodParameters[0] = settings; 1955 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 1956 1957 if (customMethod != null) 1958 { 1959 @customMethod.Invoke(this, methodParameters).ToString(); 1960 } 1961 else 1962 { 1963 <input type="checkbox" id="ParagraphGalleryTrigger" class="modal-trigger" /> 1964 <div class="modal-container"> 1965 <label for="ParagraphGalleryTrigger" id="ParagraphGalleryOverlay" class="modal-overlay"></label> 1966 <div class="modal modal--full" id="ParagraphGallery"> 1967 <div class="modal__body modal__body--full"> 1968 <img src="/Files/Images/placeholder.gif" alt="" id="ParagraphGalleryModalImage" style="margin: 0 auto;" /> 1969 <div class="u-padding u-ta-center" id="ParagraphGalleryModalCaption"></div> 1970 <label class="modal__close-btn dw-mod" for="ParagraphGalleryTrigger"></label> 1971 </div> 1972 </div> 1973 </div> 1974 <script> 1975 function showImageInModal(image) { 1976 let imageNode = document.getElementById('ParagraphGalleryModalImage'); 1977 let captionNode = document.getElementById('ParagraphGalleryModalCaption'); 1978 let trigger = document.getElementById('ParagraphGalleryTrigger'); 1979 imageNode.src = image.src; 1980 if (image.alt != "") { 1981 captionNode.innerText = image.alt; 1982 imageNode.alt = image.alt; 1983 captionNode.style.display = "block"; 1984 } else { 1985 captionNode.style.display = "none"; 1986 } 1987 trigger.checked = true; 1988 } 1989 </script> 1990 } 1991 } 1992 @using System.Reflection 1993 @using Dynamicweb.Rapido.Blocks.Components 1994 @using Dynamicweb.Rapido.Blocks.Components.Articles 1995 @using Dynamicweb.Rapido.Blocks 1996 1997 1998 @* Component for the articles *@ 1999 2000 @helper RenderArticleRelated(ArticleRelated settings) 2001 { 2002 string cardClass = Pageview.Device.ToString() != "Tablet" ? "card u-color-light--bg u-full-height" : ""; 2003 string cardFooterClass = Pageview.Device.ToString() != "Tablet" ? "card-footer u-color-light--bg" : ""; 2004 2005 <section class="multiple-paragraphs-container u-color-light-gray--bg paragraph-container--full-width"> 2006 <div class="center-container dw-mod"> 2007 <div class="grid u-padding"> 2008 <div class="grid__col-md-12 grid__col-xs-12"> 2009 <h2 class="article__header u-no-margin u-margin-top">@settings.Title</h2> 2010 </div> 2011 </div> 2012 2013 <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> 2014 2015 <script id="RelatedSimpleTemplate" type="text/x-template"> 2016 {{#.}} 2017 <div class="grid u-padding-bottom--lg"> 2018 {{#Cases}} 2019 <div class="grid__col-3 image-hover--zoom dw-mod"> 2020 <a href="{{link}}" class="u-full-height u-color-light--bg"> 2021 {{#if image}} 2022 <div class="u-color-light--bg u-no-padding dw-mod"> 2023 <div class="flex-img image-hover__wrapper"> 2024 <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}}" /> 2025 </div> 2026 </div> 2027 {{/if}} 2028 2029 <div class="card u-color-light--bg dw-mod"> 2030 <h3 class="article-list__item-header u-truncate-text dw-mod">{{title}}</h3> 2031 <p class="article__short-summary dw-mod">{{summary}}</p> 2032 </div> 2033 </a> 2034 </div> 2035 {{/Cases}} 2036 </div> 2037 {{/.}} 2038 </script> 2039 </div> 2040 </section> 2041 } 2042 @using System.Reflection 2043 @using Dynamicweb.Rapido.Blocks.Components 2044 @using Dynamicweb.Rapido.Blocks.Components.Articles 2045 @using Dynamicweb.Rapido.Blocks 2046 2047 2048 @* Component for the articles *@ 2049 2050 @helper RenderArticleMenu(ArticleMenu settings) 2051 { 2052 dynamic[] methodParameters = new dynamic[1]; 2053 methodParameters[0] = settings; 2054 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuCustom"); 2055 2056 if (customMethod != null) 2057 { 2058 @customMethod.Invoke(this, methodParameters).ToString(); 2059 } else { 2060 if (!String.IsNullOrEmpty(settings.Title)) { 2061 <div class="u-margin u-border-bottom"> 2062 <h3 class="u-no-margin">@settings.Title</h3> 2063 </div> 2064 } 2065 2066 <ul class="menu-left u-margin-bottom dw-mod"> 2067 @foreach (var item in settings.Items) 2068 { 2069 @RenderArticleMenuItem(item) 2070 } 2071 </ul> 2072 } 2073 } 2074 2075 @helper RenderArticleMenuItem(ArticleMenuItem settings) 2076 { 2077 dynamic[] methodParameters = new dynamic[1]; 2078 methodParameters[0] = settings; 2079 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleMenuItemCustom"); 2080 2081 if (customMethod != null) 2082 { 2083 @customMethod.Invoke(this, methodParameters).ToString(); 2084 } else { 2085 string link = !String.IsNullOrEmpty(settings.Link) ? settings.Link : "#"; 2086 2087 if (!String.IsNullOrEmpty(settings.Title)) { 2088 <li class="menu-left__item dw-mod"> 2089 <a href="@link" onclick="@settings.OnClick" class="menu-left__link dw-mod">@settings.Title</a> 2090 </li> 2091 } 2092 } 2093 } 2094 @using System.Reflection 2095 @using Dynamicweb.Rapido.Blocks.Components 2096 @using Dynamicweb.Rapido.Blocks.Components.Articles 2097 @using Dynamicweb.Rapido.Blocks 2098 2099 @* Component for the articles *@ 2100 2101 @helper RenderArticleList(ArticleList settings) 2102 { 2103 dynamic[] methodParameters = new dynamic[1]; 2104 methodParameters[0] = settings; 2105 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCustom"); 2106 2107 if (customMethod != null) 2108 { 2109 @customMethod.Invoke(this, methodParameters).ToString(); 2110 } else { 2111 if (Pageview != null) 2112 { 2113 bool isParagraph = Pageview.CurrentParagraph != null ? true : false; 2114 string[] sortArticlesListBy = new string[2]; 2115 2116 if (isParagraph) { 2117 sortArticlesListBy = Pageview.CurrentParagraph.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString()) ? Pageview.CurrentParagraph.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2118 } 2119 else { 2120 sortArticlesListBy = Pageview.Item["SortArticlesListBy"] != null && !string.IsNullOrEmpty(Pageview.Item["SortArticlesListBy"].ToString()) ? Pageview.Item["SortArticlesListBy"].ToString().Split('+') : new string[] { "Date", "ASC" }; 2121 } 2122 2123 string sourcePage = settings.SourcePage != null ? settings.SourcePage : Pageview.ID.ToString(); 2124 2125 @RenderItemList(new 2126 { 2127 ItemType = !String.IsNullOrEmpty(settings.ItemType) ? settings.ItemType : "DynamicArticle", 2128 ListSourceType = settings.SourceType, 2129 ListSourcePage = sourcePage, 2130 ItemFieldsList = "*", 2131 Filter = settings.Filter, 2132 ListOrderBy = sortArticlesListBy[0], 2133 ListOrderByDirection = sortArticlesListBy[1], 2134 ListSecondOrderBy = sortArticlesListBy[0] == "Date" ? "InFocusSortId" : "Date", 2135 ListSecondOrderByDirection = "ASC", 2136 IncludeAllChildItems = true, 2137 ListTemplate = settings.Template, 2138 ListPageSize = settings.PageSize.ToString() 2139 }); 2140 } 2141 } 2142 } 2143 @using System.Reflection 2144 @using Dynamicweb.Rapido.Blocks.Components.Articles 2145 2146 2147 @* Component for the articles *@ 2148 2149 @helper RenderArticleSummary(ArticleSummary settings) 2150 { 2151 dynamic[] methodParameters = new dynamic[1]; 2152 methodParameters[0] = settings; 2153 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleSummaryCustom"); 2154 2155 if (customMethod != null) 2156 { 2157 @customMethod.Invoke(this, methodParameters).ToString(); 2158 } else { 2159 if (!String.IsNullOrEmpty(settings.Text)) 2160 { 2161 <div class="article__summary dw-mod">@settings.Text</div> 2162 } 2163 } 2164 } 2165 @using System.Reflection 2166 @using Dynamicweb.Rapido.Blocks.Components 2167 @using Dynamicweb.Rapido.Blocks.Components.Articles 2168 @using Dynamicweb.Rapido.Blocks 2169 2170 @* Component for the articles *@ 2171 2172 @helper RenderArticleListCategoryFilter(ArticleListCategoryFilter settings) 2173 { 2174 dynamic[] methodParameters = new dynamic[1]; 2175 methodParameters[0] = settings; 2176 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListCategoryFilterCustom"); 2177 2178 if (customMethod != null) 2179 { 2180 @customMethod.Invoke(this, methodParameters).ToString(); 2181 } else { 2182 string pageId = Pageview.ID.ToString(); 2183 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("sourcePage")) ? HttpContext.Current.Request.QueryString.Get("sourcePage") : Translate("All"); 2184 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2185 2186 foreach (var option in settings.Categories) 2187 { 2188 selectedFilter = selectedFilter == option.Value ? option.Key : selectedFilter; 2189 } 2190 2191 if (selectedFilter == pageId) 2192 { 2193 selectedFilter = Translate("All"); 2194 } 2195 2196 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2197 { 2198 <div class="u-pull--right u-margin-left"> 2199 <div class="collection u-no-margin"> 2200 <h5>@Translate("Category")</h5> 2201 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2202 <div class="dropdown u-w180px dw-mod"> 2203 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2204 <div class="dropdown__content dw-mod"> 2205 @foreach (var option in settings.Categories) 2206 { 2207 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2208 } 2209 </div> 2210 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2211 </div> 2212 </div> 2213 </div> 2214 } 2215 else 2216 { 2217 <div class="u-full-width u-margin-bottom"> 2218 <h5 class="u-no-margin">@Translate("Category")</h5> 2219 <input type="checkbox" id="CategorySelector" class="dropdown-trigger" /> 2220 <div class="dropdown u-full-width dw-mod"> 2221 <label class="dropdown__header dropdown__btn dw-mod" for="CategorySelector">@Translate(selectedFilter)</label> 2222 <div class="dropdown__content dw-mod"> 2223 @foreach (var option in settings.Categories) 2224 { 2225 <div class="dropdown__item" onclick="QueryArray.setParametersInCurrentURL({ sourceType: 'Page', sourcePage: '@(option.Key.ToLower() == "all" ? pageId : option.Value)' })">@Translate(option.Key)</div> 2226 } 2227 </div> 2228 <label class="dropdown-trigger-off" for="CategorySelector"></label> 2229 </div> 2230 </div> 2231 } 2232 } 2233 } 2234 @using System.Reflection 2235 @using Dynamicweb.Rapido.Blocks.Components 2236 @using Dynamicweb.Rapido.Blocks.Components.Articles 2237 @using Dynamicweb.Rapido.Blocks 2238 2239 @* Component for the articles *@ 2240 2241 @helper RenderArticleListFilter(ArticleListFilter settings) 2242 { 2243 string selectedFilter = !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get(settings.SystemName)) ? HttpContext.Current.Request.QueryString.Get(settings.SystemName) : Translate("All"); 2244 var query = HttpUtility.ParseQueryString(HttpContext.Current.Request.QueryString.ToString()); 2245 2246 if (settings.Options != null) 2247 { 2248 foreach (var option in settings.Options) 2249 { 2250 selectedFilter = selectedFilter == option.Value ? option.Name : selectedFilter; 2251 } 2252 2253 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 2254 { 2255 <div class="u-pull--right u-margin-left"> 2256 <div class="collection u-no-margin"> 2257 <h5>@settings.Label</h5> 2258 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2259 <div class="dropdown u-w180px dw-mod"> 2260 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2261 <div class="dropdown__content dw-mod"> 2262 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2263 @foreach (var option in settings.Options) 2264 { 2265 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2266 } 2267 </div> 2268 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2269 </div> 2270 </div> 2271 </div> 2272 } 2273 else 2274 { 2275 <div class="u-full-width u-margin-bottom"> 2276 <h5 class="u-no-margin">@settings.Label</h5> 2277 <input type="checkbox" id="@(settings.SystemName)Selector" class="dropdown-trigger" /> 2278 <div class="dropdown u-full-width w-mod"> 2279 <label class="dropdown__header dropdown__btn dw-mod" for="@(settings.SystemName)Selector">@Translate(selectedFilter)</label> 2280 <div class="dropdown__content dw-mod"> 2281 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '')">@Translate("All")</div> 2282 @foreach (var option in settings.Options) 2283 { 2284 <div class="dropdown__item" onclick="QueryArray.setParameterInCurrentURL('@settings.SystemName', '@option.Value')">@Translate(option.Name)</div> 2285 } 2286 </div> 2287 <label class="dropdown-trigger-off" for="@(settings.SystemName)Selector"></label> 2288 </div> 2289 </div> 2290 } 2291 } 2292 } 2293 @using System.Reflection 2294 @using Dynamicweb.Rapido.Blocks.Components 2295 @using Dynamicweb.Rapido.Blocks.Components.Articles 2296 @using Dynamicweb.Rapido.Blocks 2297 2298 @* Component for the articles *@ 2299 2300 @helper RenderArticleListSearch(ArticleListSearch settings) 2301 { 2302 dynamic[] methodParameters = new dynamic[1]; 2303 methodParameters[0] = settings; 2304 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListSearchCustom"); 2305 2306 if (customMethod != null) 2307 { 2308 @customMethod.Invoke(this, methodParameters).ToString(); 2309 } else { 2310 string searchString = !string.IsNullOrEmpty(HttpContext.Current.Request.QueryString.Get("Title")) ? HttpContext.Current.Request.QueryString.Get("Title").Trim('*') : ""; 2311 string className = "u-w340px u-pull--right u-margin-left"; 2312 2313 if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2314 { 2315 className = "u-full-width"; 2316 } 2317 2318 <div class="typeahead u-color-inherit u-margin-bottom dw-mod @className"> 2319 <input type="text" class="typeahead-search-field u-no-margin dw-mod" placeholder="@Translate("Search in list")" value="@searchString" id="ArticleListSearchInput" onchange="QueryArray.setParameterInCurrentURL('Title', '*' + document.getElementById('ArticleListSearchInput').value + '*')"> 2320 <button type="button" class="btn btn--condensed btn--primary u-no-margin dw-mod"><i class="fas fa-search"></i></button> 2321 </div> 2322 } 2323 } 2324 @using System.Reflection 2325 @using Dynamicweb.Rapido.Blocks.Components 2326 @using Dynamicweb.Rapido.Blocks.Components.Articles 2327 @using Dynamicweb.Rapido.Blocks 2328 2329 @* Component for the articles *@ 2330 2331 @helper RenderArticleListNoResultsInfo(ArticleListNoResultsInfo settings) 2332 { 2333 dynamic[] methodParameters = new dynamic[1]; 2334 methodParameters[0] = settings; 2335 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleListNoResultsInfoCustom"); 2336 2337 if (customMethod != null) 2338 { 2339 @customMethod.Invoke(this, methodParameters).ToString(); 2340 } else { 2341 <div class="u-margin-top--lg u-bold u-ta-center u-bold">@Translate(settings.Message)</div> 2342 } 2343 } 2344 @using System.Reflection 2345 @using Dynamicweb.Rapido.Blocks.Components 2346 @using Dynamicweb.Rapido.Blocks.Components.General 2347 @using Dynamicweb.Rapido.Blocks.Components.Articles 2348 @using Dynamicweb.Rapido.Blocks 2349 @using System.Text.RegularExpressions 2350 2351 @* Component for the articles *@ 2352 2353 @helper RenderArticleListItem(ArticleListItem settings) 2354 { 2355 switch (settings.Type) { 2356 case ArticleListItemType.Card: 2357 @RenderArticleListItemCard(settings); 2358 break; 2359 case ArticleListItemType.List: 2360 @RenderArticleListItemList(settings); 2361 break; 2362 case ArticleListItemType.Simple: 2363 @RenderArticleListItemSimple(settings); 2364 break; 2365 default: 2366 @RenderArticleListItemCard(settings); 2367 break; 2368 } 2369 } 2370 2371 @helper RenderArticleListItemCard(ArticleListItem settings) { 2372 <a href="@settings.Link" class="u-full-height u-color-light--bg"> 2373 <div class="u-color-light--bg u-no-padding dw-mod"> 2374 @if (settings.Logo != null) 2375 { 2376 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;" : ""; 2377 settings.Logo.ImageDefault.Crop = 5; 2378 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2379 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2380 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2381 @if (settings.Stickers != null) 2382 { 2383 if (settings.Stickers.Position != StickersListPosition.Custom) 2384 { 2385 @RenderStickersCollection(settings.Stickers); 2386 } 2387 } 2388 @RenderImage(settings.Logo) 2389 </div> 2390 } else if (settings.Image != null) 2391 { 2392 <div class="flex-img image-hover__wrapper u-position-relative dw-mod"> 2393 @if (settings.Stickers != null) 2394 { 2395 if (settings.Stickers.Position != StickersListPosition.Custom) 2396 { 2397 @RenderStickersCollection(settings.Stickers); 2398 } 2399 } 2400 @RenderImage(settings.Image) 2401 </div> 2402 } 2403 </div> 2404 2405 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2406 { 2407 <div class="card u-color-light--bg dw-mod"> 2408 @if (settings.Stickers != null) 2409 { 2410 if (settings.Stickers.Position == StickersListPosition.Custom) 2411 { 2412 @RenderStickersCollection(settings.Stickers); 2413 } 2414 } 2415 @if (!String.IsNullOrEmpty(settings.Title)) 2416 { 2417 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2418 } 2419 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2420 { 2421 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2422 } 2423 @if (!String.IsNullOrEmpty(settings.Summary)) 2424 { 2425 <p class="article__short-summary dw-mod">@settings.Summary</p> 2426 } 2427 </div> 2428 } 2429 </a> 2430 } 2431 2432 @helper RenderArticleListItemList(ArticleListItem settings) { 2433 <a href="@settings.Link"> 2434 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2435 <div class="grid__col-md-3"> 2436 <div class="u-color-light--bg u-no-padding dw-mod"> 2437 @if (settings.Logo != null) 2438 { 2439 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;" : ""; 2440 settings.Logo.ImageDefault.Crop = 5; 2441 settings.Logo.ImageDefault.Width = settings.Logo.ImageDefault.Width == 1920 ? 240 : settings.Logo.ImageDefault.Width; 2442 settings.Logo.ImageDefault.Height = settings.Logo.ImageDefault.Height == 1080 ? 200 : settings.Logo.ImageDefault.Height; 2443 <div class="image-hover__wrapper layered-image layered-image--tinted dw-mod" style="@backgroundImage"> 2444 @if (settings.Stickers != null) 2445 { 2446 if (settings.Stickers.Position != StickersListPosition.Custom) 2447 { 2448 @RenderStickersCollection(settings.Stickers); 2449 } 2450 } 2451 @RenderImage(settings.Logo) 2452 </div> 2453 } else if (settings.Image != null) 2454 { 2455 <div class="flex-img image-hover__wrapper dw-mod"> 2456 @if (settings.Stickers != null) 2457 { 2458 if (settings.Stickers.Position != StickersListPosition.Custom) 2459 { 2460 @RenderStickersCollection(settings.Stickers); 2461 } 2462 } 2463 @RenderImage(settings.Image) 2464 </div> 2465 } 2466 </div> 2467 </div> 2468 2469 @if (!String.IsNullOrEmpty(settings.Title) || !String.IsNullOrEmpty(settings.Summary)) 2470 { 2471 <div class="grid__col-md-9"> 2472 @if (!String.IsNullOrEmpty(settings.Title)) 2473 { 2474 <h3 class="article-list__item-header u-truncate-text dw-mod">@settings.Title</h3> 2475 } 2476 @if (settings.Stickers != null) 2477 { 2478 if (settings.Stickers.Position == StickersListPosition.Custom) 2479 { 2480 @RenderStickersCollection(settings.Stickers); 2481 } 2482 } 2483 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2484 { 2485 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2486 } 2487 @if (!String.IsNullOrEmpty(settings.Summary)) 2488 { 2489 <p class="article__short-summary dw-mod">@settings.Summary</p> 2490 } 2491 </div> 2492 } 2493 </div> 2494 </a> 2495 } 2496 2497 @helper RenderArticleListItemSimple(ArticleListItem settings) { 2498 <a href="@settings.Link" class="u-color-inherit"> 2499 <div class="grid u-color-light--bg u-no-padding dw-mod"> 2500 <div class="grid__col-md-12"> 2501 @if (!String.IsNullOrEmpty(settings.Title)) 2502 { 2503 <div class="article-list-item__header u-truncate-text u-no-margin dw-mod">@settings.Title</div> 2504 } 2505 @if (!String.IsNullOrEmpty(settings.SubTitle)) 2506 { 2507 <div class="article-list__item-micro-info u-truncate-text dw-mod">@settings.SubTitle</div> 2508 } 2509 </div> 2510 </div> 2511 </a> 2512 } 2513 @using System.Reflection 2514 @using Dynamicweb.Rapido.Blocks.Components.Articles 2515 2516 2517 @* Component for the articles *@ 2518 2519 @helper RenderArticleAuthorAndDate(ArticleAuthorAndDate settings) 2520 { 2521 dynamic[] methodParameters = new dynamic[1]; 2522 methodParameters[0] = settings; 2523 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleAuthorAndDateCustom"); 2524 2525 if (customMethod != null) 2526 { 2527 @customMethod.Invoke(this, methodParameters).ToString(); 2528 } else { 2529 <small class="article__subscription"> 2530 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2531 { 2532 <text>@Translate("Written")</text> 2533 } 2534 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2535 { 2536 <text>@Translate("by") @settings.Author</text> 2537 } 2538 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2539 { 2540 <text>@Translate("on") @settings.Date</text> 2541 } 2542 </small> 2543 } 2544 } 2545 @using System.Reflection 2546 @using Dynamicweb.Rapido.Blocks.Components.Articles 2547 2548 2549 @* Component for the articles *@ 2550 2551 @helper RenderArticleLink(ArticleLink settings) 2552 { 2553 dynamic[] methodParameters = new dynamic[1]; 2554 methodParameters[0] = settings; 2555 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleLinkCustom"); 2556 2557 if (customMethod != null) 2558 { 2559 @customMethod.Invoke(this, methodParameters).ToString(); 2560 } else { 2561 if (!String.IsNullOrEmpty(settings.Title)) 2562 { 2563 <div class="grid__cell"> 2564 @RenderButton(settings) 2565 </div> 2566 } 2567 } 2568 } 2569 @using System.Reflection 2570 @using Dynamicweb.Rapido.Blocks 2571 @using Dynamicweb.Rapido.Blocks.Components.Articles 2572 @using Dynamicweb.Rapido.Blocks.Components.General 2573 2574 2575 @* Component for the articles *@ 2576 2577 @helper RenderArticleCarousel(ArticleCarousel settings) 2578 { 2579 dynamic[] methodParameters = new dynamic[1]; 2580 methodParameters[0] = settings; 2581 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2582 2583 if (customMethod != null) 2584 { 2585 @customMethod.Invoke(this, methodParameters).ToString(); 2586 } else { 2587 <div class="grid"> 2588 <div class="grid__col-12"> 2589 <div class="carousel" id="carousel_@settings.Id"> 2590 <div class="carousel__container js-carousel-slides dw-mod"> 2591 @RenderBlockList(settings.SubBlocks) 2592 </div> 2593 </div> 2594 </div> 2595 </div> 2596 2597 <script> 2598 document.addEventListener("DOMContentLoaded", function () { 2599 new CarouselModule("#carousel_@settings.Id", { 2600 slideTime: 0, 2601 dots: true 2602 }); 2603 }); 2604 </script> 2605 } 2606 } 2607 2608 @helper RenderArticleCarouselSlide(ArticleCarouselSlide settings) 2609 { 2610 dynamic[] methodParameters = new dynamic[1]; 2611 methodParameters[0] = settings; 2612 MethodInfo customMethod = this.GetType().GetMethod(settings.HelperName + "Custom"); 2613 2614 if (customMethod != null) 2615 { 2616 @customMethod.Invoke(this, methodParameters).ToString(); 2617 } 2618 else 2619 { 2620 string imageEngine = "/Admin/Public/GetImage.ashx?"; 2621 2622 string defaultImage = settings.ImageSettings != null ? imageEngine : settings.Image; 2623 if (settings.ImageSettings != null) 2624 { 2625 defaultImage += settings.ImageSettings.Width != 0 ? "Width=" + settings.ImageSettings.Width + "&" : ""; 2626 defaultImage += settings.ImageSettings.Height != 0 ? "Height=" + settings.ImageSettings.Height + "&" : ""; 2627 defaultImage += "Crop=" + settings.ImageSettings.Crop + "&"; 2628 defaultImage += "Compression=" + settings.ImageSettings.Compression + "&"; 2629 defaultImage += "DoNotUpscale=" + settings.ImageSettings.DoNotUpscale.ToString() + "&"; 2630 defaultImage += "FillCanvas=" + settings.ImageSettings.FillCanvas.ToString() + "&"; 2631 } 2632 defaultImage += "&Image=" + settings.Image; 2633 2634 <div class="carousel__slide u-min-h300px u-flex dw-mod" style="background-size:cover; background-image:url('@defaultImage')"> 2635 <a class="article-carousel-item__wrap" href="@settings.Link" title="@settings.Title"> 2636 <h2 class="article-list__item-header u-truncate-text u-color-light dw-mod">@settings.Title</h2> 2637 <div class="article-list__item-info"> 2638 @if (settings.Stickers != null) 2639 { 2640 settings.Stickers.Position = StickersListPosition.Custom; 2641 @RenderStickersCollection(settings.Stickers); 2642 } 2643 2644 <small class="u-margin-top--lg u-color-light"> 2645 @if (!(string.IsNullOrWhiteSpace(settings.Author) && string.IsNullOrWhiteSpace(settings.Date))) 2646 { 2647 <text>@Translate("Written")</text> 2648 } 2649 @if (!string.IsNullOrWhiteSpace(settings.Author)) 2650 { 2651 <text>@Translate("by") @settings.Author</text> 2652 } 2653 @if (!string.IsNullOrWhiteSpace(settings.Date)) 2654 { 2655 <text>@Translate("on") @settings.Date</text> 2656 } 2657 </small> 2658 </div> 2659 2660 <h3 class="article__short-summary u-color-light">@settings.Summary</h3> 2661 </a> 2662 @if (settings.UseFilters == true) 2663 { 2664 <div class="background-image image-filter image-filter--darken dw-mod"></div> 2665 } 2666 </div> 2667 } 2668 } 2669 @using System.Text.RegularExpressions 2670 @using Dynamicweb.Rapido.Blocks.Components 2671 @using Dynamicweb.Rapido.Blocks.Components.General 2672 @using Dynamicweb.Rapido.Blocks.Components.Articles 2673 @using Dynamicweb.Rapido.Blocks 2674 2675 @* Component for the articles *@ 2676 2677 @helper RenderArticleVideo(ArticleVideo settings) 2678 { 2679 dynamic[] methodParameters = new dynamic[1]; 2680 methodParameters[0] = settings; 2681 MethodInfo customMethod = this.GetType().GetMethod("RenderArticleTextCustom"); 2682 2683 if (customMethod != null) 2684 { 2685 @customMethod.Invoke(this, methodParameters).ToString(); 2686 } else { 2687 if (settings.Url != null) 2688 { 2689 //getting video ID from youtube URL 2690 string videoCode = settings.Url; 2691 Regex regex = new Regex(@".be\/(.[^?]*)"); 2692 Match match = regex.Match(videoCode); 2693 string videoId = ""; 2694 if (match.Success) 2695 { 2696 videoId = match.Groups[1].Value; 2697 } 2698 else 2699 { 2700 regex = new Regex(@"v=([^&]+)"); 2701 match = regex.Match(videoCode); 2702 if (match.Success) 2703 { 2704 videoId = match.Groups[1].Value; 2705 } 2706 } 2707 2708 int autoPlay = settings.AutoPlay == "true" ? 1 : 0; 2709 2710 <div class="video-wrapper"> 2711 <div class="js-youtube-video" data-video="@videoId" id="ytPlayer@(Guid.NewGuid().ToString("N"))" data-auto-play="@autoPlay" data-enable-controls="1"></div> 2712 </div> 2713 } 2714 } 2715 } 2716 2717 2718 2719 @* Simple helpers *@ 2720 2721 @*Requires the Gallery ItemType that comes with Rapido*@ 2722 @helper RenderArticleItemGallery(IList<ItemViewModel> gallery) { 2723 if (gallery != null && gallery.Count > 0) 2724 { 2725 int count = 1; 2726 2727 foreach (var item in gallery) 2728 { 2729 if (item.GetFile("ImagePath") != null) 2730 { 2731 string image = item.GetFile("ImagePath").PathUrlEncoded; 2732 string imagePrefix = "/Admin/Public/GetImage.ashx?width=1200&amp;height=820&amp;crop=5&amp;Compression=75&amp;DoNotUpscale=1&amp;image="; 2733 int imagesCount = gallery.Count; 2734 2735 if (count == 1) 2736 { 2737 <label class="gallery" for="GalleryModalTrigger" onclick="Gallery.openImage(this.querySelector('.js-gallery'))"> 2738 <span class="gallery__main-image"> 2739 <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="FullImage" data-image="@imagePrefix@image" /> 2740 </span> 2741 <span class="gallery__image-counter"> 2742 <i class="fas fa-camera fa-2x"></i> <span class="gallery__image-counter__number">@imagesCount</span> 2743 <span class="gallery__image-counter__text">@Translate("See all") <i class="fas fa-angle-right"></i></span> 2744 </span> 2745 </label> 2746 } 2747 else 2748 { 2749 <div class="u-hidden js-gallery" data-for="FullImage" data-image="@imagePrefix@image"></div> 2750 } 2751 2752 count++; 2753 } 2754 } 2755 } 2756 } 2757 2758 @helper RenderArticleItemGalleryModal() { 2759 <!-- Trigger for the gallery modal --> 2760 <input type="checkbox" id="GalleryModalTrigger" class="modal-trigger" /> 2761 2762 <!-- Gallery modal --> 2763 <div class="modal-container"> 2764 <label for="GalleryModalTrigger" id="GalleryModalOverlay" class="modal-overlay"></label> 2765 <div class="modal modal--full" id="GalleryModal"> 2766 <div class="modal__body modal__body--full"> 2767 <div class="gallery-slider"> 2768 <div class="gallery-slider__image"> 2769 <img src="#" alt="" class="modal--full__img" id="FullImage" /> 2770 </div> 2771 <div class="gallery-slider__image-counter" id="FullImage_counter"></div> 2772 <label class="gallery-slider__close-btn" for="GalleryModalTrigger"></label> 2773 <button class="gallery-slider__previous-btn" id="FullImage_prev" onclick="Gallery.prevImage('FullImage')"></button> 2774 <button class="gallery-slider__next-btn" id="FullImage_next" onclick="Gallery.nextImage('FullImage')"></button> 2775 </div> 2776 </div> 2777 </div> 2778 </div> 2779 } 2780 2781 2782 @helper RenderMobileFilters(List<Block> subBlocks) 2783 { 2784 if (subBlocks.Count > 0) 2785 { 2786 <div class="grid__col-12"> 2787 <input type="checkbox" id="CheckFilters" class="js-remember-state u-hidden" data-expand="CheckFilters" /> 2788 <div class="grid u-margin-bottom dw-mod" data-trigger="CheckFilters"> 2789 @RenderBlockList(subBlocks) 2790 </div> 2791 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod js-expand-hide" data-trigger="CheckFilters">@Translate("Select filters")</label> 2792 <label for="CheckFilters" class="btn btn--secondary btn--full dw-mod expandable--collapsed" data-trigger="CheckFilters">@Translate("Close filters")</label> 2793 </div> 2794 } 2795 } 2796 2797 @if (File.Exists(HttpContext.Current.Server.MapPath("/Components/Custom/Custom__Components.cshtml"))) 2798 { 2799 <text>@using Dynamicweb.Rapido.Blocks.Components.General 2800 </text> 2801 } 2802 2803 2804 @* Include the Blocks for the page *@ 2805 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2806 2807 @using System 2808 @using System.Web 2809 @using System.Collections.Generic 2810 @using Dynamicweb.Rapido.Blocks.Extensibility 2811 @using Dynamicweb.Rapido.Blocks 2812 2813 @{ 2814 BlocksPage topSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 2815 2816 Block tagManager = new Block() 2817 { 2818 Id = "TagManager", 2819 SortId = 1, 2820 Template = RenderGoogleTagManager() 2821 }; 2822 2823 Block facebookPixel = new Block() 2824 { 2825 Id = "FacebookPixel", 2826 SortId = 2, 2827 Template = RenderFacebookPixel() 2828 }; 2829 2830 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, tagManager); 2831 topSnippetsBlocksPage.Add(MasterBlockId.MasterTopSnippets, facebookPixel); 2832 } 2833 2834 @helper RenderGoogleTagManager() { 2835 string GoogleTagManagerID = Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID"); 2836 2837 if (!string.IsNullOrWhiteSpace(GoogleTagManagerID)) 2838 { 2839 <script> 2840 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 2841 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 2842 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 2843 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 2844 })(window,document,'script','dataLayer','@GoogleTagManagerID'); 2845 </script> 2846 <!-- Google Tag Manager (noscript) --> 2847 <noscript> 2848 <iframe src="https://www.googletagmanager.com/ns.html?id=@GoogleTagManagerID" 2849 height="0" width="0" style="display:none;visibility:hidden"></iframe> 2850 </noscript> 2851 <!-- End Google Tag Manager (noscript) --> 2852 } 2853 } 2854 2855 @helper RenderFacebookPixel() { 2856 string FacebookPixelID = Model.Area.Item.GetItem("Settings").GetString("FacebookPixelID"); 2857 2858 if (!string.IsNullOrWhiteSpace(FacebookPixelID)) 2859 { 2860 <!-- Facebook Pixel Code --> 2861 <script> 2862 !function(f,b,e,v,n,t,s) 2863 {if(f.fbq)return;n=f.fbq=function(){n.callMethod? 2864 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 2865 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 2866 n.queue=[];t=b.createElement(e);t.async=!0; 2867 t.src=v;s=b.getElementsByTagName(e)[0]; 2868 s.parentNode.insertBefore(t,s)}(window, document,'script', 2869 'https://connect.facebook.net/en_US/fbevents.js'); 2870 fbq('init', '@FacebookPixelID'); 2871 fbq('track', 'PageView'); 2872 </script> 2873 <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=@FacebookPixelID&ev=PageView&noscript=1" alt="" /></noscript> 2874 } 2875 } 2876 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2877 2878 @using System 2879 @using System.Web 2880 @using System.Collections.Generic 2881 @using Dynamicweb.Rapido.Blocks 2882 @using Dynamicweb.Rapido.Blocks.Extensibility 2883 @using Dynamicweb.Security.UserManagement 2884 @using Dynamicweb.Security.UserManagement.ExternalAuthentication 2885 @{ 2886 BlocksPage loginBlocksPage = BlocksPage.GetBlockPage("Master"); 2887 2888 Block loginModal = new Block() 2889 { 2890 Id = "LoginModal", 2891 SortId = 10, 2892 Template = LoginModal() 2893 }; 2894 2895 loginBlocksPage.Add(MasterBlockId.MasterTopSnippets, loginModal); 2896 } 2897 2898 @helper LoginModal() { 2899 int pageId = Model.TopPage.ID; 2900 string userSignedInError = !Model.LogOnFailed ? "" : "checked"; 2901 string userSignedInErrorText = ""; 2902 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 2903 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 2904 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 2905 2906 if (Model.LogOnFailed) { 2907 switch (Model.LogOnFailedReason) 2908 { 2909 case LogOnFailedReason.PasswordLengthInvalid: 2910 userSignedInErrorText = Translate("Password length is invalid"); 2911 break; 2912 case LogOnFailedReason.IncorrectLogin: 2913 userSignedInErrorText = Translate("Invalid email or password"); 2914 break; 2915 case LogOnFailedReason.ExceededFailedLogOnLimit: 2916 userSignedInErrorText = Translate("You have exceeded the limit of allowed login attempts. The user account is temporarily locked"); 2917 break; 2918 case LogOnFailedReason.LoginLocked: 2919 userSignedInErrorText = Translate("The user account is temporarily locked"); 2920 break; 2921 case LogOnFailedReason.PasswordExpired: 2922 userSignedInErrorText = Translate("The password has expired and needs to be renewed"); 2923 break; 2924 default: 2925 userSignedInErrorText = Translate("An unknown error occured"); 2926 break; 2927 } 2928 } 2929 2930 <!-- Trigger for the login modal --> 2931 <input type="checkbox" id="SignInModalTrigger" class="modal-trigger" @userSignedInError /> 2932 2933 <!-- Login modal --> 2934 <div class="modal-container"> 2935 <label for="SignInModalTrigger" id="SignInModalOverlay" class="modal-overlay"></label> 2936 <div class="modal modal--xs" id="SignInModal"> 2937 <div class="modal__header"> 2938 <h2>@Translate("Sign in")</h2> 2939 </div> 2940 <div class="modal__body"> 2941 <form method="post" id="LoginForm" class="u-no-margin"> 2942 <input type="hidden" name="ID" value="@pageId" /> 2943 <input type="hidden" name="DWExtranetUsernameRemember" value="True" /> 2944 <input type="hidden" name="DWExtranetPasswordRemember" value="True" /> 2945 <input type="text" class="u-full-width" id="LoginUsername" name="username" placeholder="@Translate("Email")" /> 2946 <input type="password" class="u-full-width" id="LoginPassword" name="password" placeholder="@Translate("Password")" /> 2947 <div class="field-error dw-mod">@userSignedInErrorText</div> 2948 2949 <div class="form__field-group dw-mod"> 2950 <input type="checkbox" id="LoginRememberMe" name="Autologin" checked="checked" value="True" class="form__control"> 2951 <label for="LoginRememberMe"> 2952 @Translate("Remember me", "Remember me") 2953 </label> 2954 </div> 2955 2956 <button type="submit" class="btn btn--primary btn--full dw-mod" name="LoginAction" value="Login" onclick="Buttons.LockButton(event)">@Translate("Sign in")</button> 2957 @{ 2958 ProviderCollection providers = Provider.GetActiveProviders(); 2959 } 2960 2961 @foreach(Provider LoginProvider in providers) 2962 { 2963 var ProviderName = LoginProvider.Name.ToLower(); 2964 <a href="/Admin/Public/Social/ExternalLogin.aspx?action=login&providerID=@LoginProvider.ID" title="@LoginProvider.Name" class="btn btn--clean btn--condensed u-color-@ProviderName dw-mod"><i class="fab fa-@ProviderName fa-1_5x"></i></a> 2965 } 2966 2967 <a class="btn btn--link-clean dw-mod" href="@forgotPasswordPageLink">@Translate("Forgot your password?", "Forgot your password?")</a> 2968 2969 <a class="btn btn--link-clean dw-mod" href="/default.aspx?ID=@createAccountPageId">@Translate("Create account")?</a> 2970 </form> 2971 </div> 2972 </div> 2973 </div> 2974 } 2975 2976 @if (Pageview.Device.ToString() == "Mobile" || Pageview.Device.ToString() == "Tablet") 2977 { 2978 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 2979 2980 @using System 2981 @using System.Web 2982 @using System.Collections.Generic 2983 @using Dynamicweb.Rapido.Blocks.Extensibility 2984 @using Dynamicweb.Rapido.Blocks 2985 2986 2987 @functions { 2988 BlocksPage mobileHeaderBlocksPage = BlocksPage.GetBlockPage("Master"); 2989 } 2990 2991 @{ 2992 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"; 2993 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 2994 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 2995 bool hideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 2996 2997 2998 Block mobileHeader = new Block() 2999 { 3000 Id = "MobileTop", 3001 SortId = 10, 3002 Template = RenderMobileTop(), 3003 SkipRenderBlocksList = true 3004 }; 3005 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeader); 3006 3007 Block mobileHeaderNavigation = new Block() 3008 { 3009 Id = "MobileHeaderNavigation", 3010 SortId = 10, 3011 Template = RenderMobileHeaderNavigation(), 3012 SkipRenderBlocksList = true, 3013 BlocksList = new List<Block> { 3014 new Block { 3015 Id = "MobileHeaderNavigationTrigger", 3016 SortId = 10, 3017 Template = RenderMobileHeaderNavigationTrigger() 3018 } 3019 } 3020 }; 3021 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderNavigation); 3022 3023 3024 Block mobileHeaderLogo = new Block() 3025 { 3026 Id = "MobileHeaderLogo", 3027 SortId = 20, 3028 Template = RenderMobileHeaderLogo(), 3029 SkipRenderBlocksList = true 3030 }; 3031 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderLogo); 3032 3033 Block mobileHeaderActions = new Block() 3034 { 3035 Id = "MobileHeaderActions", 3036 SortId = 30, 3037 Template = RenderMobileTopActions(), 3038 SkipRenderBlocksList = true 3039 }; 3040 mobileHeaderBlocksPage.Add("MobileTop", mobileHeaderActions); 3041 3042 if (hideSearch == false) 3043 { 3044 Block mobileHeaderSearch = new Block 3045 { 3046 Id = "MobileHeaderSearch", 3047 SortId = 10, 3048 Template = RenderMobileTopSearch() 3049 }; 3050 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderSearch); 3051 } 3052 3053 Block mobileHeaderMiniCart; 3054 3055 if (!hideCart) 3056 { 3057 mobileHeaderMiniCart = new Block 3058 { 3059 Id = "MobileHeaderMiniCart", 3060 SortId = 20, 3061 Template = RenderMobileTopMiniCart() 3062 }; 3063 3064 Block miniCartCounterScriptTemplate = new Block 3065 { 3066 Id = "MiniCartCounterScriptTemplate", 3067 Template = RenderMobileMiniCartCounterContent() 3068 }; 3069 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 3070 } else { 3071 mobileHeaderMiniCart = new Block 3072 { 3073 Id = "MobileHeaderMiniCart", 3074 SortId = 20 3075 }; 3076 } 3077 3078 if (!hideSearch) { 3079 Block mobileHeaderSearchBar = new Block() 3080 { 3081 Id = "MobileHeaderSearchBar", 3082 SortId = 30, 3083 Template = RenderMobileTopSearchBar() 3084 }; 3085 mobileHeaderBlocksPage.Add(MasterBlockId.MasterHeader, mobileHeaderSearchBar); 3086 } 3087 3088 switch (mobileTopLayout) 3089 { 3090 case "nav-left": 3091 mobileHeaderNavigation.SortId = 10; 3092 mobileHeaderLogo.SortId = 20; 3093 mobileHeaderActions.SortId = 30; 3094 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3095 break; 3096 case "nav-right": 3097 mobileHeaderLogo.SortId = 10; 3098 mobileHeaderActions.SortId = 20; 3099 mobileHeaderNavigation.SortId = 30; 3100 mobileHeaderBlocksPage.Add("MobileHeaderActions", mobileHeaderMiniCart); 3101 break; 3102 case "nav-search-left": 3103 mobileHeaderNavigation.SortId = 10; 3104 mobileHeaderLogo.SortId = 20; 3105 mobileHeaderActions.SortId = 30; 3106 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3107 break; 3108 case "search-left": 3109 mobileHeaderActions.SortId = 10; 3110 mobileHeaderLogo.SortId = 20; 3111 mobileHeaderNavigation.SortId = 30; 3112 mobileHeaderMiniCart.SortId = 0; 3113 mobileHeaderBlocksPage.Add("MobileHeaderNavigation", mobileHeaderMiniCart); 3114 break; 3115 } 3116 } 3117 3118 3119 @helper RenderMobileTop() { 3120 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileTop").OrderBy(item => item.SortId).ToList(); 3121 3122 <nav class="main-navigation-mobile dw-mod"> 3123 <div class="center-container top-container__center-container dw-mod"> 3124 <div class="grid grid--align-center"> 3125 @RenderBlockList(subBlocks) 3126 </div> 3127 </div> 3128 </nav> 3129 } 3130 3131 @helper RenderMobileHeaderNavigation() { 3132 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderNavigation").OrderBy(item => item.SortId).ToList(); 3133 3134 <div class="grid__col-auto-width"> 3135 <ul class="menu dw-mod"> 3136 @RenderBlockList(subBlocks) 3137 </ul> 3138 </div> 3139 } 3140 3141 @helper RenderMobileHeaderNavigationTrigger() { 3142 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3143 <label for="MobileNavTrigger" class="mobile-nav-trigger-button menu__link menu__link--icon menu__link--mobile dw-mod"></label> 3144 </li> 3145 } 3146 3147 @helper RenderMobileHeaderLogo() { 3148 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderLogo").OrderBy(item => item.SortId).ToList(); 3149 3150 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"; 3151 string centeredLogo = mobileTopLayout != "nav-right" ? "u-ta-center" : ""; 3152 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3153 string businessName = Model.Area.Item.GetItem("Settings").GetString("BusinessName"); 3154 3155 string mobileLogo = "/Files/Images/logo-dynamicweb.png"; 3156 if (Model.Area.Item.GetItem("Layout").GetItem("MobileTop") != null && Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo") != null) 3157 { 3158 mobileLogo = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetFile("Logo").PathUrlEncoded; 3159 } 3160 3161 if (Path.GetExtension(mobileLogo).ToLower() != ".svg") 3162 { 3163 mobileLogo = "/Admin/Public/GetImage.ashx?height=40&amp;crop=5&amp;Compression=75&amp;image=" + mobileLogo; 3164 } 3165 else 3166 { 3167 mobileLogo = HttpUtility.UrlDecode(mobileLogo); 3168 } 3169 3170 <div class="grid__col-auto grid__col--bleed"> 3171 <div class="grid__cell @centeredLogo"> 3172 <a href="/Default.aspx?ID=@firstPageId" class="logo logo--mobile u-inline-block dw-mod"> 3173 <img class="grid__cell-img logo__img logo__img--mobile dw-mod" src="@mobileLogo" alt="@businessName" /> 3174 </a> 3175 </div> 3176 3177 @RenderBlockList(subBlocks) 3178 </div> 3179 } 3180 3181 @helper RenderMobileTopActions() { 3182 List<Block> subBlocks = this.mobileHeaderBlocksPage.GetBlockListById("MobileHeaderActions").OrderBy(item => item.SortId).ToList(); 3183 3184 <div class="grid__col-auto-width"> 3185 <ul class="menu dw-mod"> 3186 @RenderBlockList(subBlocks) 3187 </ul> 3188 </div> 3189 } 3190 3191 @helper RenderMobileTopSearch() { 3192 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3193 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3194 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x"></i> 3195 </label> 3196 </li> 3197 } 3198 3199 @helper RenderMobileTopMiniCart() { 3200 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3201 int cartPageId = GetPageIdByNavigationTag("CartPage"); 3202 double cartProductsCount = Model.Cart.TotalProductsCount; 3203 3204 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod" id="miniCartWrapper" onmouseenter="Cart.UpdateMiniCart('miniCartWrapper', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 3205 <div class="mini-cart dw-mod"> 3206 <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"> 3207 <div class="u-inline u-position-relative"> 3208 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue fa-1_5x"></i> 3209 <div class="mini-cart__counter u-ta-center dw-mod"> 3210 <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"> 3211 <div class="js-mini-cart-counter-content"> 3212 @cartProductsCount 3213 </div> 3214 </div> 3215 </div> 3216 </div> 3217 </a> 3218 @if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3219 { 3220 <div class="mini-cart-dropdown js-handlebars-root js-mini-cart dw-mod" id="miniCart" data-template="MiniCartContent" data-cart-id="@miniCartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 3221 } 3222 </div> 3223 </li> 3224 } 3225 3226 @helper RenderMobileTopSearchBar() 3227 { 3228 string searchFeedId = ""; 3229 string searchSecondFeedId = ""; 3230 int groupsFeedId; 3231 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 3232 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 3233 string resultPageLink; 3234 string searchPlaceholder; 3235 string searchType = "product-search"; 3236 string searchTemplate; 3237 string searchContentTemplate = ""; 3238 string searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 3239 bool showGroups = true; 3240 3241 if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "contentSearch") 3242 { 3243 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3244 resultPageLink = contentSearchPageLink; 3245 searchPlaceholder = Translate("Search page"); 3246 groupsFeedId = 0; 3247 searchType = "content-search"; 3248 searchTemplate = "SearchPagesTemplate"; 3249 showGroups = false; 3250 } 3251 else if (Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue == "combinedSearch") 3252 { 3253 searchFeedId = productsPageId + "&feed=true"; 3254 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true"; 3255 resultPageLink = Converter.ToString(productsPageId); 3256 searchPlaceholder = Translate("Search products or pages"); 3257 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3258 searchType = "combined-search"; 3259 searchTemplate = "SearchProductsTemplateWrap"; 3260 searchContentTemplate = "SearchPagesTemplateWrap"; 3261 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3262 } 3263 else 3264 { 3265 resultPageLink = Converter.ToString(productsPageId); 3266 searchFeedId = productsPageId + "&feed=true"; 3267 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"); 3268 searchPlaceholder = Translate("Search products"); 3269 searchTemplate = "SearchProductsTemplate"; 3270 searchType = "product-search"; 3271 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector"); 3272 } 3273 3274 3275 <input type="checkbox" id="MobileSearchTrigger" class="mobile-search-trigger" /> 3276 3277 <div class="main-navigation-mobile typeahead-mobile dw-mod"> 3278 <div class="center-container top-container__center-container dw-mod"> 3279 <div class="grid"> 3280 <div class="grid__col-auto"> 3281 <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"> 3282 <input type="text" class="js-typeahead-search-field u-w160px u-no-margin" placeholder="@searchPlaceholder" value="@searchValue"> 3283 @if (string.IsNullOrEmpty(searchSecondFeedId)) 3284 { 3285 <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> 3286 } 3287 else 3288 { 3289 <div class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--combined-mobile grid"> 3290 <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> 3291 <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> 3292 </div> 3293 } 3294 <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> 3295 </div> 3296 </div> 3297 <div class="grid__col-auto-width"> 3298 <ul class="menu dw-mod"> 3299 <li class="menu__item menu__item--horizontal menu__item--top-level dw-mod"> 3300 <label for="MobileSearchTrigger" class="menu__link menu__link--icon menu__link--mobile dw-mod"> 3301 <i class="fas fa-times fa-1_5x"></i> 3302 </label> 3303 </li> 3304 </ul> 3305 </div> 3306 </div> 3307 </div> 3308 </div> 3309 } 3310 3311 @helper RenderMobileMiniCartCounterContent() 3312 { 3313 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 3314 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 3315 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 3316 3317 <script id="MiniCartCounterContent" type="text/x-template"> 3318 {{#.}} 3319 <div class="js-mini-cart-counter-content dw-mod"> 3320 @if (showPriceInMiniCartCounter) 3321 { 3322 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 3323 } 3324 else 3325 { 3326 <text>{{numberofproducts}}</text> 3327 } 3328 </div> 3329 {{/.}} 3330 </script> 3331 } 3332 </text> 3333 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3334 3335 @using System 3336 @using System.Web 3337 @using System.Collections.Generic 3338 @using Dynamicweb.Rapido.Blocks.Extensibility 3339 @using Dynamicweb.Rapido.Blocks 3340 3341 @functions { 3342 BlocksPage mobileNavigationBlocksPage = BlocksPage.GetBlockPage("Master"); 3343 } 3344 3345 @{ 3346 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 3347 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 3348 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 3349 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 3350 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 3351 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 3352 3353 Block mobileNavigation = new Block() 3354 { 3355 Id = "MobileNavigation", 3356 SortId = 10, 3357 Template = MobileNavigation(), 3358 SkipRenderBlocksList = true 3359 }; 3360 mobileNavigationBlocksPage.Add(MasterBlockId.MasterTopSnippets, mobileNavigation); 3361 3362 if (Model.CurrentUser.ID > 0 && !hideMyProfileLink) 3363 { 3364 Block mobileNavigationSignIn = new Block 3365 { 3366 Id = "MobileNavigationSignIn", 3367 SortId = 10, 3368 Template = RenderMobileNavigationSignIn() 3369 }; 3370 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationSignIn); 3371 } 3372 3373 Block mobileNavigationMenu = new Block 3374 { 3375 Id = "MobileNavigationMenu", 3376 SortId = 20, 3377 Template = RenderMobileNavigationMenu() 3378 }; 3379 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationMenu); 3380 3381 Block mobileNavigationActions = new Block 3382 { 3383 Id = "MobileNavigationActions", 3384 SortId = 30, 3385 Template = RenderMobileNavigationActions(), 3386 SkipRenderBlocksList = true 3387 }; 3388 mobileNavigationBlocksPage.Add("MobileNavigation", mobileNavigationActions); 3389 3390 if (!navigationItemsHideSignIn) 3391 { 3392 if (Model.CurrentUser.ID <= 0) 3393 { 3394 Block mobileNavigationSignInAction = new Block 3395 { 3396 Id = "MobileNavigationSignInAction", 3397 SortId = 10, 3398 Template = RenderMobileNavigationSignInAction() 3399 }; 3400 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignInAction); 3401 3402 if (!hideCreateAccountLink) 3403 { 3404 Block mobileNavigationCreateAccountAction = new Block 3405 { 3406 Id = "MobileNavigationCreateAccountAction", 3407 SortId = 20, 3408 Template = RenderMobileNavigationCreateAccountAction() 3409 }; 3410 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationCreateAccountAction); 3411 } 3412 } 3413 else 3414 { 3415 if (!hideMyOrdersLink) 3416 { 3417 Block mobileNavigationOrdersAction = new Block 3418 { 3419 Id = "MobileNavigationOrdersAction", 3420 SortId = 20, 3421 Template = RenderMobileNavigationOrdersAction() 3422 }; 3423 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationOrdersAction); 3424 } 3425 if (!hideMyFavoritesLink) 3426 { 3427 Block mobileNavigationFavoritesAction = new Block 3428 { 3429 Id = "MobileNavigationFavoritesAction", 3430 SortId = 30, 3431 Template = RenderMobileNavigationFavoritesAction() 3432 }; 3433 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationFavoritesAction); 3434 } 3435 if (!hideMySavedCardsLink) 3436 { 3437 Block mobileNavigationSavedCardsAction = new Block 3438 { 3439 Id = "MobileNavigationFavoritesAction", 3440 SortId = 30, 3441 Template = RenderMobileNavigationSavedCardsAction() 3442 }; 3443 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSavedCardsAction); 3444 } 3445 3446 Block mobileNavigationSignOutAction = new Block 3447 { 3448 Id = "MobileNavigationSignOutAction", 3449 SortId = 40, 3450 Template = RenderMobileNavigationSignOutAction() 3451 }; 3452 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationSignOutAction); 3453 } 3454 } 3455 3456 if (Model.Languages.Count > 1) 3457 { 3458 Block mobileNavigationLanguagesAction = new Block 3459 { 3460 Id = "MobileNavigationLanguagesAction", 3461 SortId = 50, 3462 Template = RenderMobileNavigationLanguagesAction() 3463 }; 3464 mobileNavigationBlocksPage.Add("MobileNavigationActions", mobileNavigationLanguagesAction); 3465 } 3466 } 3467 3468 3469 @helper MobileNavigation() 3470 { 3471 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigation").OrderBy(item => item.SortId).ToList(); 3472 3473 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 3474 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 3475 int cartFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 3476 string mobileTopDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design") != null ? Model.Area.Item.GetItem("Layout").GetItem("MobileTop").GetList("Design").SelectedValue : "nav-left"; 3477 string position = mobileTopDesign == "nav-left" || mobileTopDesign == "nav-search-left" ? "left" : "right"; 3478 3479 <!-- Trigger for mobile navigation --> 3480 <input type="checkbox" id="MobileNavTrigger" class="mobile-nav-trigger mobile-nav-trigger--@position" autocomplete="off" /> 3481 3482 <!-- Mobile navigation --> 3483 <nav class="mobile-navigation mobile-navigation--@position dw-mod"> 3484 <div class="mobile-navigation__wrapper" id="mobileNavigationWrapper"> 3485 @RenderBlockList(subBlocks) 3486 </div> 3487 </nav> 3488 3489 <label class="mobile-nav-trigger-off" for="MobileNavTrigger"></label> 3490 3491 if (!onlyPreview) 3492 { 3493 <div class="u-visually-hidden js-handlebars-root js-mini-cart" id="miniCart" data-template="MiniCartContent" data-cart-id="@cartFeedPageId" data-json-feed="/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart" data-init-onload="false"></div> 3494 } 3495 } 3496 3497 @helper RenderMobileNavigationSignIn() 3498 { 3499 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3500 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3501 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3502 string myProfilePageLink = linkStart + myProfilePageId; 3503 string userName = Model.CurrentUser.FirstName ?? ""; 3504 userName += " " + (Model.CurrentUser.LastName ?? ""); 3505 userName += userName == "" && Model.CurrentUser.UserName != null ? Model.CurrentUser.UserName : ""; 3506 3507 <ul class="menu menu-mobile"> 3508 <li class="menu-mobile__item"> 3509 <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> 3510 </li> 3511 </ul> 3512 } 3513 3514 @helper RenderMobileNavigationMenu() 3515 { 3516 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3517 string menuTemplate = isSlidesDesign ? "BaseMenuForMobileSlides.xslt" : "BaseMenuForMobileExpandable.xslt"; 3518 string levels = !String.IsNullOrEmpty(Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels")) ? Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetString("Levels") : "3"; 3519 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3520 int startLevel = renderPagesInToolBar ? 1 : 0; 3521 3522 @RenderNavigation(new 3523 { 3524 id = "mobilenavigation", 3525 cssclass = "menu menu-mobile dwnavigation", 3526 startLevel = @startLevel, 3527 ecomStartLevel = @startLevel + 1, 3528 endlevel = @levels, 3529 expandmode = "all", 3530 template = @menuTemplate 3531 }) 3532 3533 if (isSlidesDesign) 3534 { 3535 <script> 3536 function goToLevel(level) { 3537 3538 document.getElementById('mobileNavigationWrapper').style.left = -(level * 100) + "%"; 3539 console.log(level); 3540 3541 } 3542 3543 document.addEventListener('DOMContentLoaded', function () { 3544 goToLevel(document.getElementById('mobileNavigationWrapper').querySelectorAll('input[type=radio]:checked').length); 3545 }); 3546 </script> 3547 } 3548 3549 if (renderPagesInToolBar) 3550 { 3551 @RenderNavigation(new 3552 { 3553 id = "topToolsMobileNavigation", 3554 cssclass = "menu menu-mobile dwnavigation", 3555 template = "ToolsMenuForMobile.xslt" 3556 }) 3557 } 3558 } 3559 3560 @helper RenderMobileNavigationActions() 3561 { 3562 List<Block> subBlocks = this.mobileNavigationBlocksPage.GetBlockListById("MobileNavigationActions").OrderBy(item => item.SortId).ToList(); ; 3563 3564 <ul class="menu menu-mobile"> 3565 @RenderBlockList(subBlocks) 3566 </ul> 3567 } 3568 3569 @helper RenderMobileNavigationSignInAction() 3570 { 3571 <li class="menu-mobile__item"> 3572 <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> 3573 </li> 3574 } 3575 3576 @helper RenderMobileNavigationCreateAccountAction() 3577 { 3578 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 3579 3580 <li class="menu-mobile__item"> 3581 <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> 3582 </li> 3583 } 3584 3585 @helper RenderMobileNavigationProfileAction() 3586 { 3587 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3588 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3589 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 3590 string myProfilePageLink = linkStart + myProfilePageId; 3591 3592 <li class="menu-mobile__item"> 3593 <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> 3594 </li> 3595 } 3596 3597 @helper RenderMobileNavigationOrdersAction() 3598 { 3599 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3600 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3601 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 3602 string myOrdersPageLink = linkStart + myOrdersPageId; 3603 string ordersIcon = "fas fa-list"; 3604 3605 <li class="menu-mobile__item"> 3606 <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> 3607 </li> 3608 } 3609 3610 @helper RenderMobileNavigationFavoritesAction() 3611 { 3612 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3613 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3614 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 3615 string myFavoritesPageLink = linkStart + myFavoritesPageId; 3616 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"; 3617 3618 3619 <li class="menu-mobile__item"> 3620 <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> 3621 </li> 3622 } 3623 3624 @helper RenderMobileNavigationSavedCardsAction() 3625 { 3626 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 3627 string linkStart = Model.CurrentUser.ID <= 0 ? "/Default.aspx?ID=" + signInProfilePageId + "&RedirectPageId=" : "/Default.aspx?ID="; 3628 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 3629 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 3630 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"; 3631 3632 <li class="menu-mobile__item"> 3633 <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> 3634 </li> 3635 } 3636 3637 @helper RenderMobileNavigationSignOutAction() 3638 { 3639 int pageId = Model.TopPage.ID; 3640 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"; 3641 3642 <li class="menu-mobile__item"> 3643 <a class="menu-mobile__link menu-mobile__link--highlighted dw-mod" href="/Admin/Public/ExtranetLogoff.aspx?ID=@pageId"><i class="@signOutIcon menu-mobile__link-icon"></i> @Translate("Sign out")</a> 3644 </li> 3645 } 3646 3647 @helper RenderMobileNavigationLanguagesAction() 3648 { 3649 bool isSlidesDesign = Model.Area.Item.GetItem("Layout").GetItem("MobileNavigation").GetList("Design").SelectedValue == "Slides"; 3650 3651 string selectedLanguage = ""; 3652 foreach (var lang in Model.Languages) 3653 { 3654 if (lang.IsCurrent) 3655 { 3656 selectedLanguage = lang.Name; 3657 } 3658 } 3659 3660 <li class="menu-mobile__item dw-mod"> 3661 @if (isSlidesDesign) 3662 { 3663 <input id="MobileMenuCheck_Language" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(1);"> 3664 } 3665 else 3666 { 3667 <input id="MobileMenuCheck_Language" type="checkbox" class="expand-trigger"> 3668 } 3669 <div class="menu-mobile__link__wrap"> 3670 <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> 3671 <label for="MobileMenuCheck_Language" class="menu-mobile__trigger"></label> 3672 </div> 3673 <ul class="menu-mobile menu-mobile__submenu expand-menu"> 3674 @if (isSlidesDesign) 3675 { 3676 <li class="menu-mobile__item dw-mod"> 3677 <div class="menu-mobile__link__wrap"> 3678 <input id="MobileMenuCheck_Language_back" type="radio" class="expand-trigger" name="mobile-menu-level-1" onclick="goToLevel(0);" /> 3679 <label for="MobileMenuCheck_Language_back" class="menu-mobile__trigger menu-mobile__trigger--back"></label> 3680 <label for="MobileMenuCheck_Language_back" class="menu-mobile__link dw-mod ">@Translate("Back")</label> 3681 </div> 3682 </li> 3683 } 3684 @foreach (var lang in Model.Languages) 3685 { 3686 <li class="menu-mobile__item dw-mod"> 3687 <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> 3688 </li> 3689 } 3690 </ul> 3691 </li> 3692 }</text> 3693 } 3694 else 3695 { 3696 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3697 3698 @using System 3699 @using System.Web 3700 @using System.Collections.Generic 3701 @using Dynamicweb.Rapido.Blocks.Extensibility 3702 @using Dynamicweb.Rapido.Blocks 3703 3704 @functions { 3705 BlocksPage headerBlocksPage = BlocksPage.GetBlockPage("Master"); 3706 } 3707 3708 @{ 3709 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 3710 { 3711 Block masterTools = new Block() 3712 { 3713 Id = "MasterDesktopTools", 3714 SortId = 10, 3715 Template = RenderDesktopTools(), 3716 SkipRenderBlocksList = true, 3717 BlocksList = new List<Block> 3718 { 3719 new Block { 3720 Id = "MasterDesktopToolsText", 3721 SortId = 10, 3722 Template = RenderDesktopToolsText(), 3723 Design = new Design 3724 { 3725 Size = "auto", 3726 HidePadding = true, 3727 RenderType = RenderType.Column 3728 } 3729 }, 3730 new Block { 3731 Id = "MasterDesktopToolsNavigation", 3732 SortId = 20, 3733 Template = RenderDesktopToolsNavigation(), 3734 Design = new Design 3735 { 3736 Size = "auto-width", 3737 HidePadding = true, 3738 RenderType = RenderType.Column 3739 } 3740 } 3741 } 3742 }; 3743 headerBlocksPage.Add("MasterHeader", masterTools); 3744 } 3745 3746 Block masterDesktopExtra = new Block() 3747 { 3748 Id = "MasterDesktopExtra", 3749 SortId = 10, 3750 Template = RenderDesktopExtra(), 3751 SkipRenderBlocksList = true 3752 }; 3753 headerBlocksPage.Add("MasterHeader", masterDesktopExtra); 3754 3755 Block masterDesktopNavigation = new Block() 3756 { 3757 Id = "MasterDesktopNavigation", 3758 SortId = 20, 3759 Template = RenderDesktopNavigation(), 3760 SkipRenderBlocksList = true 3761 }; 3762 headerBlocksPage.Add("MasterHeader", masterDesktopNavigation); 3763 } 3764 3765 @* Include the Blocks for the page *@ 3766 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3767 3768 @using System 3769 @using System.Web 3770 @using Dynamicweb.Rapido.Blocks.Extensibility 3771 @using Dynamicweb.Rapido.Blocks 3772 3773 @{ 3774 Block masterDesktopLogo = new Block 3775 { 3776 Id = "MasterDesktopLogo", 3777 SortId = 10, 3778 Template = RenderDesktopLogo(), 3779 Design = new Design 3780 { 3781 Size = "auto-width", 3782 HidePadding = true, 3783 RenderType = RenderType.Column, 3784 CssClass = "grid--align-self-center" 3785 } 3786 }; 3787 3788 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopLogo); 3789 } 3790 3791 3792 @helper RenderDesktopLogo() 3793 { 3794 string firstPageId = Model.Area.FirstActivePage.ID.ToString(); 3795 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3796 string alignClass = topLayout == "two-lines-centered" || topLayout == "two-lines" ? "grid--align-self-center" : ""; 3797 string logo = Model.Area.Item.GetItem("Layout").GetFile("LogoImage") != null ? Model.Area.Item.GetItem("Layout").GetFile("LogoImage").PathUrlEncoded : "/Files/Images/logo-dynamicweb.png"; 3798 if (Path.GetExtension(logo).ToLower() != ".svg") 3799 { 3800 int logoHeight = Model.Area.Item.GetItem("Layout").GetInt32("LogoHeight"); 3801 logoHeight = logoHeight > 0 && Pageview.Device.ToString() != "Mobile" ? logoHeight : 40; 3802 logo = "/Admin/Public/GetImage.ashx?height=" + Converter.ToString(logoHeight) + "&amp;crop=5&amp;Compression=75&amp;image=" + logo; 3803 } 3804 else 3805 { 3806 logo = HttpUtility.UrlDecode(logo); 3807 } 3808 3809 <div class="logo @alignClass dw-mod"> 3810 <a href="/Default.aspx?ID=@firstPageId" class="logo__img dw-mod u-block"> 3811 <img class="grid__cell-img logo__img dw-mod" src="@logo" alt="@Translate("Logo")" /> 3812 </a> 3813 </div> 3814 } 3815 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3816 3817 @using System 3818 @using System.Web 3819 @using Dynamicweb.Rapido.Blocks.Extensibility 3820 @using Dynamicweb.Rapido.Blocks 3821 3822 @functions { 3823 bool isMegaMenu; 3824 } 3825 3826 @{ 3827 isMegaMenu = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu") != null ? Converter.ToBoolean(Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("NavigationMegaMenu").SelectedValue) : false; 3828 Block masterDesktopMenu = new Block 3829 { 3830 Id = "MasterDesktopMenu", 3831 SortId = 10, 3832 Template = RenderDesktopMenu(), 3833 Design = new Design 3834 { 3835 Size = "auto", 3836 HidePadding = true, 3837 RenderType = RenderType.Column 3838 } 3839 }; 3840 3841 if (isMegaMenu) 3842 { 3843 masterDesktopMenu.Design.CssClass = "u-reset-position"; 3844 } 3845 3846 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopMenu); 3847 } 3848 3849 @helper RenderDesktopMenu() 3850 { 3851 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3852 string menuAlignment = topLayout == "minimal-right" ? "grid--align-self-end" : ""; 3853 string megamenuPromotionImage = Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetFile("MegamenuPromotionImage").PathUrlEncoded : ""; 3854 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 3855 bool showOnlyHeaders = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowOnlyHeaders"); 3856 int startLevel = renderPagesInToolBar ? 1 : 0; 3857 3858 string promotionLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("MegamenuPromotionLink"); 3859 3860 <div class="grid__cell u-flex @(isMegaMenu ? "u-reset-position" : "") @menuAlignment"> 3861 @if (!isMegaMenu) 3862 { 3863 @RenderNavigation(new 3864 { 3865 id = "topnavigation", 3866 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3867 startLevel = startLevel+1, 3868 ecomStartLevel = startLevel + 2, 3869 endlevel = 5, 3870 expandmode = "all", 3871 template = "BaseMenuWithDropdown.xslt" 3872 }); 3873 } 3874 else 3875 { 3876 @RenderNavigation(new 3877 { 3878 id = "topnavigation", 3879 cssclass = "menu dw-mod dwnavigation u-full-max-width u-flex grid--wrap", 3880 startLevel = startLevel, 3881 ecomStartLevel = startLevel + 1, 3882 endlevel = 5, 3883 promotionImage = megamenuPromotionImage, 3884 promotionLink = promotionLink, 3885 expandmode = "all", 3886 showOnlyHeaders = showOnlyHeaders.ToString().ToLower(), 3887 template = "BaseMegaMenu.xslt" 3888 }); 3889 } 3890 </div> 3891 } 3892 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3893 3894 @using System 3895 @using System.Web 3896 @using Dynamicweb.Rapido.Blocks.Extensibility 3897 @using Dynamicweb.Rapido.Blocks 3898 3899 @{ 3900 Block masterDesktopActionsMenu = new Block 3901 { 3902 Id = "MasterDesktopActionsMenu", 3903 SortId = 10, 3904 Template = RenderDesktopActionsMenu(), 3905 Design = new Design 3906 { 3907 CssClass = "u-flex" 3908 }, 3909 SkipRenderBlocksList = true 3910 3911 }; 3912 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterDesktopActionsMenu); 3913 3914 if (!string.IsNullOrWhiteSpace(Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"))) 3915 { 3916 Block masterDesktopActionsHeaderButton = new Block 3917 { 3918 Id = "MasterDesktopActionsHeaderButton", 3919 SortId = 60, 3920 Template = RenderHeaderButton() 3921 }; 3922 masterDesktopActionsMenu.Add(masterDesktopActionsHeaderButton); 3923 } 3924 } 3925 3926 @helper RenderDesktopActionsMenu() 3927 { 3928 List<Block> subBlocks = this.headerBlocksPage.GetBlockListById("MasterDesktopActionsMenu").OrderBy(item => item.SortId).ToList(); 3929 3930 <ul class="menu u-flex dw-mod"> 3931 @RenderBlockList(subBlocks) 3932 </ul> 3933 } 3934 3935 @helper RenderHeaderButton() 3936 { 3937 string headerButtonText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonText"); 3938 string headerButtonLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("HeaderButtonLink"); 3939 string headerButtonType = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType") != null ? "btn--" + Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("HeaderButtonType").SelectedName.ToLower() : ""; 3940 3941 <li class="menu__item menu__item--horizontal menu--clean dw-mod"> 3942 <a class="btn @headerButtonType dw-mod u-no-margin u-margin-top u-margin-left" href="@headerButtonLink">@headerButtonText</a> 3943 </li> 3944 } 3945 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 3946 3947 @using System 3948 @using System.Web 3949 @using Dynamicweb.Core; 3950 @using System.Text.RegularExpressions 3951 @using Dynamicweb.Rapido.Blocks.Extensibility 3952 @using Dynamicweb.Rapido.Blocks 3953 3954 @{ 3955 Block masterDesktopActionsMenuLanguageSelector = new Block 3956 { 3957 Id = "MasterDesktopActionsMenuLanguageSelector", 3958 SortId = 40, 3959 Template = RenderLanguageSelector() 3960 }; 3961 3962 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuLanguageSelector); 3963 } 3964 3965 @helper RenderLanguageSelector() 3966 { 3967 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 3968 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 3969 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 3970 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() : ""; 3971 3972 if (Model.Languages.Count > 1) 3973 { 3974 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon is-dropdown is-dropdown--no-icon dw-mod"> 3975 <div class="@menuLinkClass dw-mod"> 3976 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("LanguageIcon").SelectedValue fa-1_5x"></i> 3977 </div> 3978 <div class="menu menu--dropdown menu--dropdown-right languages-dropdown dw-mod grid__cell"> 3979 @foreach (var lang in Model.Languages) 3980 { 3981 string langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " u-margin-right\"></span>" + lang.Name; 3982 string cultureName = Regex.Replace(Dynamicweb.Services.Areas.GetArea(lang.ID).CultureInfo.NativeName, @" ?\(.*?\)", string.Empty); 3983 cultureName = char.ToUpper(cultureName[0]) + cultureName.Substring(1); 3984 3985 if (languageViewType == "flag-culture") 3986 { 3987 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span> " + cultureName; 3988 } 3989 3990 if (languageViewType == "flag") 3991 { 3992 langInfo = "<span class=\"flag-icon flag-icon-" + Dynamicweb.Services.Areas.GetArea(lang.ID).EcomCountryCode.ToLower() + " \"></span>"; 3993 } 3994 3995 if (languageViewType == "name") 3996 { 3997 langInfo = lang.Name; 3998 } 3999 4000 if (languageViewType == "culture") 4001 { 4002 langInfo = cultureName; 4003 } 4004 4005 <a href="/Default.aspx?AreaID=@Dynamicweb.Services.Pages.GetPage(lang.Page.ID).Area.ID" class="menu-dropdown__item menu-dropdown__item--link dw-mod">@langInfo</a> 4006 } 4007 </div> 4008 </li> 4009 } 4010 } 4011 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4012 4013 @using System 4014 @using System.Web 4015 @using Dynamicweb.Rapido.Blocks.Extensibility 4016 @using Dynamicweb.Rapido.Blocks 4017 4018 @{ 4019 Block masterDesktopActionsMenuSignIn = new Block 4020 { 4021 Id = "MasterDesktopActionsMenuSignIn", 4022 SortId = 20, 4023 Template = RenderSignIn() 4024 }; 4025 4026 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuSignIn); 4027 } 4028 4029 @helper RenderSignIn() 4030 { 4031 bool navigationItemsHideSignIn = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSignIn"); 4032 string userInitials = ""; 4033 int pageId = Model.TopPage.ID; 4034 int createAccountPageId = GetPageIdByNavigationTag("CreateAccount"); 4035 int myDashboardPageId = GetPageIdByNavigationTag("CustomerDashboard"); 4036 int myProfilePageId = GetPageIdByNavigationTag("CustomerProfile"); 4037 int myOrdersPageId = GetPageIdByNavigationTag("CustomerOrders"); 4038 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4039 int mySavedCardsPageId = GetPageIdByNavigationTag("SavedCards"); 4040 int signInProfilePageId = GetPageIdByNavigationTag("SignInPage"); 4041 bool hideCreateAccountLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideCreateAccount"); 4042 bool hideMyProfileLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideProfile"); 4043 bool hideMyOrdersLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideOrders"); 4044 bool hideMySavedCardsLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideSavedCards"); 4045 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideFavorites"); 4046 bool hideForgotPasswordLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("SignInHideForgotPasswordLink"); 4047 4048 string linkStart = "/Default.aspx?ID="; 4049 if (Model.CurrentUser.ID <= 0) 4050 { 4051 linkStart += signInProfilePageId + "&RedirectPageId="; 4052 } 4053 4054 string forgotPasswordPageLink = "/Default.aspx?ID=" + signInProfilePageId + "&LoginAction=Recovery"; 4055 string myProfilePageLink = linkStart + myProfilePageId; 4056 string myOrdersPageLink = linkStart + myOrdersPageId; 4057 string myFavoritesPageLink = linkStart + myFavoritesPageId; 4058 string mySavedCardsPageLink = linkStart + mySavedCardsPageId; 4059 4060 string profileIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue : "fa fa-user"; 4061 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"; 4062 4063 if (Model.CurrentUser.ID != 0) 4064 { 4065 if (!String.IsNullOrEmpty(Model.CurrentUser.Name)) 4066 { 4067 string[] names = Model.CurrentUser.Name.Split(' '); 4068 userInitials += Model.CurrentUser.Name.Substring(0, 1); 4069 4070 if (names.Length > 1) 4071 { 4072 userInitials += names[names.Length - 1].Substring(0, 1); 4073 } 4074 } 4075 else 4076 { 4077 userInitials += Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName != "" ? Model.CurrentUser.FirstName.Substring(0, 1) : ""; 4078 userInitials += Model.CurrentUser.LastName != null && Model.CurrentUser.LastName != "" ? Model.CurrentUser.LastName.Substring(0, 1) : ""; 4079 userInitials += userInitials.Length == 1 && Model.CurrentUser.FirstName != null && Model.CurrentUser.FirstName.Length > 1 ? Model.CurrentUser.FirstName.Substring(1, 2) : ""; 4080 userInitials += userInitials == "" && Model.CurrentUser.Email != null && Model.CurrentUser.Email.Length > 1 ? Model.CurrentUser.Email.Substring(0, 2) : ""; 4081 userInitials += userInitials == "" ? Model.CurrentUser.UserName.Substring(0, 2) : ""; 4082 } 4083 } 4084 4085 if (!navigationItemsHideSignIn) 4086 { 4087 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4088 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu__item--clean"; 4089 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4090 4091 <li class="menu__item menu__item--horizontal menu__item menu__item--icon @liClasses is-dropdown is-dropdown--no-icon dw-mod"> 4092 <div class="@menuLinkClass dw-mod"> 4093 @if (Model.CurrentUser.ID <= 0) 4094 { 4095 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SignInProfileIcon").SelectedValue fa-1_5x"></i> 4096 } 4097 else 4098 { 4099 <a href="/default.aspx?ID=@myDashboardPageId" class="u-color-inherit"><div class="circle-icon-btn">@userInitials.ToUpper()</div></a> 4100 } 4101 </div> 4102 <div class="menu menu--dropdown menu--dropdown-right menu--sign-in grid__cell dw-mod"> 4103 <ul class="list list--clean dw-mod"> 4104 @if (Model.CurrentUser.ID <= 0) 4105 { 4106 <li> 4107 <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> 4108 </li> 4109 4110 if (!hideCreateAccountLink) 4111 { 4112 @RenderListItem("/default.aspx?ID=" + createAccountPageId, Translate("Create account")); 4113 } 4114 if (!hideForgotPasswordLink) 4115 { 4116 @RenderListItem(forgotPasswordPageLink, Translate("Forgot your password?")) 4117 } 4118 } 4119 else 4120 { 4121 if (!hideMyProfileLink) 4122 { 4123 @RenderListItem(myProfilePageLink, Translate("My Profile"), profileIcon) 4124 } 4125 if (!hideMyOrdersLink) 4126 { 4127 @RenderListItem(myOrdersPageLink, Translate("My Orders"), "fas fa-list") 4128 } 4129 if (!hideMyFavoritesLink) 4130 { 4131 @RenderListItem(myFavoritesPageLink, Translate("My Favorites"), favoritesIcon) 4132 } 4133 if (!hideMySavedCardsLink) 4134 { 4135 @RenderListItem(mySavedCardsPageLink, Translate("My Saved cards"), "fas fa-credit-card") 4136 } 4137 if (Model.CurrentUser.ID > 0) 4138 { 4139 if (!hideMyProfileLink || !hideMyOrdersLink || !hideMyFavoritesLink || !hideMySavedCardsLink) 4140 { 4141 @RenderSeparator() 4142 } 4143 4144 @RenderListItem("/Admin/Public/ExtranetLogoff.aspx?ID=" + pageId, Translate("Sign out")) 4145 } 4146 } 4147 4148 </ul> 4149 </div> 4150 </li> 4151 } 4152 } 4153 4154 @helper RenderListItem(string link, string text, string icon = null) { 4155 <li> 4156 <a href="@link" class="list__link dw-mod"> 4157 @if (!string.IsNullOrEmpty(icon)) 4158 { 4159 <i class="@icon u-margin-right"></i> 4160 } 4161 @text 4162 </a> 4163 </li> 4164 } 4165 4166 @helper RenderSeparator() 4167 { 4168 <li class="list__seperator dw-mod"></li> 4169 } 4170 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4171 4172 @using System 4173 @using System.Web 4174 @using Dynamicweb.Rapido.Blocks.Extensibility 4175 @using Dynamicweb.Rapido.Blocks 4176 4177 @{ 4178 bool hideMyFavoritesLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideFavorites"); 4179 4180 Block masterDesktopActionsMenuFavorites = new Block 4181 { 4182 Id = "MasterDesktopActionsMenuFavorites", 4183 SortId = 30, 4184 Template = RenderFavorites() 4185 }; 4186 4187 if (!hideMyFavoritesLink && Model.CurrentUser.ID > 0) 4188 { 4189 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuFavorites); 4190 } 4191 } 4192 4193 @helper RenderFavorites() 4194 { 4195 int myFavoritesPageId = GetPageIdByNavigationTag("CustomerFavorites"); 4196 string myFavoritesPageLink = "/Default.aspx?ID=" + myFavoritesPageId; 4197 4198 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4199 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4200 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4201 4202 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4203 <a href="@myFavoritesPageLink" class="@menuLinkClass dw-mod"> 4204 <i class="fas fa-@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("FavoriteIcon").SelectedValue fa-1_5x"></i> 4205 </a> 4206 </li> 4207 } 4208 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4209 4210 @using System 4211 @using System.Web 4212 @using Dynamicweb.Rapido.Blocks.Extensibility 4213 @using Dynamicweb.Rapido.Blocks 4214 4215 @{ 4216 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 4217 bool hideCart = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideCart"); 4218 string miniCartLayout = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("Layout").SelectedValue : "dropdown"; 4219 4220 if (!onlyPreview && !hideCart) 4221 { 4222 Block masterDesktopActionsMenuMiniCart = new Block 4223 { 4224 Id = "MasterDesktopActionsMenuMiniCart", 4225 SortId = 50, 4226 Template = RenderMiniCart(miniCartLayout == "dropdown"), 4227 SkipRenderBlocksList = true, 4228 BlocksList = new List<Block>() 4229 }; 4230 4231 Block miniCartCounterScriptTemplate = new Block 4232 { 4233 Id = "MiniCartCounterScriptTemplate", 4234 Template = RenderMiniCartCounterContent() 4235 }; 4236 4237 //dropdown layout is default 4238 RazorEngine.Templating.TemplateWriter layoutTemplate = RenderMiniCartDropdownLayout(); 4239 RazorEngine.Templating.TemplateWriter miniCartTriggerTemplate = RenderMiniCartTriggerLink(); 4240 4241 switch (miniCartLayout) 4242 { 4243 case "panel": 4244 layoutTemplate = RenderMiniCartPanelLayout(); 4245 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4246 break; 4247 case "modal": 4248 layoutTemplate = RenderMiniCartModalLayout(); 4249 miniCartTriggerTemplate = RenderMiniCartTriggerLabel(); 4250 break; 4251 } 4252 4253 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4254 { 4255 Id = "MiniCartTrigger", 4256 Template = miniCartTriggerTemplate 4257 }); 4258 4259 if (Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet") 4260 { 4261 masterDesktopActionsMenuMiniCart.BlocksList.Add(new Block 4262 { 4263 Id = "MiniCartLayout", 4264 Template = layoutTemplate 4265 }); 4266 } 4267 4268 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuMiniCart); 4269 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", miniCartCounterScriptTemplate); 4270 } 4271 } 4272 4273 @helper RenderMiniCart(bool hasMouseEnterEvent) 4274 { 4275 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterDesktopActionsMenuMiniCart").OrderBy(item => item.SortId).ToList(); 4276 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4277 string liClasses = topLayout != "normal" ? "menu__item--top-level" : "menu--clean"; 4278 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4279 string mouseEvent = ""; 4280 string id = "MiniCart"; 4281 if (hasMouseEnterEvent) { 4282 mouseEvent = "onmouseenter=\"Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=" + miniCartFeedPageId + "&feedType=MiniCart')\""; 4283 id = "miniCartTrigger"; 4284 } 4285 <li class="menu__item menu__item--horizontal menu__item--icon @liClasses dw-mod" id="@id" @mouseEvent> 4286 @RenderBlockList(subBlocks) 4287 </li> 4288 } 4289 4290 @helper RenderMiniCartTriggerLabel() 4291 { 4292 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4293 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4294 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4295 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4296 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4297 4298 <div class="@menuLinkClass dw-mod js-mini-cart-button" onclick="Cart.UpdateMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '/Default.aspx?ID=@miniCartFeedPageId&feedType=MiniCart')"> 4299 <div class="u-inline u-position-relative"> 4300 <i class="@cartIcon fa-1_5x"></i> 4301 @RenderMiniCartCounter() 4302 </div> 4303 </div> 4304 } 4305 4306 @helper RenderMiniCartTriggerLink() 4307 { 4308 int cartPageId = GetPageIdByNavigationTag("CartPage"); 4309 string cartIcon = Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon") != null ? Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue : "fa fa-cart"; 4310 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4311 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4312 4313 <a href="/Default.aspx?ID=@cartPageId&Purge=True" class="@menuLinkClass menu__item--icon dw-mod js-mini-cart-button"> 4314 <div class="u-inline u-position-relative"> 4315 <i class="@cartIcon fa-1_5x"></i> 4316 @RenderMiniCartCounter() 4317 </div> 4318 </a> 4319 } 4320 4321 @helper RenderMiniCartCounter() 4322 { 4323 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4324 string cartProductsCount = Model.Cart.TotalProductsCount.ToString(); 4325 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4326 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4327 string cartProductsTotalPrice = showPrice && Model.Cart.TotalPrice != null ? Model.Cart.TotalPrice.Price.Formatted : ""; 4328 cartProductsTotalPrice = counterPosition == "right" ? cartProductsTotalPrice : ""; 4329 4330 if (showPrice && counterPosition == "right") 4331 { 4332 cartProductsCount = Translate("Cart") + "(" + cartProductsCount + ")"; 4333 } 4334 4335 <div class="mini-cart__counter u-ta-center dw-mod"> 4336 <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"> 4337 <div class="js-mini-cart-counter-content" data-count="@Model.Cart.TotalProductsCount.ToString()"> 4338 @cartProductsCount 4339 @cartProductsTotalPrice 4340 </div> 4341 </div> 4342 </div> 4343 } 4344 4345 @helper RenderMiniCartCounterContent() 4346 { 4347 bool showPrice = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetBoolean("ShowPrice"); 4348 string counterPosition = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("CounterPosition").SelectedValue : "right"; 4349 bool showPriceInMiniCartCounter = Pageview.Device.ToString() != "Mobile" && counterPosition == "right" && showPrice; 4350 4351 <script id="MiniCartCounterContent" type="text/x-template"> 4352 {{#.}} 4353 <div class="js-mini-cart-counter-content dw-mod" data-count="{{numberofproducts}}"> 4354 @if (showPriceInMiniCartCounter) 4355 { 4356 @Translate("Cart")<text>({{numberofproducts}}) {{totalprice}}</text> 4357 } 4358 else 4359 { 4360 <text>{{numberofproducts}}</text> 4361 } 4362 </div> 4363 {{/.}} 4364 </script> 4365 } 4366 4367 @helper RenderMiniCartDropdownLayout() 4368 { 4369 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4370 4371 <div class="mini-cart mini-cart-dropdown js-mini-cart grid__cell dw-mod" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="dropdown"> 4372 <div class="mini-cart-dropdown__inner dw-mod"> 4373 <h3 class="u-ta-center dw-mod">@Translate("Shopping cart")</h3> 4374 <div class="mini-cart-dropdown__body u-flex dw-mod"> 4375 <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> 4376 </div> 4377 </div> 4378 </div> 4379 } 4380 4381 @helper RenderMiniCartPanelLayout() 4382 { 4383 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4384 4385 <div class="mini-cart grid__cell dw-mod"> 4386 <input type="checkbox" id="miniCartTrigger" class="panel-trigger" /> 4387 <div class="panel panel--right panel--with-close-btn dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block"> 4388 <label for="miniCartTrigger" class="panel__close-btn" title="@Translate("Close panel")"><i class="fas fa-times"></i></label> 4389 <div class="panel__content u-full-width dw-mod"> 4390 <h3 class="panel__header dw-mod u-margin-bottom u-ta-center">@Translate("Shopping cart")</h3> 4391 <div class="panel__content-body panel__content-body--cart dw-mod"> 4392 <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> 4393 </div> 4394 </div> 4395 </div> 4396 </div> 4397 } 4398 4399 @helper RenderMiniCartModalLayout() 4400 { 4401 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 4402 <div class="mini-cart grid__cell dw-mod"> 4403 <input type="checkbox" id="miniCartTrigger" class="modal-trigger" autocomplete="off" /> 4404 <div class="modal-container dw-mod js-mini-cart" id="miniCart" data-cart-id="@miniCartFeedPageId" data-show-type="block"> 4405 <label for="miniCartTrigger" class="modal-overlay"></label> 4406 <div class="modal modal--top-right dw-mod"> 4407 <div class="modal__body u-flex grid--direction-column dw-mod"> 4408 <h3 class="dw-mod u-ta-center">@Translate("Shopping cart")</h3> 4409 <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> 4410 </div> 4411 <label class="modal__close-btn modal__close-btn--clean dw-mod" for="miniCartTrigger" title="@Translate("Close modal")"></label> 4412 </div> 4413 </div> 4414 </div> 4415 } 4416 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4417 4418 @using System 4419 @using System.Web 4420 @using Dynamicweb.Rapido.Blocks.Extensibility 4421 @using Dynamicweb.Rapido.Blocks 4422 4423 @{ 4424 bool showDownloadCartLink = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart"); 4425 4426 Block masterDesktopActionsMenuDownloadCart = new Block 4427 { 4428 Id = "MasterDesktopActionsMenuDownloadCart", 4429 SortId = 35, 4430 Template = RenderDownloadCart() 4431 }; 4432 4433 if (showDownloadCartLink && Model.CurrentUser.ID > 0) 4434 { 4435 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterDesktopActionsMenuDownloadCart); 4436 } 4437 } 4438 4439 @helper RenderDownloadCart() 4440 { 4441 int downloadCartPageId = GetPageIdByNavigationTag("DownloadCart"); 4442 string downloadCartPageLink = "/Default.aspx?ID=" + downloadCartPageId; 4443 4444 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4445 string liClasses = topLayout != "normal" ? "menu__item--top-level u-hidden-xxs" : "menu--clean"; 4446 string menuLinkClass = topLayout != "normal" ? "menu__link menu__link--icon" : "header-menu__link header-menu__link--icon"; 4447 4448 <li class="menu__item menu__item--horizontal @liClasses menu__item--icon dw-mod"> 4449 <a href="@downloadCartPageLink" class="@menuLinkClass dw-mod"> 4450 <i class="fas fa-cart-arrow-down fa-1_5x"></i> 4451 </a> 4452 </li> 4453 } 4454 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4455 4456 @using System 4457 @using System.Web 4458 @using Dynamicweb.Rapido.Blocks.Extensibility 4459 @using Dynamicweb.Rapido.Blocks 4460 4461 @functions { 4462 public class SearchConfiguration 4463 { 4464 public string searchFeedId { get; set; } 4465 public string searchSecondFeedId { get; set; } 4466 public int groupsFeedId { get; set; } 4467 public string resultPageLink { get; set; } 4468 public string searchPlaceholder { get; set; } 4469 public string searchType { get; set; } 4470 public string searchTemplate { get; set; } 4471 public string searchContentTemplate { get; set; } 4472 public string searchValue { get; set; } 4473 public bool showGroups { get; set; } 4474 4475 public SearchConfiguration() 4476 { 4477 searchFeedId = ""; 4478 searchSecondFeedId = ""; 4479 searchType = "product-search"; 4480 searchContentTemplate = ""; 4481 showGroups = true; 4482 } 4483 } 4484 } 4485 @{ 4486 Block masterSearchBar = new Block 4487 { 4488 Id = "MasterSearchBar", 4489 SortId = 40, 4490 Template = RenderSearch("bar"), 4491 Design = new Design 4492 { 4493 Size = "auto", 4494 HidePadding = true, 4495 RenderType = RenderType.Column, 4496 CssClass = "grid--align-end" 4497 } 4498 }; 4499 4500 Block masterSearchAction = new Block 4501 { 4502 Id = "MasterDesktopActionsMenuSearch", 4503 SortId = 10, 4504 Template = RenderSearch() 4505 }; 4506 4507 BlocksPage.GetBlockPage("Master").Add("MasterHeader", masterSearchBar); 4508 BlocksPage.GetBlockPage("Master").Add("MasterDesktopActionsMenu", masterSearchAction); 4509 } 4510 4511 @helper RenderSearch(string type = "mini-search") 4512 { 4513 string productsPageId = Converter.ToString(GetPageIdByNavigationTag("ProductsPage")); 4514 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 4515 string searchType = Model.Area.Item.GetItem("Layout").GetList("TopSearch") != null ? Model.Area.Item.GetItem("Layout").GetList("TopSearch").SelectedValue : "productSearch"; 4516 4517 SearchConfiguration searchConfiguration = null; 4518 4519 switch (searchType) { 4520 case "contentSearch": 4521 searchConfiguration = new SearchConfiguration() { 4522 searchFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4523 resultPageLink = contentSearchPageLink, 4524 searchPlaceholder = Translate("Search page"), 4525 groupsFeedId = 0, 4526 searchType = "content-search", 4527 searchTemplate = "SearchPagesTemplate", 4528 showGroups = false 4529 }; 4530 break; 4531 case "combinedSearch": 4532 searchConfiguration = new SearchConfiguration() { 4533 searchFeedId = productsPageId + "&feed=true", 4534 searchSecondFeedId = GetPageIdByNavigationTag("ContentSearchFeed") + "&Areaid=" + Model.Area.ID + "&pagesOnly=true", 4535 resultPageLink = Converter.ToString(productsPageId), 4536 searchPlaceholder = Translate("Search products or pages"), 4537 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4538 searchType = "combined-search", 4539 searchTemplate = "SearchProductsTemplateWrap", 4540 searchContentTemplate = "SearchPagesTemplateWrap", 4541 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4542 }; 4543 break; 4544 default: //productSearch 4545 searchConfiguration = new SearchConfiguration() { 4546 resultPageLink = Converter.ToString(productsPageId), 4547 searchFeedId = productsPageId + "&feed=true", 4548 groupsFeedId = GetPageIdByNavigationTag("ProductGroupsFeed"), 4549 searchPlaceholder = Translate("Search products"), 4550 searchTemplate = "SearchProductsTemplate", 4551 searchType = "product-search", 4552 showGroups = Model.Area.Item.GetItem("Layout").GetBoolean("ShowGroupsSelector") 4553 }; 4554 break; 4555 } 4556 searchConfiguration.searchValue = HttpContext.Current.Request.QueryString.Get("Search") ?? ""; 4557 4558 if (type == "mini-search") { 4559 @RenderMiniSearch(searchConfiguration) 4560 } else { 4561 @RenderSearchBar(searchConfiguration) 4562 } 4563 } 4564 4565 @helper RenderSearchBar(SearchConfiguration options) 4566 { 4567 <div class="typeahead typeahead--centered u-no-margin u-color-inherit js-typeahead dw-mod" id="ProductSearchBar" 4568 data-page-size="7" 4569 data-search-feed-id="@options.searchFeedId" 4570 data-search-second-feed-id="@options.searchSecondFeedId" 4571 data-result-page-id="@options.resultPageLink" 4572 data-groups-page-id="@options.groupsFeedId" 4573 data-search-type="@options.searchType"> 4574 @if (options.showGroups) 4575 { 4576 <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> 4577 <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> 4578 } 4579 <div class="typeahead-search-field"> 4580 <input type="text" class="u-no-margin u-full-width u-full-height js-typeahead-search-field" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4581 @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4582 { 4583 <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> 4584 } 4585 else 4586 { 4587 <div class="dropdown dropdown--absolute-position dropdown--combined grid"> 4588 <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> 4589 <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> 4590 </div> 4591 } 4592 </div> 4593 <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> 4594 </div> 4595 } 4596 4597 @helper RenderMiniSearch(SearchConfiguration options) 4598 { 4599 4600 4601 <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" > 4602 <div class="menu__link menu__link--icon dw-mod"> 4603 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_5x" id="Search-Icon"></i> 4604 </div> 4605 <div class="menu menu--dropdown menu--dropdown-right u-no-padding u-w380px grid__cell dw-mod"> 4606 <div class="typeahead js-typeahead" id="ProductSearchBar" 4607 data-page-size="7" 4608 data-search-feed-id="@options.searchFeedId" 4609 data-search-second-feed-id="@options.searchSecondFeedId" 4610 data-result-page-id="@options.resultPageLink" 4611 data-search-type="@options.searchType"> 4612 <div class="typeahead-search-field"> 4613 <input type="text" class="u-no-margin u-full-width js-typeahead-search-field" id="headerSearch" placeholder="@options.searchPlaceholder" value="@options.searchValue"> 4614 4615 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("SearchIcon").SelectedValue fa-1_2x" id="Search-Action"> </i> 4616 4617 <!-- @if (string.IsNullOrEmpty(options.searchSecondFeedId)) 4618 { 4619 <ul hidden 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> 4620 } 4621 else 4622 { 4623 <div hidden class="dropdown dropdown--absolute-position dropdown--combined grid dropdown--right-aligned"> 4624 <div hidden 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> 4625 <div hidden 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> 4626 </div> 4627 } 4628 --> 4629 </div> 4630 </div> 4631 </div> 4632 </li> 4633 } 4634 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4635 4636 @using System 4637 @using System.Web 4638 @using Dynamicweb.Rapido.Blocks.Extensibility 4639 @using Dynamicweb.Rapido.Blocks 4640 4641 @{ 4642 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4643 bool hideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 4644 4645 BlocksPage headerConfigurationPage = BlocksPage.GetBlockPage("Master"); 4646 4647 Block configDesktopLogo = headerConfigurationPage.GetBlockById("MasterDesktopLogo"); 4648 headerConfigurationPage.RemoveBlock(configDesktopLogo); 4649 4650 Block configDesktopMenu = headerConfigurationPage.GetBlockById("MasterDesktopMenu"); 4651 headerConfigurationPage.RemoveBlock(configDesktopMenu); 4652 4653 Block configSearchBar = headerConfigurationPage.GetBlockById("MasterSearchBar"); 4654 headerConfigurationPage.RemoveBlock(configSearchBar); 4655 4656 Block configSearchAction = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenuSearch"); 4657 headerConfigurationPage.RemoveBlock(configSearchAction); 4658 4659 Block configDesktopActionsMenu = headerConfigurationPage.GetBlockById("MasterDesktopActionsMenu"); 4660 headerConfigurationPage.RemoveBlock(configDesktopActionsMenu); 4661 4662 Block configDesktopExtra = headerConfigurationPage.GetBlockById("MasterDesktopExtra"); 4663 4664 switch (topLayout) 4665 { 4666 case "condensed": //2 4667 configDesktopLogo.Design.Size = "auto-width"; 4668 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4669 4670 configDesktopMenu.SortId = 20; 4671 configDesktopMenu.Design.Size = "auto"; 4672 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4673 4674 configDesktopActionsMenu.SortId = 30; 4675 configDesktopActionsMenu.Design.Size = "auto-width"; 4676 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4677 4678 if (!hideSearch) 4679 { 4680 configSearchBar.SortId = 40; 4681 configSearchBar.Design.Size = "12"; 4682 configDesktopExtra.SortId = 50; 4683 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4684 } 4685 break; 4686 case "splitted": //3 4687 configDesktopLogo.Design.Size = "auto"; 4688 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4689 4690 if (!hideSearch) 4691 { 4692 configSearchBar.SortId = 20; 4693 configSearchBar.Design.Size = "auto"; 4694 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4695 } 4696 4697 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4698 4699 configDesktopActionsMenu.SortId = 20; 4700 configDesktopActionsMenu.Design.Size = "auto-width"; 4701 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4702 break; 4703 case "minimal": //4 4704 configDesktopLogo.Design.Size = "auto-width"; 4705 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4706 4707 configDesktopMenu.Design.Size = "auto"; 4708 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4709 4710 configDesktopActionsMenu.SortId = 20; 4711 configDesktopActionsMenu.Design.Size = "auto-width"; 4712 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4713 4714 if (!hideSearch) 4715 { 4716 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4717 } 4718 break; 4719 case "minimal-right": //5 4720 configDesktopLogo.Design.Size = "auto-width"; 4721 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopLogo); 4722 4723 configDesktopMenu.Design.Size = "auto"; 4724 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4725 4726 configDesktopActionsMenu.SortId = 20; 4727 configDesktopActionsMenu.Design.Size = "auto-width"; 4728 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4729 4730 if (!hideSearch) 4731 { 4732 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4733 } 4734 break; 4735 case "two-lines": //6 4736 configDesktopLogo.Design.Size = "auto"; 4737 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4738 4739 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4740 4741 configDesktopActionsMenu.SortId = 20; 4742 configDesktopActionsMenu.Design.Size = "auto-width"; 4743 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4744 4745 if (!hideSearch) 4746 { 4747 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4748 } 4749 break; 4750 case "two-lines-centered": //7 4751 configDesktopLogo.Design.Size = "auto"; 4752 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4753 4754 configDesktopMenu.Design.Size = "auto-width"; 4755 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4756 4757 configDesktopActionsMenu.SortId = 20; 4758 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopActionsMenu); 4759 4760 if (!hideSearch) 4761 { 4762 headerConfigurationPage.Add("MasterDesktopActionsMenu", configSearchAction); 4763 } 4764 break; 4765 case "normal": //1 4766 default: 4767 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopLogo); 4768 4769 if (!hideSearch) 4770 { 4771 configSearchBar.SortId = 20; 4772 headerConfigurationPage.Add("MasterDesktopExtra", configSearchBar); 4773 } 4774 4775 configDesktopActionsMenu.SortId = 30; 4776 headerConfigurationPage.Add("MasterDesktopExtra", configDesktopActionsMenu); 4777 4778 configDesktopActionsMenu.Design.Size = "auto-width"; 4779 headerConfigurationPage.Add("MasterDesktopNavigation", configDesktopMenu); 4780 break; 4781 } 4782 } 4783 @if (File.Exists(HttpContext.Current.Server.MapPath("/Files/Templates/Designs/Rapido/MasterBlocks/HeaderBlocks/Custom__Blocks.cshtml"))) 4784 { 4785 <text>@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4786 4787 @using System 4788 @using System.Web 4789 @using Dynamicweb.Rapido.Blocks.Extensibility 4790 @using Dynamicweb.Rapido.Blocks 4791 4792 @{ 4793 4794 }</text> 4795 } 4796 4797 4798 @helper RenderDesktopTools() 4799 { 4800 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopTools").OrderBy(item => item.SortId).ToList(); 4801 4802 <div class="tools-navigation dw-mod"> 4803 <div class="center-container grid top-container__center-container dw-mod"> 4804 @RenderBlockList(subBlocks) 4805 4806 </div> 4807 </div> 4808 } 4809 4810 @helper RenderDesktopToolsText() 4811 { 4812 string toolsText = Model.Area.Item.GetItem("Layout").GetItem("Header").GetString("ToolsText"); 4813 if (!string.IsNullOrEmpty(toolsText)) 4814 { 4815 <div class="u-margin-top u-margin-bottom">@toolsText</div> 4816 } 4817 } 4818 4819 @helper RenderDesktopToolsNavigation() 4820 { 4821 bool renderPagesInToolBar = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("RenderPagesInToolBar"); 4822 4823 if (renderPagesInToolBar) 4824 { 4825 @RenderNavigation(new 4826 { 4827 id = "topToolsNavigation", 4828 cssclass = "menu menu-tools dw-mod dwnavigation", 4829 template = "TopMenu.xslt" 4830 }) 4831 } 4832 } 4833 4834 @helper RenderDesktopNavigation() 4835 { 4836 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopNavigation").OrderBy(item => item.SortId).ToList(); 4837 string topLayout = Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout") != null ? Model.Area.Item.GetItem("Layout").GetItem("Header").GetList("TopLayout").SelectedValue : "normal"; 4838 string alignClass = topLayout == "two-lines-centered" ? "grid--justify-center" : ""; 4839 <nav class="main-navigation dw-mod"> 4840 <div class="center-container top-container__center-container grid @alignClass dw-mod"> 4841 @RenderBlockList(subBlocks) 4842 </div> 4843 </nav> 4844 } 4845 4846 @helper RenderDesktopExtra() 4847 { 4848 List<Block> subBlocks = headerBlocksPage.GetBlockListById("MasterDesktopExtra").OrderBy(item => item.SortId).ToList(); 4849 4850 if (subBlocks.Count > 0) 4851 { 4852 <div class="header header-top dw-mod"> 4853 <div class="center-container top-container__center-container grid--justify-space-between grid grid--align-center dw-mod"> 4854 @RenderBlockList(subBlocks) 4855 </div> 4856 </div> 4857 } 4858 }</text> 4859 } 4860 4861 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4862 4863 @using System 4864 @using System.Web 4865 @using Dynamicweb.Rapido.Blocks.Extensibility 4866 @using Dynamicweb.Rapido.Blocks 4867 4868 @{ 4869 Block impersonationBar = new Block 4870 { 4871 Id = "ImpersonationBar", 4872 SortId = 50, 4873 Template = RenderImpersonationBar(), 4874 Design = new Design 4875 { 4876 Size = "auto-width", 4877 HidePadding = true, 4878 RenderType = RenderType.Column 4879 } 4880 }; 4881 4882 if (Model.CurrentUser.ID > 0 && Model.SecondaryUsers.Count > 0) 4883 { 4884 BlocksPage.GetBlockPage("Master").Add("MasterHeader", impersonationBar); 4885 } 4886 } 4887 4888 @helper RenderImpersonationBar() 4889 { 4890 int impersonationPageId = GetPageIdByNavigationTag("Impersonation"); 4891 4892 <div class="u-color-warning--bg"> 4893 <div class="center-container top-container__center-container dw-mod"> 4894 @*Impersonation*@ 4895 <div class="grid"> 4896 <div class="grid--align-self-center grid__col-x"> 4897 @if (Model.CurrentSecondaryUser != null && Model.CurrentSecondaryUser.ID > 0) 4898 { 4899 string stopImpersonateTranslation = Translate("Stop impersonation"); 4900 string username = ""; 4901 if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.FirstName) && !string.IsNullOrEmpty(Model.CurrentSecondaryUser.LastName)) 4902 { 4903 username = Model.CurrentSecondaryUser.FirstName + " " + Model.CurrentSecondaryUser.LastName; 4904 } 4905 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Name)) 4906 { 4907 username = Model.CurrentSecondaryUser.Name; 4908 } 4909 else if (!string.IsNullOrEmpty(Model.CurrentSecondaryUser.Email)) 4910 { 4911 username = Model.CurrentSecondaryUser.Email; 4912 } 4913 else 4914 { 4915 username = Model.CurrentSecondaryUser.UserName; 4916 } 4917 <div class="grid-cell"> 4918 <div class="u-pull--left u-bold u-margin-top"> 4919 <i class="fas fa-user-secret"></i> 4920 @Pageview.User.UserName<text>&nbsp;</text>@Translate("is impersonating")<text>&nbsp;</text>@username 4921 </div> 4922 <form method="post" class="u-pull--right u-no-margin"> 4923 <input type="submit" class="btn btn--secondary dw-mod u-no-margin" name="DwExtranetRemoveSecondaryUser" value="@stopImpersonateTranslation"> 4924 </form> 4925 </div> 4926 } 4927 else 4928 { 4929 string viewListTranslation = Translate("View the list of users you can impersonate"); 4930 <div class="grid-cell u-bold"> 4931 <i class="fas fa-user-secret"></i> 4932 <a href="/Default.aspx?ID=@impersonationPageId" title="@viewListTranslation" class="u-color-font-black">@viewListTranslation</a> 4933 </div> 4934 } 4935 </div> 4936 </div> 4937 </div> 4938 </div> 4939 } 4940 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 4941 4942 @using System 4943 @using System.Web 4944 @using System.Collections.Generic 4945 @using Dynamicweb.Rapido.Blocks.Extensibility 4946 @using Dynamicweb.Rapido.Blocks 4947 4948 @{ 4949 BlocksPage miniCartBlocksPage = BlocksPage.GetBlockPage("Master"); 4950 string orderlinesView = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("OrderlinesView").SelectedValue : "table"; 4951 4952 Block orderLines = new Block 4953 { 4954 Id = "MiniCartOrderLines", 4955 SkipRenderBlocksList = true, 4956 BlocksList = new List<Block> 4957 { 4958 new Block { 4959 Id = "MiniCartOrderLinesList", 4960 SortId = 20, 4961 Template = RenderMiniCartOrderLinesList() 4962 } 4963 } 4964 }; 4965 4966 Block orderlinesScriptTemplates = new Block 4967 { 4968 Id = "OrderlinesScriptTemplates" 4969 }; 4970 4971 if (orderlinesView == "table") 4972 { 4973 orderLines.Template = RenderMiniCartOrderLinesTable(); 4974 orderLines.BlocksList.Add( 4975 new Block { 4976 Id = "MiniCartOrderlinesTableHeader", 4977 SortId = 10, 4978 Template = RenderMiniCartOrderLinesHeader() 4979 } 4980 ); 4981 4982 orderlinesScriptTemplates.Template = RenderMiniCartScriptsTableTemplates(); 4983 } 4984 else 4985 { 4986 orderLines.Template = RenderMiniCartOrderLinesBlocks(); 4987 orderlinesScriptTemplates.Template = RenderMiniCartScriptsListTemplates(); 4988 } 4989 4990 miniCartBlocksPage.Add("MasterBottomSnippets", orderlinesScriptTemplates); 4991 4992 Block miniCartScriptTemplates = new Block() 4993 { 4994 Id = "MasterMiniCartTemplates", 4995 SortId = 1, 4996 Template = RenderMiniCartScriptTemplates(), 4997 SkipRenderBlocksList = true, 4998 BlocksList = new List<Block> 4999 { 5000 orderLines, 5001 new Block { 5002 Id = "MiniCartFooter", 5003 Template = RenderMiniCartFooter(), 5004 SortId = 50, 5005 SkipRenderBlocksList = true, 5006 BlocksList = new List<Block> 5007 { 5008 new Block { 5009 Id = "MiniCartFees", 5010 Template = RenderMiniCartFees(), 5011 SortId = 30 5012 }, 5013 new Block { 5014 Id = "MiniCartPoints", 5015 Template = RenderMiniCartPoints(), 5016 SortId = 40 5017 }, 5018 new Block { 5019 Id = "MiniCartTotal", 5020 Template = RenderMiniCartTotal(), 5021 SortId = 50 5022 }, 5023 new Block { 5024 Id = "MiniCartActions", 5025 Template = RenderMiniCartActions(), 5026 SortId = 60 5027 } 5028 } 5029 } 5030 } 5031 }; 5032 5033 miniCartBlocksPage.Add("MasterBottomSnippets", miniCartScriptTemplates); 5034 } 5035 5036 @helper RenderMiniCartScriptsTableTemplates() 5037 { int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5038 <script id="MiniCartOrderline" type="text/x-template"> 5039 {{#unless isEmpty}} 5040 <tr> 5041 <td class="u-w60px"><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}}"></a></td> 5042 <td class="u-va-middle"> 5043 <a class="mini-cart-orderline__name" title="{{name}}">{{name}}</a> 5044 {{#if variantname}} 5045 <a class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{variantname}}</a> 5046 {{/if}} 5047 {{#if unitname}} 5048 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm">{{unitname}}</div> 5049 {{/if}} 5050 </td> 5051 <td class="u-ta-right u-va-middle">{{quantity}}</td> 5052 <td class="u-ta-right u-va-middle"> 5053 {{#if pointsTotal}} 5054 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5055 {{else}} 5056 {{totalprice}} 5057 {{/if}} 5058 </td> 5059 <td class="mini-cart-orderline__cell u-ta-left dw-mod u-no-padding-x" width="50"> 5060 <button type="button" style="color:red;" title="@Translate("Remove orderline")" class="btn btn--condensed btn--clean u-no-margin" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}&Redirect=Default.aspx%3FID%3D@(cartOrderlinesFeedPageId)', true);"><i class="far fa-times"></i></button> 5061 </td> 5062 </tr> 5063 {{/unless}} 5064 </script> 5065 5066 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5067 {{#unless isEmpty}} 5068 <tr class="table__row--no-border"> 5069 <td class="u-w60px">&nbsp;</td> 5070 <td><div class="mini-cart-orderline__name dw-mod">{{name}}</div></td> 5071 <td class="u-ta-right">&nbsp;</td> 5072 <td class="u-ta-right">{{totalprice}}</td> 5073 </tr> 5074 {{/unless}} 5075 </script> 5076 } 5077 5078 @helper RenderMiniCartScriptsListTemplates() 5079 { 5080 int cartOrderlinesFeedPageId = GetPageIdByNavigationTag("CartOrderlinesFeed"); 5081 <script id="MiniCartOrderline" type="text/x-template"> 5082 {{#unless isEmpty}} 5083 <div class="mini-cart-orderline grid dw-mod"> 5084 <div class="grid__col-4"> 5085 <a href="{{link}}" class="{{hideimage}}"> 5086 <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}}"> 5087 </a> 5088 </div> 5089 <div class="grid__col-8"> 5090 <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> 5091 {{#if variantname}} 5092 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Variant"): {{variantname}}</div> 5093 {{/if}} 5094 {{#if unitname}} 5095 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Unit"): {{unitname}}</div> 5096 {{/if}} 5097 <div class="mini-cart-orderline__name mini-cart-orderline__name--sm dw-mod">@Translate("Qty"): {{quantity}}</div> 5098 5099 5100 <div class="grid__cell-footer"> 5101 <div class="grid__cell"> 5102 <div class="u-pull--left mini-cart-orderline__price dw-mod"> 5103 {{#if pointsTotal}} 5104 <span class="u-color--loyalty-points">{{pointsTotal}}</span> @Translate("points") 5105 {{else}} 5106 {{totalprice}} 5107 {{/if}} 5108 </div> 5109 <button type="button" title="@Translate("Remove orderline")" class="btn btn--clean btn--condensed u-pull--right mini-cart-orderline__remove-btn dw-mod" onclick="{{removeFromCartGoogleImpression}}; Cart.UpdateCart('Cart', '/Default.aspx?ID=@cartOrderlinesFeedPageId', 'CartCmd=DelOrderLine&key={{orderLineId}}', true);">@Translate("Remove")</button> 5110 </div> 5111 </div> 5112 </div> 5113 </div> 5114 {{/unless}} 5115 </script> 5116 5117 <script id="MiniCartOrderlineDiscount" type="text/x-template"> 5118 {{#unless isEmpty}} 5119 <div class="mini-cart-orderline mini-cart-orderline--discount grid dw-mod"> 5120 <div class="grid__col-4"> 5121 <div class="mini-cart-orderline__name mini-cart-orderline__name dw-mod">{{name}}</div> 5122 </div> 5123 <div class="grid__col-8">{{totalprice}}</div> 5124 </div> 5125 {{/unless}} 5126 </script> 5127 } 5128 5129 @helper RenderMiniCartScriptTemplates() 5130 { 5131 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMiniCartTemplates").OrderBy(item => item.SortId).ToList(); 5132 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5133 string cartPageLink = string.Concat("/Default.aspx?ID=", GetPageIdByNavigationTag("CartPage")); 5134 5135 <script id="MiniCartContent" type="text/x-template"> 5136 {{#.}} 5137 {{#unless isEmpty}} 5138 @if (useGoogleTagManager) 5139 { 5140 <text>{{{googleEnchantImpressionEmptyCart OrderLines}}}</text> 5141 } 5142 @RenderBlockList(subBlocks) 5143 {{/unless}} 5144 {{#if isEmpty}} 5145 {{{locationReload '@cartPageLink'}}} 5146 {{/if}} 5147 {{/.}} 5148 </script> 5149 } 5150 5151 @helper RenderMiniCartOrderLinesTable() 5152 { 5153 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5154 5155 <div class="u-overflow-auto"> 5156 <table class="table mini-cart-table dw-mod"> 5157 @RenderBlockList(subBlocks) 5158 </table> 5159 </div> 5160 } 5161 5162 @helper RenderMiniCartOrderLinesBlocks() 5163 { 5164 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartOrderLines").OrderBy(item => item.SortId).ToList(); 5165 5166 <div class="u-overflow-auto"> 5167 @RenderBlockList(subBlocks) 5168 </div> 5169 } 5170 5171 @helper RenderMiniCartOrderLinesHeader() 5172 { 5173 <thead> 5174 <tr> 5175 <td>&nbsp;</td> 5176 <td>@Translate("Product")</td> 5177 <td class="u-ta-right">@Translate("Qty")</td> 5178 <td class="u-ta-right" width="120">@Translate("Price")</td> 5179 </tr> 5180 </thead> 5181 } 5182 5183 @helper RenderMiniCartOrderLinesList() 5184 { 5185 <text> 5186 {{#OrderLines}} 5187 {{#ifCond template "===" "CartOrderline"}} 5188 {{>MiniCartOrderline}} 5189 {{/ifCond}} 5190 {{#ifCond template "===" "CartOrderlineMobile"}} 5191 {{>MiniCartOrderline}} 5192 {{/ifCond}} 5193 {{#ifCond template "===" "CartOrderlineDiscount"}} 5194 {{>MiniCartOrderlineDiscount}} 5195 {{/ifCond}} 5196 {{/OrderLines}} 5197 </text> 5198 } 5199 5200 @helper RenderMiniCartFees() 5201 { 5202 <div class="grid u-border-top grid--external-bleed-bottom"> 5203 <div class="grid__col-6"> 5204 {{paymentmethod}} 5205 </div> 5206 <div class="grid__col-6 grid--align-end">{{paymentfee}}</div> 5207 </div> 5208 <div class="grid grid--external-bleed-bottom"> 5209 <div class="grid__col-6"> 5210 {{shippingmethod}} 5211 </div> 5212 <div class="grid__col-6 grid--align-end">{{shippingfee}}</div> 5213 </div> 5214 } 5215 5216 @helper RenderMiniCartFooter() 5217 { 5218 List<Block> subBlocks = this.masterPage.GetBlockListById("MiniCartFooter").OrderBy(item => item.SortId).ToList(); 5219 5220 <div class="mini-cart__footer dw-mod"> 5221 @RenderBlockList(subBlocks) 5222 </div> 5223 } 5224 5225 @helper RenderMiniCartActions() 5226 { 5227 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5228 5229 <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> 5230 <a href="/Default.aspx?ID=@cartPageId" title="@Translate("Proceed to checkout")" class="btn btn--primary u-full-width u-no-margin dw-mod">@Translate("Proceed to checkout")</a> 5231 } 5232 5233 @helper RenderMiniCartPoints() 5234 { 5235 <text> 5236 {{#if earnings}} 5237 <div class="grid grid--external-bleed-bottom"> 5238 <div class="grid__col-6">@Translate("Earnings")</div> 5239 <div class="grid__col-6 grid--align-end"> 5240 <div> 5241 <span class="u-color--loyalty-points">{{earnings}}</span> @Translate("points") 5242 </div> 5243 </div> 5244 </div> 5245 {{/if}} 5246 </text> 5247 } 5248 5249 @helper RenderMiniCartTotal() 5250 { 5251 <div class="mini-cart-totals grid u-margin-bottom dw-mod"> 5252 <div class="grid__col-6">@Translate("Total")</div> 5253 <div class="grid__col-6 grid--align-end">{{totalprice}}</div> 5254 </div> 5255 } 5256 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5257 5258 @using Dynamicweb.Rapido.Blocks.Extensibility 5259 @using Dynamicweb.Rapido.Blocks 5260 5261 @{ 5262 bool addToCartNotificationOnlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5263 string addToCartNotificationType = Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType") != null ? Model.Area.Item.GetItem("Ecommerce").GetItem("MiniCart").GetList("AddToCartNotificationType").SelectedValue : ""; 5264 5265 if (!addToCartNotificationOnlyPreview && !string.IsNullOrEmpty(addToCartNotificationType)) { 5266 if (addToCartNotificationType == "modal") 5267 { 5268 Block addToCartNotificationModal = new Block 5269 { 5270 Id = "AddToCartNotificationModal", 5271 Template = RenderAddToCartNotificationModal() 5272 }; 5273 5274 Block addToCartNotificationScript = new Block 5275 { 5276 Id = "AddToCartNotificationScript", 5277 Template = RenderAddToCartNotificationModalScript() 5278 }; 5279 BlocksPage.GetBlockPage("Master").Add("MasterTopSnippets", addToCartNotificationModal); 5280 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5281 } 5282 else if (addToCartNotificationType == "toggle") 5283 { 5284 Block addToCartNotificationScript = new Block 5285 { 5286 Id = "AddToCartNotificationScript", 5287 Template = RenderAddToCartNotificationToggleScript() 5288 }; 5289 BlocksPage.GetBlockPage("Master").Add("MasterBottomSnippets", addToCartNotificationScript); 5290 } 5291 } 5292 } 5293 5294 @helper RenderAddToCartNotificationModal() 5295 { 5296 <div id="LastAddedProductModal" data-template="LastAddedProductTemplate"></div> 5297 } 5298 5299 @helper RenderAddToCartNotificationModalScript() 5300 { 5301 int cartPageId = GetPageIdByNavigationTag("CartPage"); 5302 5303 <script id="LastAddedProductTemplate" type="text/x-template"> 5304 <!-- Trigger for the login modal --> 5305 <input type="checkbox" id="LastAddedProductModalTrigger" class="modal-trigger" /> 5306 5307 <!-- Login modal --> 5308 <div class="modal-container"> 5309 <label for="LastAddedProductModalTrigger" class="modal-overlay"></label> 5310 <div class="modal modal--md"> 5311 <div class="modal__header"> 5312 <h2>@Translate("Product is added to the cart")</h2> 5313 </div> 5314 <div class="modal__body"> 5315 <div class="grid"> 5316 <div class="grid__col-2"> 5317 <a href="{{productInfo.link}}"> 5318 <img src="{{productInfo.image}}" alt="{{productInfo.name}}" class="dw-mod" /> 5319 </a> 5320 </div> 5321 <div class="u-padding grid--align-self-center"> 5322 <span>{{quantity}}</span> x 5323 </div> 5324 <div class="grid__col-auto grid--align-self-center"> 5325 <div>{{productInfo.name}}</div> 5326 {{#if productInfo.variantName}} 5327 <small class="u-margin-bottom-5px">{{productInfo.variantName}}</small> 5328 {{/if}} 5329 {{#if productInfo.unitName}} 5330 <small class="u-margin-bottom-5px">{{productInfo.unitName}}</small> 5331 {{/if}} 5332 </div> 5333 </div> 5334 <div class="modal__footer u-margin-top--lg"> 5335 <label class="btn btn--secondary u-pull--left u-no-margin dw-mod btn--sm" for="LastAddedProductModalTrigger">@Translate("Continue shopping")</label> 5336 <a href="/Default.aspx?ID=@cartPageId" class="btn btn--primary u-pull--right u-no-margin dw-mod btn--sm">@Translate("Proceed to checkout")</a> 5337 </div> 5338 </div> 5339 <label class="modal__close-btn" for="LastAddedProductModalTrigger"></label> 5340 </div> 5341 </div> 5342 </script> 5343 <script> 5344 document.addEventListener('addToCart', function (event) { 5345 Cart.ShowLastAddedProductModal(event.detail); 5346 }); 5347 </script> 5348 } 5349 5350 @helper RenderAddToCartNotificationToggleScript() 5351 { 5352 int miniCartFeedPageId = GetPageIdByNavigationTag("MiniCartFeed"); 5353 5354 <script> 5355 document.addEventListener('addToCart', function () { 5356 Cart.ToggleMiniCart('miniCartTrigger', 'miniCart', 'cartCounter', '@miniCartFeedPageId'); 5357 }); 5358 </script> 5359 } 5360 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5361 5362 @using System 5363 @using System.Web 5364 @using System.Collections.Generic 5365 @using Dynamicweb.Rapido.Blocks.Extensibility 5366 @using Dynamicweb.Rapido.Blocks 5367 5368 @functions { 5369 BlocksPage footerBlocksPage = BlocksPage.GetBlockPage("Master"); 5370 } 5371 5372 @{ 5373 string footerColumnOneContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Content"); 5374 string footerColumnTwoContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Content"); 5375 string footerColumnThreeContent = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Content"); 5376 string footerColumnOneHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnOne").GetString("Header"); 5377 string footerColumnTwoHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnTwo").GetString("Header"); 5378 string footerColumnThreeHeader = Model.Area.Item.GetItem("Layout").GetItem("FooterColumnThree").GetString("Header"); 5379 5380 Block masterFooterContent = new Block() 5381 { 5382 Id = "MasterFooterContent", 5383 SortId = 10, 5384 Template = RenderFooter(), 5385 SkipRenderBlocksList = true 5386 }; 5387 footerBlocksPage.Add(MasterBlockId.MasterFooter, masterFooterContent); 5388 5389 if (!string.IsNullOrEmpty(footerColumnOneContent) || !string.IsNullOrEmpty(footerColumnOneHeader)) 5390 { 5391 Block masterFooterColumnOne = new Block 5392 { 5393 Id = "MasterFooterColumnOne", 5394 SortId = 10, 5395 Template = RenderFooterColumn(footerColumnOneHeader, footerColumnOneContent), 5396 Design = new Design { 5397 CssClass = "grid__col-md-12" 5398 } 5399 }; 5400 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnOne); 5401 } 5402 5403 if (!string.IsNullOrEmpty(footerColumnTwoContent) || !string.IsNullOrEmpty(footerColumnTwoHeader)) 5404 { 5405 Block masterFooterColumnTwo = new Block 5406 { 5407 Id = "MasterFooterColumnTwo", 5408 SortId = 20, 5409 Template = RenderFooterColumn(footerColumnTwoHeader, footerColumnTwoContent), 5410 Design = new Design 5411 { 5412 Size = "auto", 5413 RenderType = RenderType.Column 5414 } 5415 }; 5416 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnTwo); 5417 } 5418 5419 if (!string.IsNullOrEmpty(footerColumnThreeContent) || !string.IsNullOrEmpty(footerColumnThreeHeader)) 5420 { 5421 Block masterFooterColumnThree = new Block 5422 { 5423 Id = "MasterFooterColumnThree", 5424 SortId = 30, 5425 Template = RenderFooterColumn(footerColumnThreeHeader, footerColumnThreeContent), 5426 Design = new Design 5427 { 5428 //Size = "auto", 5429 //RenderType = RenderType.Column 5430 } 5431 }; 5432 footerBlocksPage.Add("MasterFooterContent", masterFooterColumnThree); 5433 } 5434 5435 if (Model.Area.Item.GetItem("Layout").GetBoolean("FooterNewsletterSignUp")) 5436 { 5437 Block masterFooterNewsletterSignUp = new Block 5438 { 5439 Id = "MasterFooterNewsletterSignUp", 5440 SortId = 40, 5441 Template = RenderFooterNewsletterSignUp(), 5442 Design = new Design 5443 { 5444 //Size = "auto", 5445 //RenderType = RenderType.Column 5446 } 5447 }; 5448 footerBlocksPage.Add("MasterFooterContent", masterFooterNewsletterSignUp); 5449 } 5450 5451 if (Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks").Count > 0) 5452 { 5453 Block masterFooterSocialLinks = new Block 5454 { 5455 Id = "MasterFooterSocialLinks", 5456 SortId = 70, 5457 Template = RenderFooterSocialLinks(), 5458 Design = new Design 5459 { 5460 CssClass = "grid__col-md-3" 5461 } 5462 }; 5463 footerBlocksPage.Add("MasterFooterContent", masterFooterSocialLinks); 5464 } 5465 5466 if (Model.Area.Item.GetItem("Layout").GetItems("FooterPayments") != null && Model.Area.Item.GetItem("Layout").GetItems("FooterPayments").Count > 0) 5467 { 5468 Block masterFooterPayments = new Block 5469 { 5470 Id = "MasterFooterPayments", 5471 SortId = 50, 5472 Template = RenderFooterPayments(), 5473 Design = new Design 5474 { 5475 CssClass = "grid__col-md-3" 5476 } 5477 }; 5478 footerBlocksPage.Add("MasterFooterContent", masterFooterPayments); 5479 } 5480 5481 Block masterFooterCopyright = new Block 5482 { 5483 Id = "MasterFooterCopyright", 5484 SortId = 60, 5485 Template = RenderFooterCopyright(), 5486 Design = new Design 5487 { 5488 CssClass = "grid__col-md-6" 5489 } 5490 }; 5491 footerBlocksPage.Add("MasterFooterContent", masterFooterCopyright); 5492 } 5493 5494 @helper RenderFooter() { 5495 List<Block> subBlocks = this.footerBlocksPage.GetBlockListById("MasterFooterContent").OrderBy(item => item.SortId).ToList(); 5496 5497 <footer class="footer dw-mod"> 5498 <div class="center-container top-container__center-container dw-mod"> 5499 <div class="grid grid--external-bleed-x"> 5500 @RenderBlockList(subBlocks) 5501 </div> 5502 </div> 5503 </footer> 5504 } 5505 5506 @helper RenderFooterColumn(string header, string content) { 5507 <h3 class="footer__heading dw-mod">@header</h3> 5508 <div class="footer__content dw-mod"> 5509 @content 5510 </div> 5511 } 5512 5513 @helper RenderFooterNewsletterSignUp() { 5514 string newsletterSignUpPageId = GetPageIdByNavigationTag("NewsletterSignUp").ToString(); 5515 5516 <h3 class="footer__heading dw-mod">@Translate("Mailing list")</h3> 5517 <div class="footer__content dw-mod"> 5518 <form class="form dw-mod" name="NewsletterRedirect" action='/Default.aspx' method="get" enctype="multipart/form-data"> 5519 <input name="ID" value="@newsletterSignUpPageId" type="hidden" /> 5520 <label for="NewsletterEmail" class="u-margin-bottom">@Translate("Sign up if you would like to receive occasional treats from us", "Sign up if you would like to receive occasional treats from us")</label> 5521 <div class="form__field-combi"> 5522 <input name="NewsletterEmail" id="NewsletterEmail" type="text" placeholder='@Translate("Your email address", "Your email address")' class="u-full-width use-btn-primary-height" /> 5523 <input class="btn btn--primary btn--condensed dw-mod" type="submit" id="Submitter" value='@Translate("Go", "Go")' /> 5524 </div> 5525 </form> 5526 </div> 5527 } 5528 5529 @helper RenderFooterSocialLinks() { 5530 @*<h3 class="footer__heading dw-mod">@Translate("Social links")</h3>*@ 5531 <div class="footer__content dw-mod"> 5532 <div class="grid collection dw-mod social-links"> 5533 @foreach (var socialitem in Model.Area.Item.GetItem("Layout").GetItems("FooterSocialLinks")) 5534 { 5535 var socialIcon = socialitem.GetValue("Icon") as Dynamicweb.Frontend.ListViewModel; 5536 string socialIconClass = socialIcon.SelectedValue; 5537 string socialIconTitle = socialIcon.SelectedName; 5538 string socialLink = socialitem.GetString("Link"); 5539 5540 <a href="@socialLink" target="_blank" title="@socialIconTitle" class="u-margin-bottom-5px" rel="noopener"><i class="@socialIconClass fa-3x"></i></a> 5541 } 5542 </div> 5543 </div> 5544 } 5545 5546 @helper RenderFooterPayments() { 5547 <div class="footer__content dw-mod"> 5548 <div class="collection dw-mod"> 5549 @foreach (var payment in Model.Area.Item.GetItem("Layout").GetItems("FooterPayments")) 5550 { 5551 var paymentItem = payment.GetValue("CardTypeOrVerifiedPayment") as Dynamicweb.Frontend.ListViewModel; 5552 string paymentImage = null; 5553 string paymentTitle = paymentItem.SelectedName; 5554 ListOptionViewModel selected = paymentItem.SelectedOptions.FirstOrDefault(); 5555 if (selected != null) 5556 { 5557 paymentImage = selected.Icon; 5558 } 5559 5560 <div class="footer__card-type"> 5561 <img class="b-lazy" src="/Files/Images/placeholder.gif" data-src="/Admin/Public/GetImage.ashx?width=80&Compression=75&image=@paymentImage" alt="@paymentTitle" title="@paymentTitle" /> 5562 </div> 5563 } 5564 </div> 5565 </div> 5566 } 5567 5568 @helper RenderFooterCopyright() { 5569 <div class="footer__copyright dw-mod"> 5570 <p>@Model.Area.Item.GetItem("Layout").GetString("FooterCopyrightText")</p> 5571 </div> 5572 } 5573 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5574 5575 @using System 5576 @using System.Web 5577 @using System.Collections.Generic 5578 @using Dynamicweb.Rapido.Blocks.Extensibility 5579 @using Dynamicweb.Rapido.Blocks 5580 @using Dynamicweb.Ecommerce.Common 5581 5582 @{ 5583 BlocksPage referencesBlocksPage = BlocksPage.GetBlockPage("Master"); 5584 5585 Block masterScriptReferences = new Block() 5586 { 5587 Id = "MasterScriptReferences", 5588 SortId = 1, 5589 Template = RenderMasterScriptReferences() 5590 }; 5591 referencesBlocksPage.Add(MasterBlockId.MasterReferences, masterScriptReferences); 5592 } 5593 5594 @helper RenderMasterScriptReferences() { 5595 <script src="/Files/Templates/Designs/Rapido/js/axios.min.js"></script> 5596 <script src="/Files/Templates/Designs/Rapido/js/noty.min.js"></script> 5597 <script src="/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"></script> 5598 <script src="/Files/Templates/Designs/Rapido/js/master.min.js"></script> 5599 5600 5601 if (Model.Area.Item.GetItem("Custom").GetBoolean("UseCustomJavascript")) 5602 { 5603 <script src="/Files/Templates/Designs/Rapido/js/custom.min.js"></script> 5604 PushPromise("/Files/Templates/Designs/Rapido/js/custom.min.js"); 5605 <script src="/Files/Templates/Designs/Rapido/js/cartV2.js"></script> 5606 PushPromise("/Files/Templates/Designs/Rapido/js/cartV2.js"); 5607 } 5608 5609 PushPromise("/Files/Templates/Designs/Rapido/js/axios.min.js"); 5610 PushPromise("/Files/Templates/Designs/Rapido/js/noty.min.js"); 5611 PushPromise("/Files/Templates/Designs/Rapido/js/handlebars-v4.0.12.min.js"); 5612 PushPromise("/Files/Templates/Designs/Rapido/js/master.min.js"); 5613 } 5614 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 5615 5616 @using System 5617 @using System.Web 5618 @using System.Collections.Generic 5619 @using Dynamicweb.Rapido.Blocks.Extensibility 5620 @using Dynamicweb.Rapido.Blocks 5621 5622 @{ 5623 BlocksPage searchBlocksPage = BlocksPage.GetBlockPage("Master"); 5624 bool navigationItemsHideSearch = Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("HideSearch"); 5625 5626 if (!navigationItemsHideSearch) 5627 { 5628 Block masterSearchScriptTemplates = new Block() 5629 { 5630 Id = "MasterSearchScriptTemplates", 5631 SortId = 1, 5632 Template = RenderSearchScriptTemplates() 5633 }; 5634 5635 searchBlocksPage.Add(MasterBlockId.MasterBottomSnippets, masterSearchScriptTemplates); 5636 } 5637 } 5638 5639 @helper RenderSearchScriptTemplates() 5640 { 5641 int productsPageId = GetPageIdByNavigationTag("ProductsPage"); 5642 string contentSearchPageLink = GetPageIdByNavigationTag("ContentSearchResults") + "&Areaid=" + Model.Area.ID; 5643 bool useFacebookPixel = !string.IsNullOrWhiteSpace(Pageview.AreaSettings.GetItem("Settings").GetString("FacebookPixelID")); 5644 bool onlyPreview = Model.Area.Item.GetItem("Ecommerce").GetBoolean("OnlyPreviewForAnonymous") && Model.CurrentUser.ID == 0; 5645 bool useGoogleTagManager = !string.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("GoogleTagManagerID")); 5646 bool showPrice = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HidePriceInSearchResults"); 5647 bool showAddToCartButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideAddToCartButton"); 5648 bool showViewButton = !Pageview.AreaSettings.GetItem("Layout").GetBoolean("HideViewButton"); 5649 bool showAddToDownloadButton = Pageview.AreaSettings.GetItem("Layout").GetBoolean("ShowAddToDownloadButton"); 5650 bool pointShopOnly = Pageview.AreaSettings.GetItem("Ecommerce").GetBoolean("PointShopOnly"); 5651 5652 <script id="SearchGroupsTemplate" type="text/x-template"> 5653 {{#.}} 5654 <li class="dropdown__item dw-mod" onclick="Search.UpdateGroupSelection(this)" data-group-id="{{id}}">{{name}}</li> 5655 {{/.}} 5656 </script> 5657 5658 <script id="SearchProductsTemplate" type="text/x-template"> 5659 {{#each .}} 5660 {{#Product}} 5661 {{#ifCond template "!==" "SearchMore"}} 5662 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5663 @if (useFacebookPixel) 5664 { 5665 <text>{{{facebookPixelSearch name number priceDouble currency searchParameter}}}</text> 5666 } 5667 @if (useGoogleTagManager) 5668 { 5669 <text>{{{googleEnchantImpression 'Search results' currency googleImpression}}}</text> 5670 } 5671 <div> 5672 <a href="{{link}}" class="js-typeahead-link u-color-inherit u-pull--left" onclick="{{googleImpressionClick}}" title="{{name}}"> 5673 <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}}"></div> 5674 <div class="u-pull--left"> 5675 <div class="u-bold u-max-w220px u-truncate-text js-typeahead-name">{{name}}</div> 5676 @if (showPrice && !onlyPreview) 5677 { 5678 if (pointShopOnly) 5679 { 5680 <text> 5681 {{#if havePointPrice}} 5682 <div> 5683 <span class="u-color--loyalty-points">{{points}}</span> @Translate("points") 5684 </div> 5685 {{else}} 5686 <small class="help-text u-no-margin">@Translate("Not available")</small> 5687 {{/if}} 5688 {{#unless canBePurchasedWithPoints}} 5689 {{#if havePointPrice}} 5690 <small class="help-text u-no-margin">@Translate("Not enough points to buy this")</small> 5691 {{/if}} 5692 {{/unless}} 5693 </text> 5694 } 5695 else 5696 { 5697 <div>{{price}}</div> 5698 } 5699 } 5700 </div> 5701 </a> 5702 <div class="u-margin-left u-pull--right"> 5703 @if (showAddToCartButton && !onlyPreview) { 5704 if (pointShopOnly) 5705 { 5706 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside {{#unless canBePurchasedWithPoints}}js-stay-disabled{{/unless}}" name="CartCmd" value="addWithPoints" 5707 onclick="Cart.AddToCart(event, { 5708 id: '{{productId}}', 5709 quantity: 1, 5710 buyForPoints: true, 5711 productInfo: {{productInfo}} 5712 }); {{facebookPixelAction}}" {{disabledBuyButton}}> 5713 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5714 </button> 5715 } else { 5716 <button type="button" class="btn btn--primary btn--condensed btn--full u-no-margin dw-mod {{hideBuyOptions}} js-ignore-click-outside" 5717 onclick="Cart.AddToCart(event, { 5718 id: '{{productId}}', 5719 quantity: 1, 5720 productInfo: {{productInfo}} 5721 }); {{facebookPixelAction}}"> 5722 <i class="@Pageview.AreaSettings.GetItem("Layout").GetItem("Icons").GetList("CartIcon").SelectedValue js-ignore-click-outside"></i> 5723 </button> 5724 } 5725 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod {{hideViewMore}} js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5726 } 5727 else if (showViewButton) 5728 { 5729 <a href="{{link}}" onclick="{{googleImpressionClick}}" class="btn btn--secondary btn--condensed btn--full u-no-margin dw-mod js-ignore-click-outside" title="@Translate("View")">@Translate("View")</a> 5730 } 5731 @if (showAddToDownloadButton) 5732 { 5733 <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}}"> 5734 <i class="fas fa-plus js-button-icon"></i> 5735 </button> 5736 } 5737 </div> 5738 </div> 5739 </li> 5740 {{/ifCond}} 5741 {{#ifCond template "===" "SearchMore"}} 5742 {{>SearchMoreProducts}} 5743 {{/ifCond}} 5744 {{/Product}} 5745 {{else}} 5746 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5747 @Translate("Your search gave 0 results") 5748 </li> 5749 {{/each}} 5750 </script> 5751 5752 <script id="SearchMoreProducts" type="text/x-template"> 5753 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5754 <a href="/Default.aspx?ID=@productsPageId&Search={{searchParameter}}&GroupID={{groupId}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5755 @Translate("View all") 5756 </a> 5757 </li> 5758 </script> 5759 5760 <script id="SearchMorePages" type="text/x-template"> 5761 <li class="dropdown__item dropdown__item--not-selectable {{stickToBottom}} dw-mod"> 5762 <a href="/Default.aspx?ID=@contentSearchPageLink&Search={{searchParameter}}" class="btn btn--primary btn--full u-no-margin dw-mod js-typeahead-link"> 5763 @Translate("View all") 5764 </a> 5765 </li> 5766 </script> 5767 5768 <script id="SearchPagesTemplate" type="text/x-template"> 5769 {{#each .}} 5770 {{#ifCond template "!==" "SearchMore"}} 5771 <li class="dropdown__item dropdown__item--seperator dw-mod"> 5772 <div> 5773 <a href="/Default.aspx?ID={{id}}" class="js-typeahead-link u-pull--left u-color-inherit"> 5774 <div class="u-margin-right u-pull--left"><i class="fa {{icon}} u-w20px u-ta-center"></i></div> 5775 <div class="u-pull--left"> 5776 <div class="u-bold u-truncate-text u-max-w220px js-typeahead-name">{{name}}</div> 5777 </div> 5778 </a> 5779 </div> 5780 </li> 5781 {{/ifCond}} 5782 {{#ifCond template "===" "SearchMore"}} 5783 {{>SearchMorePages}} 5784 {{/ifCond}} 5785 {{else}} 5786 <li class="dropdown__item dropdown__item--seperator dropdown__item--not-selectable dw-mod"> 5787 @Translate("Your search gave 0 results") 5788 </li> 5789 {{/each}} 5790 </script> 5791 5792 <script id="SearchPagesTemplateWrap" type="text/x-template"> 5793 <div class="dropdown__column-header">@Translate("Pages")</div> 5794 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5795 {{>SearchPagesTemplate}} 5796 </ul> 5797 </script> 5798 5799 <script id="SearchProductsTemplateWrap" type="text/x-template"> 5800 <div class="dropdown__column-header">@Translate("Products")</div> 5801 <ul class="dropdown__list u-min-w220px u-full-width u-margin-bottom dw-mod"> 5802 {{>SearchProductsTemplate}} 5803 </ul> 5804 </script> 5805 } 5806 5807 5808 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5809 5810 @using System 5811 @using System.Web 5812 @using System.Collections.Generic 5813 @using Dynamicweb.Rapido.Blocks.Extensibility 5814 @using Dynamicweb.Rapido.Blocks 5815 5816 @{ 5817 BlocksPage bottomSnippetsBlocksPage = BlocksPage.GetBlockPage("Master"); 5818 5819 Block primaryBottomSnippets = new Block() 5820 { 5821 Id = "MasterJavascriptInitializers", 5822 SortId = 100, 5823 Template = RenderPrimaryBottomSnippets() 5824 }; 5825 bottomSnippetsBlocksPage.Add(MasterBlockId.MasterReferences, primaryBottomSnippets); 5826 } 5827 5828 @helper RenderPrimaryBottomSnippets() { 5829 bool isWireframeMode = Model.Area.Item.GetItem("Settings").GetBoolean("WireframeMode"); 5830 bool useGoogleTagManager = !string.IsNullOrEmpty(Pageview.AreaSettings.GetItem("Settings").GetString("GoogleTagManagerID")); 5831 5832 if (isWireframeMode) 5833 { 5834 <script> 5835 Wireframe.Init(true); 5836 </script> 5837 } 5838 5839 5840 if (useGoogleTagManager) 5841 { 5842 <script> 5843 document.addEventListener('addToCart', function(event) { 5844 var googleImpression = event.detail.productInfo.googleImpression; 5845 dataLayer.push({ 5846 'event': 'addToCart', 5847 'ecommerce': { 5848 'currencyCode': '@Dynamicweb.Ecommerce.Services.Currencies.GetDefaultCurrency().Code', 5849 'add': { 5850 'products': [{ 5851 'name': googleImpression.name, 5852 'id': googleImpression.id, 5853 'price': googleImpression.price, 5854 'brand': googleImpression.brand, 5855 'category': googleImpression.category, 5856 'variant': googleImpression.variant, 5857 'quantity': event.detail.quantity 5858 }] 5859 } 5860 } 5861 }); 5862 }); 5863 </script> 5864 } 5865 5866 //if digitalwarehouse 5867 if (Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("ShowDownloadCart")) 5868 { 5869 string cartContextId = Converter.ToString(HttpContext.Current.Application["DownloadCartContext"]); 5870 5871 if (string.IsNullOrEmpty(cartContextId)) { 5872 var moduleProps = Dynamicweb.Modules.Properties.GetParagraphModuleSettings(GetPageIdByNavigationTag("DownloadCart"), "eCom_CartV2"); 5873 var cartSettings = new Dynamicweb.Ecommerce.Cart.ModuleSettings(moduleProps); 5874 cartContextId = cartSettings.OrderContextID; 5875 HttpContext.Current.Application["DownloadCartContext"] = cartContextId; 5876 } 5877 5878 <script> 5879 let downloadCart = new DownloadCart({ 5880 cartPageId: @GetPageIdByNavigationTag("MiniCartFeed"), 5881 contextId: "@cartContextId", 5882 addButtonText: "@Translate("Add")", 5883 removeButtonText: "@Translate("Remove")" 5884 }); 5885 </script> 5886 } 5887 5888 <!--@Javascripts--> 5889 } 5890 @if (File.Exists(HttpContext.Current.Server.MapPath("/MasterBlocks/Custom__Blocks.cshtml"))) 5891 { 5892 <text>@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 5893 5894 @using System 5895 @using System.Web 5896 @using System.Collections.Generic 5897 @using Dynamicweb.Rapido.Blocks 5898 5899 @{ 5900 BlocksPage masterCustomBlocksPage = BlocksPage.GetBlockPage("Master"); 5901 5902 }</text> 5903 } 5904 5905 5906 @functions { 5907 public class ManifestIcon 5908 { 5909 public string src { get; set; } 5910 public string type { get; set; } 5911 public string sizes { get; set; } 5912 } 5913 5914 public class Manifest 5915 { 5916 public string name { get; set; } 5917 public string short_name { get; set; } 5918 public string start_url { get; set; } 5919 public string display { get; set; } 5920 public string background_color { get; set; } 5921 public string theme_color { get; set; } 5922 public List<ManifestIcon> icons { get; set; } 5923 } 5924 } 5925 @{ 5926 if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName")) && Model.Area.Item.GetItem("Settings").GetFile("AppIcon") != null) { 5927 Manifest manifest = new Manifest 5928 { 5929 name = Model.Area.Item.GetItem("Settings").GetString("AppName"), 5930 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"), 5931 start_url = "/", 5932 display = "standalone", 5933 background_color = Model.Area.Item.GetItem("Settings").GetString("AppBackgroundColor"), 5934 theme_color = Model.Area.Item.GetItem("Settings").GetString("AppThemeColor") 5935 }; 5936 5937 manifest.icons = new List<ManifestIcon> { 5938 new ManifestIcon { 5939 src = "/Admin/Public/GetImage.ashx?width=192&height=192&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 5940 sizes = "192x192", 5941 type = "image/png" 5942 }, 5943 new ManifestIcon { 5944 src = "/Admin/Public/GetImage.ashx?width=512&height=512&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 5945 sizes = "512x512", 5946 type = "image/png" 5947 }, 5948 new ManifestIcon { 5949 src = "/Admin/Public/GetImage.ashx?width=1024&height=1024&crop=5&image=" + Model.Area.Item.GetItem("Settings").GetFile("AppIcon").PathUrlEncoded, 5950 sizes = "1024x1024", 5951 type = "image/png" 5952 } 5953 }; 5954 5955 string manifestFilePath = HttpContext.Current.Request.MapPath("/Files/Templates/Designs/Rapido/manifest.json"); 5956 string manifestJSON = Newtonsoft.Json.JsonConvert.SerializeObject(manifest); 5957 string currentManifest = File.ReadAllText(manifestFilePath); 5958 5959 if (manifestJSON != currentManifest) 5960 { 5961 File.WriteAllText(manifestFilePath, manifestJSON); 5962 } 5963 } 5964 } 5965 5966 @{ 5967 var swatches = new Dynamicweb.Content.Items.ColorSwatchService(); 5968 var brandColors = swatches.GetColorSwatch(1); 5969 string brandColorOne = brandColors.Palette["BrandColor1"]; 5970 } 5971 5972 <!DOCTYPE html> 5973 5974 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName"> 5975 <head> 5976 <!-- Rapido version 3.1 --> 5977 <meta charset="utf-8" /> 5978 <title>@Model.Title</title> 5979 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 5980 <meta name="robots" content="index, follow"> 5981 <meta name="theme-color" content="@brandColorOne" /> 5982 5983 @Model.MetaTags 5984 5985 <!-- Favicon --> 5986 <link href="@favicon" rel="icon" type="image/png"> 5987 5988 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/noty.min.css" type="text/css"> 5989 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.css"> 5990 5991 <!-- Base (Default, wireframe) styles --> 5992 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/base/base.min.css" type="text/css"> 5993 5994 <!-- Rapido Css from Website Settings --> 5995 <link rel="stylesheet" id="rapidoCss" href="@autoCssLink" type="text/css"> 5996 @{ 5997 //Ignite Css (Custom site specific styles) 5998 const string folderName = "ignite"; 5999 var minify = true; 6000 var variablesFile = "/Files/Templates/Designs/Rapido/css/rapido/_variables_" + Model.Area.ID + ".auto.less"; 6001 var igniteBundle = Dna.Optimizer.Renderer.RenderStyles($"/Files/Templates/Designs/Rapido/css/{folderName}", $"-{folderName}-styles", new [] {variablesFile}, new[] { $"{folderName}.css", $"{folderName}.min.css" }, minify, false, false); 6002 <link id="igniteCss" type="text/css" rel="stylesheet" href="@igniteBundle" /> 6003 } 6004 6005 6006 <!-- Font awesome --> 6007 <link rel="stylesheet" href="@fontAwesomeCssLink" type="text/css"> 6008 6009 <!-- Flag icon --> 6010 <link rel="stylesheet" href="/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css" type="text/css"> 6011 6012 <!-- Select 2 Plugin --> 6013 <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/css/select2.min.css" rel="stylesheet" /> 6014 6015 <!-- Google fonts --> 6016 @{ 6017 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))); 6018 } 6019 <link href="https://fonts.googleapis.com/css?family=@family" rel="stylesheet"> 6020 @{ 6021 PushPromise(favicon); 6022 PushPromise(fontAwesomeCssLink); 6023 PushPromise("/Files/Templates/Designs/Rapido/css/base/base.min.css"); 6024 PushPromise(autoCssLink); 6025 PushPromise("/Files/Templates/Designs/Rapido/css/ignite/ignite.min.css"); 6026 PushPromise("/Files/Images/placeholder.gif"); 6027 PushPromise("/Files/Templates/Designs/Rapido/css/fonts/flag-icon.min.css"); 6028 } 6029 6030 @if (!String.IsNullOrEmpty(Model.Area.Item.GetItem("Settings").GetString("AppName"))) 6031 { 6032 <link rel="manifest" href="/Files/Templates/Designs/Rapido/manifest.json"> 6033 PushPromise("/Files/Templates/Designs/Rapido/manifest.json"); 6034 } 6035 @RenderSnippet("owlCss") 6036 @RenderSnippet("jquery") 6037 <!-- Global site tag (gtag.js) - Google Analytics --> 6038 <script async src="https://www.googletagmanager.com/gtag/js?id=UA-199521897-1"></script> 6039 <script> 6040 window.dataLayer = window.dataLayer || []; 6041 function gtag(){dataLayer.push(arguments);} 6042 //gtag('js', new Date()); 6043 //gtag('config', 'UA-199521897-1'); 6044 6045 // Set default consent to 'denied' as a placeholder 6046 // Determine actual values based on your own requirements 6047 gtag('consent', 'default', { 6048 'ad_storage': 'denied', 6049 'ad_user_data': 'denied', 6050 'ad_personalization': 'denied', 6051 'analytics_storage': 'denied', 6052 'functionality_storage': 'denied', 6053 'personalization_storage': 'denied', 6054 'security_storage': 'denied' 6055 }); 6056 </script> 6057 <!-- Google Tag Manager --> 6058 <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 6059 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 6060 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 6061 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 6062 })(window,document,'script','dataLayer','UA-199521897-1');</script> 6063 <!-- End Google Tag Manager --> 6064 6065 <!-- Create one update function for each consent parameter --> 6066 <script> 6067 function consentGranted() { 6068 gtag('consent', 'update', { 6069 'ad_storage': 'granted', 6070 'ad_user_data': 'granted', 6071 'ad_personalization': 'granted', 6072 'analytics_storage': 'granted', 6073 'functionality_storage': 'granted', 6074 'personalization_storage': 'granted', 6075 'security_storage': 'granted' 6076 }); 6077 } 6078 </script> 6079 <!-- Actualizarea consentului pe fiecare pagina daca cookie-ul exista --> 6080 @{ 6081 bool consentIsGranted = System.Web.HttpContext.Current.Request?.Cookies["Dynamicweb.CookieOptInLevel"]?.Value == "2"; 6082 } 6083 @if (consentIsGranted) 6084 { 6085 <script> 6086 consentGranted(); 6087 </script> 6088 } 6089 </head> 6090 6091 <body data-user-email="<!--@Global:Extranet.Email-->" data-user-phone="<!--@Global:Extranet.Phone-->"> 6092 6093 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6094 @RenderBlockList(masterPage.BlocksRoot.BlocksList) 6095 6096 6097 @helper RenderMasterHeader() 6098 { 6099 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterHeader").OrderBy(item => item.SortId).ToList(); 6100 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6101 string stickyTop = isNavigationStickyMenu ? "top-container--sticky" : ""; 6102 6103 <header class="top-container @stickyTop dw-mod" id="Top"> 6104 @RenderBlockList(subBlocks) 6105 </header> 6106 } 6107 6108 @helper RenderMain() 6109 { 6110 List<Block> subBlocks = this.masterPage.GetBlockListById("MasterMain").OrderBy(item => item.SortId).ToList(); 6111 6112 <main class="site dw-mod"> 6113 @RenderBlockList(subBlocks) 6114 </main> 6115 } 6116 6117 @helper RenderPageContent() 6118 { 6119 bool isNavigationStickyMenu = Pageview.Device.ToString() != "Mobile" && Pageview.Device.ToString() != "Tablet" && Model.Area.Item.GetItem("Layout").GetItem("Header").GetBoolean("StickyTop"); 6120 string pagePos = isNavigationStickyMenu ? "js-page-pos" : ""; 6121 6122 <div id="Page" class="page @pagePos"> 6123 <section class="center-container content-container dw-mod" id="content"> 6124 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel> 6125 6126 6127 @using Dynamicweb.Rapido.Blocks.Components 6128 @using Dynamicweb.Rapido.Blocks.Components.Articles 6129 @using Dynamicweb.Rapido.Blocks.Components.General 6130 @using Dynamicweb.Rapido.Blocks 6131 6132 @functions { 6133 BlocksPage articlePage = BlocksPage.GetBlockPage("NewsArticle"); 6134 } 6135 6136 @{ 6137 ArticleHeader topBanner = new ArticleHeader 6138 { 6139 Layout = ArticleHeaderLayout.Clean, 6140 Image = new Image { Path = Model.Item.GetFile("Image").PathUrlEncoded }, 6141 Heading = Model.Item.GetString("Title"), 6142 Subheading = Model.Item.GetString("Summary"), 6143 TextColor = "#fff", 6144 Category = Model.Item.GetString("Author"), 6145 Date = Model.Item.GetString("Date"), 6146 ButtonLayout = ButtonLayout.Primary, 6147 TextLayout = ArticleHeaderTextLayout.Full 6148 }; 6149 6150 Block articleContainer = new Block 6151 { 6152 Id = "ArticleContainer", 6153 SortId = 10, 6154 Design = new Design 6155 { 6156 RenderType = RenderType.Row 6157 }, 6158 BlocksList = new List<Block> { 6159 new Block { 6160 Id = "ArticleBody", 6161 SortId = 20, 6162 Design = new Design { 6163 RenderType = RenderType.Column, 6164 Size = "8" 6165 }, 6166 BlocksList = new List<Block> { 6167 new Block { 6168 Id = "ArticleBodyRow", 6169 SortId = 10, 6170 Design = new Design { 6171 RenderType = RenderType.Row 6172 }, 6173 BlocksList = new List<Block> { 6174 new Block { 6175 Id = "ArticleHeader", 6176 SortId = 10, 6177 Component = topBanner, 6178 Design = new Design { 6179 RenderType = RenderType.Column, 6180 Size = "12", 6181 HidePadding = true, 6182 CssClass = "article-head" 6183 } 6184 }, 6185 new Block { 6186 Id = "ArticleText", 6187 SortId = 20, 6188 Component = new ArticleText { Text = Model.Item.GetString("Text") }, 6189 Design = new Design { 6190 RenderType = RenderType.Column, 6191 Size = "12", 6192 CssClass = "u-padding--lg" 6193 } 6194 }, 6195 new Block { 6196 Id = "ArticleLink", 6197 SortId = 30, 6198 Component = new ArticleLink { Link = Model.Item.GetString("Link"), Title = Model.Item.GetString("LinkText"), ButtonLayout = ButtonLayout.Primary }, 6199 Design = new Design { 6200 RenderType = RenderType.Column, 6201 Size = "12", 6202 CssClass = "u-padding--lg u-ta-right" 6203 } 6204 } 6205 } 6206 } 6207 } 6208 } 6209 } 6210 }; 6211 articlePage.Add(articleContainer); 6212 6213 if (Model.PropertyItem.GetList("ShowBreadcrumb").SelectedValue == "True") 6214 { 6215 Block breadcrumb = new Block 6216 { 6217 Id = "ArticleBreadcrumb", 6218 SortId = 10, 6219 Component = new BreadcrumbNavigation { }, 6220 Design = new Design 6221 { 6222 RenderType = RenderType.Column, 6223 Size = "12" 6224 } 6225 }; 6226 articlePage.Add("ArticleContainer", breadcrumb); 6227 } 6228 } 6229 6230 @* The @RenderBlockList base helper is included in Components/GridBuilder.cshtml *@ 6231 @RenderBlockList(articlePage.BlocksRoot.BlocksList) 6232 6233 </section> 6234 </div> 6235 } 6236 <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> 6237 <script src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script> 6238 @RenderSnippet("owlJs") 6239 6240 @* <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script> *@ 6241 <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.8/js/select2.min.js"></script> 6242 <script src="./Files/Templates/Designs/Rapido/js/custom.js"></script> 6243 </body> 6244 </html> 6245 6246