Error executing template "Designs/Rapido/_parsed/EventArticle.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired.  The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
   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.Security.UserManagement.GroupRepository.GetGroups()
   at Dynamicweb.Security.UserManagement.Group.get_AllGroups()
   at Dynamicweb.Security.UserManagement.Group.GetGroupByID(Int32 groupID)
   at Dynamicweb.Controls.Legacy.Renderers.UserEditorRenderer.ParseValue(IEnumerable`1 values)
   at Dynamicweb.Controls.Legacy.Renderers.UserEditorRenderer.ParseValue(String value)
   at Dynamicweb.Controls.Legacy.Renderers.UserEditorRenderer.GetUsers(Object value)
   at Dynamicweb.Controls.Legacy.Renderers.UserEditorRenderer.GetViewModelValue(UserEditor userEditor, Object value)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Dynamicweb.Frontend.ItemFieldViewModel.GetValue[T]()
   at Dynamicweb.Frontend.ItemViewModel.GetUsers(String systemName)
   at CompiledRazorTemplates.Dynamic.RazorEngine_ac166f1f7e8e40ee9745983c671fbc35.Execute() in e:\webroot\Files\Templates\Designs\Rapido\_parsed\EventArticle.parsed.cshtml:line 8217
   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:8848b326-0c0f-44d3-a294-2b2bd92e42e8
Error Number:-2,State:0,Class:11

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