Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.b__218_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8483
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.b__217_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8428
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_87ac08e6876c43a7bbe0043fb3ee4db3.Execute() in D:\dynamicweb.net\Solutions\Dynamicweb\norskstaal.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8418
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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