Error executing template "Designs/Rapido/_parsed/ContentPage.parsed.cshtml"
System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Dynamicweb.Ecommerce.Products.GroupRelation.GetGroupRelationsByChildId(String childId)
   at Dynamicweb.Ecommerce.Products.Group.get_IsTopGroup()
   at Dynamicweb.Ecommerce.Shops.Shop.GetTopLevelGroups(String languageId)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.MakeGroupTree(Page page, NavigationItem parentNode)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.Process(NavigationItem node)
   at Dynamicweb.Ecommerce.Frontend.NavigationProviders.GroupNavigationProvider.ProcessTree(RootNavigationItem rootNode, NavigationType navigationType)
   at Dynamicweb.Frontend.XmlNavigation.MakeXml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, Int32 selectedAreaId)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(Int32 parentId, Int32 levelStart, Int32 levelStop, Expand expand, String name, String xsltPath, Int32 selectedAreaId, Boolean sitemapMode, NameValueCollection settings, NameValueCollection attributes, IncludeMode mode)
   at Dynamicweb.Frontend.XmlNavigation.GetNavigationHtml(NameValueCollection settings, NameValueCollection attributes)
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<RenderDesktopMenuCustom>b__142_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 6124
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<RenderDesktopNavigation>b__154_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 6411
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<RenderMasterHeader>b__225_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9198
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<RenderMain>b__226_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9207
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<RenderMasterBody>b__224_0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9187
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 254
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 287
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 164
   at CompiledRazorTemplates.Dynamic.RazorEngine_1d7f224af1d94982bdcbb44ecfff54e1.Execute() in D:\dynamicweb.net\Solutions\papirkompaniet.cloud.dynamicweb-cms.com\Files\Templates\Designs\Rapido\_parsed\ContentPage.parsed.cshtml:line 9028
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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