Error executing template "Designs/Rapido/_parsed/Custom__ComposerDetailPage.parsed.cshtml"
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Dynamicweb.Ecommerce.Products.GroupRelation.GetGroupRelationsByParentId(String theParentId)
   at Dynamicweb.Ecommerce.Products.GroupService.GetSubgroups(Group group, Boolean showUnTranslated)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(IEnumerable`1 groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(IEnumerable`1 groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<RenderMobileNavigationMenu>b__104_0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 4107
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<MobileNavigation>b__102_0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 4075
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<RenderMasterBody>b__253_0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 9147
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 246
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 279
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 156
   at CompiledRazorTemplates.Dynamic.RazorEngine_5763a583ab024f4e81dc18ebfc9518e6.Execute() in F:\Domains\Sites\qa-lorenz.mydwsite3.com\Files\Templates\Designs\Rapido\_parsed\Custom__ComposerDetailPage.parsed.cshtml:line 8977
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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