Error executing template "Designs/Rapido/_parsed/Page.parsed.cshtml"
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.d__64`1.MoveNext()
   at Dynamicweb.Ecommerce.Assortments.AssortmentService.HasAccessToGroup(Group group, User user)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(GroupCollection groups, Page page, NavigationItem parentNode, Int32 thisLevel, Int32 maxLevel, Page productPage)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.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_0c95f0d1e50b462184733fffc759fd3a.b__135_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 5356
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 185
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.b__133_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 5336
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.b__207_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8126
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.b__208_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8135
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 280
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.b__206_0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 8115
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 247
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass3_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 280
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.<>c__DisplayClass2_0.b__0(TextWriter __razor_helper_writer) in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 157
   at CompiledRazorTemplates.Dynamic.RazorEngine_0c95f0d1e50b462184733fffc759fd3a.Execute() in D:\Dynamicweb.net\Solutions\dantherm.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\Page.parsed.cshtml:line 7959
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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