Error executing template "Designs/AgricoverCorporate/_parsed/ContentPage.parsed.cshtml"
System.IO.IOException: The process cannot access the file 'C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\manifest.json' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<RenderMasterMetadata>b__222_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9421
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 266
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 176
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<RenderMasterHead>b__221_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9376
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 266
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 176
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 299
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 176
   at CompiledRazorTemplates.Dynamic.RazorEngine_08fe199cb65c4a4698dd61466c45f9fe.Execute() in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\ContentPage.parsed.cshtml:line 9263
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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