Error executing template "Designs/Rapido/_parsed/ContentPage.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.GetGroupRelationsByChildId(String childId)
   at Dynamicweb.Ecommerce.Products.Group.get_IsTopGroup()
   at Dynamicweb.Ecommerce.Shops.Shop.GetTopLevelGroups(String languageId)
   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_71410b9dbbbb4ae3810ab22614170d5a.<RenderDesktopMenu>b__114_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 4675
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<RenderDesktopNavigation>b__143_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 5969
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<RenderMasterHeader>b__208_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8523
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<RenderMain>b__209_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8532
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<RenderMasterBody>b__207_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8386
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 292
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_71410b9dbbbb4ae3810ab22614170d5a.Execute() in C:\inetpub\wwwroot\eCommerce\DK-FUNKI\Solutions\Rapido3.0\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8204
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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