Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.Exception: BreadcrumbNavigation method 'RenderBreadcrumbNavigation' could not be invoked ---> System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.Substring(Int32 startIndex, Int32 length)
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<RenderCustomBreadcrumbs>b__16_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 726
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<RenderBreadcrumbNavigation>b__15_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 711
   at RazorEngine.Templating.TemplateWriter.ToString()
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 278
   --- End of inner exception stack trace ---
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 280
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<RenderMasterHeader>b__205_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8269
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<RenderMain>b__206_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8278
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<RenderMasterBody>b__204_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8257
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_940429a214844b77ae0d2fc20553c516.Execute() in D:\Dynamicweb.net\Solutions\twodayco3\AVNGruppen_Prod\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8051
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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