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