Error executing template "Designs/Rapido/_parsed/AgricoverDaunatori.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_0a6bcfbb741648aa927596a21a8801cf.<RenderDesktopMenu>b__133_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 5599
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 282
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 220
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<RenderDesktopNavigation>b__158_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 6773
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 282
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<RenderMasterHeader>b__234_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 9677
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 282
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<RenderMain>b__235_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 9686
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 282
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 315
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<RenderMasterBody>b__233_0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 9666
   at RazorEngine.Templating.TemplateWriter.ToString()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 282
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass3_0.<RenderBlock>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 315
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.<>c__DisplayClass2_0.<RenderBlockList>b__0(TextWriter __razor_helper_writer) in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 192
   at CompiledRazorTemplates.Dynamic.RazorEngine_0a6bcfbb741648aa927596a21a8801cf.Execute() in C:\inetpub\wwwroot\dev.magazin.agricover.ro\Files\Templates\Designs\Rapido\_parsed\AgricoverDaunatori.parsed.cshtml:line 9482
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

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