Error executing template "Designs/AgricoverCorporate/_parsed/DynamicArticle.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_34dd43d2e14b49f9b17cb9961b57c129.<RenderMasterMetadata>b__222_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 9368
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 251
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 161
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<RenderMasterHead>b__221_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 9257
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 251
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 161
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 284
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 161
   at CompiledRazorTemplates.Dynamic.RazorEngine_34dd43d2e14b49f9b17cb9961b57c129.Execute() in C:\inetpub\wwwroot\www.agricover.ro\Files\Templates\Designs\AgricoverCorporate\_parsed\DynamicArticle.parsed.cshtml:line 9247
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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