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.GetGroupRelationsByParentId(String theParentId)
   at Dynamicweb.Ecommerce.Products.GroupService.GetSubgroups(Group group, Boolean showUnTranslated)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(IEnumerable`1 groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(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_be7d584b50a24bc79192bd2734174f1b.<RenderDesktopMenu>b__114_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 4648
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<RenderDesktopNavigation>b__140_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 5884
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<RenderMasterHeader>b__211_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8520
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<RenderMain>b__212_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8529
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<RenderMasterBody>b__210_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8509
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_be7d584b50a24bc79192bd2734174f1b.Execute() in D:\dynamicweb.net\Solutions\DXC Technology\target.rapido.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 8349
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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