Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(GroupCollection groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at Dynamicweb.Rendering.TemplateBase`1.RenderNavigation(Object settings)
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.b__138_0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 5511
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 184
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.b__136_0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 5491
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.b__203_0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7735
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.b__204_0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7744
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.b__202_0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7724
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 248
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_08e45d2fc2b041a3bcb645dc60a90575.Execute() in D:\home\site\wwwroot\Solution\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7570
   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.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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