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