Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Invalid column name 'SignInHideInvoices'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at Dynamicweb.Data.Database.CreateDataReader(IDbCommand command, CommandBehavior behavior)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, CommandBehavior behavior, Int32 commandTimeout)
   at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Content.Items.Queries.Repository.SelectInternal(IEnumerable`1 ids, Query query)
   at Dynamicweb.Content.Items.Queries.Repository.SelectByIds(IEnumerable`1 ids, Query query, Boolean checkPermissions, Boolean includeInheritedItems)
   at Dynamicweb.Content.Items.Queries.Repository.SelectByIds(IEnumerable`1 ids, Query query, Boolean checkPermissions)
   at Dynamicweb.Content.Items.Queries.Repository.SelectById(String id, Query query)
   at Dynamicweb.Content.Items.Queries.StorageManager.GetById(String systemName, String id)
   at Dynamicweb.Content.Items.Queries.StorageManager.GetById(String systemName, String id, Boolean draft, DateTime previewDate)
   at Dynamicweb.Content.Items.Editors.ItemTypeEditor.GetItem(String itemId)
   at Dynamicweb.Content.Items.Editors.ItemTypeEditor.GetViewModelValue(Object value)
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at Dynamicweb.Frontend.ItemFieldViewModel.GetValue[T]()
   at Dynamicweb.Frontend.ItemViewModel.GetItem(String systemName)
   at CompiledRazorTemplates.Dynamic.RazorEngine_1929bedd6bb04923ad853bfc1d38bcee.Execute() in F:\Domains\Sites\dev-tv.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 4245
   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()
ClientConnectionId:134a0888-f683-4623-b910-9fc80eb5237a
Error Number:207,State:1,Class:16
ClientConnectionId before routing:8b233c04-c915-4248-b4a0-af2cd37a4f33
Routing Destination:b3da3278a6cc.tr19569.eastus2-a.worker.database.windows.net,11007

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