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