@gov-cy/govcy-frontend-renderer 1.9.0 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,6 +67,17 @@ const inputData =
67
67
  {
68
68
  "site" : {
69
69
  "lang" : "en",
70
+ "languages": [
71
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
72
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"}
73
+ ],
74
+ "footerLinks": [
75
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
76
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
77
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
78
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
79
+ ],
80
+ "menu" : {"en":"Menu", "el":"Μενου"},
70
81
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
71
82
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
72
83
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -145,6 +156,17 @@ const inputData =
145
156
  {
146
157
  "site" : {
147
158
  "lang" : "en",
159
+ "languages": [
160
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
161
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"}
162
+ ],
163
+ "footerLinks": [
164
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
165
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
166
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
167
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"}
168
+ ],
169
+ "menu" : {"en":"Menu", "el":"Μενου"},
148
170
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
149
171
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
150
172
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -279,6 +301,9 @@ In the examples above an `inputData` object is defined and it is used to pass th
279
301
  The `inputData` object has the following structure:
280
302
 
281
303
  - **site.lang**: the language of the site. It is used both in the `<html lang` attribute and to define the default language to be used by the individual design elements defined in the template.
304
+ - **site.languages**: the languages in the language menu.
305
+ - **site.footerLinks**: the links of the footer.
306
+ - **site.menu**: the menu label.
282
307
  - **site.title**: the title of the site. It is used in the `<title>`, `<meta property="og:title"` and `<meta property="twitter:title"` tags of the head.
283
308
  - **site.description**: the description of the site. It is used in the `<meta name="description"`, `<meta property="og:description"` and `<meta property="twitter:description"` tags of the head.
284
309
  - **site.url**: the URL of the site. It is used in the `<meta property="og:url"` and `<meta property="twitter:url"` tags of the head.
@@ -4406,6 +4406,290 @@ root: root
4406
4406
  })();
4407
4407
  })();
4408
4408
 
4409
+ (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/stepByStepStatic.njk"] = (function() {
4410
+ function root(env, context, frame, runtime, cb) {
4411
+ var lineno = 0;
4412
+ var colno = 0;
4413
+ var output = "";
4414
+ try {
4415
+ var parentTemplate = null;
4416
+ output += "\r\n";
4417
+ var macro_t_1 = runtime.makeMacro(
4418
+ ["params"],
4419
+ [],
4420
+ function (l_params, kwargs) {
4421
+ var callerFrame = frame;
4422
+ frame = new runtime.Frame();
4423
+ kwargs = kwargs || {};
4424
+ if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
4425
+ frame.set("caller", kwargs.caller); }
4426
+ frame.set("params", l_params);
4427
+ var t_2 = "";env.getTemplate("utilities/govcyUtilities.njk", false, "elements/stepByStepStatic.njk", false, function(t_4,t_3) {
4428
+ if(t_4) { cb(t_4); return; }
4429
+ t_3.getExported(function(t_5,t_3) {
4430
+ if(t_5) { cb(t_5); return; }
4431
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLocalizeContent")) {
4432
+ var t_6 = t_3.govcyLocalizeContent;
4433
+ } else {
4434
+ cb(new Error("cannot import 'govcyLocalizeContent'")); return;
4435
+ }
4436
+ context.setVariable("govcyLocalizeContent", t_6);
4437
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyLangAttribute")) {
4438
+ var t_7 = t_3.govcyLangAttribute;
4439
+ } else {
4440
+ cb(new Error("cannot import 'govcyLangAttribute'")); return;
4441
+ }
4442
+ context.setVariable("govcyLangAttribute", t_7);
4443
+ if(Object.prototype.hasOwnProperty.call(t_3, "govcyElementsFromArray")) {
4444
+ var t_8 = t_3.govcyElementsFromArray;
4445
+ } else {
4446
+ cb(new Error("cannot import 'govcyElementsFromArray'")); return;
4447
+ }
4448
+ context.setVariable("govcyElementsFromArray", t_8);
4449
+ var t_9;
4450
+ t_9 = (function() {
4451
+ var output = "";
4452
+ output += runtime.suppressValue((lineno = 40, colno = 43, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "Or","el": "Ή"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4453
+ ;
4454
+ return output;
4455
+ })()
4456
+ ;
4457
+ frame.set("orText", t_9, true);
4458
+ if(frame.topLevel) {
4459
+ context.setVariable("orText", t_9);
4460
+ }
4461
+ if(frame.topLevel) {
4462
+ context.addExport("orText", t_9);
4463
+ }
4464
+ var t_10;
4465
+ t_10 = (function() {
4466
+ var output = "";
4467
+ output += runtime.suppressValue((lineno = 41, colno = 44, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "And","el": "Και"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4468
+ ;
4469
+ return output;
4470
+ })()
4471
+ ;
4472
+ frame.set("andText", t_10, true);
4473
+ if(frame.topLevel) {
4474
+ context.setVariable("andText", t_10);
4475
+ }
4476
+ if(frame.topLevel) {
4477
+ context.addExport("andText", t_10);
4478
+ }
4479
+ var t_11;
4480
+ t_11 = (function() {
4481
+ var output = "";
4482
+ output += runtime.suppressValue((lineno = 42, colno = 46, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "Step","el": "Βήμα"},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4483
+ ;
4484
+ return output;
4485
+ })()
4486
+ ;
4487
+ frame.set("stepText", t_11, true);
4488
+ if(frame.topLevel) {
4489
+ context.setVariable("stepText", t_11);
4490
+ }
4491
+ if(frame.topLevel) {
4492
+ context.addExport("stepText", t_11);
4493
+ }
4494
+ if(runtime.memberLookup((l_params),"items")) {
4495
+ t_2 += "\r\n<div class=\"govcy-accordion govcy-accordion-steps govcy-mb-0";
4496
+ if(runtime.memberLookup((l_params),"classes")) {
4497
+ t_2 += " ";
4498
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opts.autoescape);
4499
+ ;
4500
+ }
4501
+ t_2 += "\"";
4502
+ if(runtime.memberLookup((l_params),"id")) {
4503
+ t_2 += " id=\"";
4504
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
4505
+ t_2 += "\"";
4506
+ ;
4507
+ }
4508
+ t_2 += runtime.suppressValue((lineno = 45, colno = 187, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4509
+ t_2 += ">";
4510
+ frame = frame.push();
4511
+ var t_14 = runtime.memberLookup((l_params),"items");
4512
+ if(t_14) {t_14 = runtime.fromIterator(t_14);
4513
+ var t_13 = t_14.length;
4514
+ for(var t_12=0; t_12 < t_14.length; t_12++) {
4515
+ var t_15 = t_14[t_12];
4516
+ frame.set("item", t_15);
4517
+ frame.set("loop.index", t_12 + 1);
4518
+ frame.set("loop.index0", t_12);
4519
+ frame.set("loop.revindex", t_13 - t_12);
4520
+ frame.set("loop.revindex0", t_13 - t_12 - 1);
4521
+ frame.set("loop.first", t_12 === 0);
4522
+ frame.set("loop.last", t_12 === t_13 - 1);
4523
+ frame.set("loop.length", t_13);
4524
+ if(runtime.memberLookup((t_15),"type") == "or") {
4525
+ var t_16;
4526
+ t_16 = (function() {
4527
+ var output = "";
4528
+ output += "<div class=\"govcy-accordion-step govcy-accordion-step-conditional\">";
4529
+ output += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "orText"), env.opts.autoescape);
4530
+ output += "</div>";
4531
+ ;
4532
+ return output;
4533
+ })()
4534
+ ;
4535
+ frame.set("itemStep", t_16, true);
4536
+ if(frame.topLevel) {
4537
+ context.setVariable("itemStep", t_16);
4538
+ }
4539
+ if(frame.topLevel) {
4540
+ context.addExport("itemStep", t_16);
4541
+ }
4542
+ var t_17;
4543
+ t_17 = (function() {
4544
+ var output = "";
4545
+ output += "<span class=\"govcy-visually-hidden\">";
4546
+ output += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "orText"), env.opts.autoescape);
4547
+ output += ", </span>";
4548
+ ;
4549
+ return output;
4550
+ })()
4551
+ ;
4552
+ frame.set("itemStepVisallyHidden", t_17, true);
4553
+ if(frame.topLevel) {
4554
+ context.setVariable("itemStepVisallyHidden", t_17);
4555
+ }
4556
+ if(frame.topLevel) {
4557
+ context.addExport("itemStepVisallyHidden", t_17);
4558
+ }
4559
+ ;
4560
+ }
4561
+ else {
4562
+ if(runtime.memberLookup((t_15),"type") == "and") {
4563
+ var t_18;
4564
+ t_18 = (function() {
4565
+ var output = "";
4566
+ output += "<div class=\"govcy-accordion-step govcy-accordion-step-conditional\">";
4567
+ output += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "andText"), env.opts.autoescape);
4568
+ output += "</div>";
4569
+ ;
4570
+ return output;
4571
+ })()
4572
+ ;
4573
+ frame.set("itemStep", t_18, true);
4574
+ if(frame.topLevel) {
4575
+ context.setVariable("itemStep", t_18);
4576
+ }
4577
+ if(frame.topLevel) {
4578
+ context.addExport("itemStep", t_18);
4579
+ }
4580
+ var t_19;
4581
+ t_19 = (function() {
4582
+ var output = "";
4583
+ output += "<span class=\"govcy-visually-hidden\">";
4584
+ output += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "andText"), env.opts.autoescape);
4585
+ output += ", </span>";
4586
+ ;
4587
+ return output;
4588
+ })()
4589
+ ;
4590
+ frame.set("itemStepVisallyHidden", t_19, true);
4591
+ if(frame.topLevel) {
4592
+ context.setVariable("itemStepVisallyHidden", t_19);
4593
+ }
4594
+ if(frame.topLevel) {
4595
+ context.addExport("itemStepVisallyHidden", t_19);
4596
+ }
4597
+ ;
4598
+ }
4599
+ else {
4600
+ var t_20;
4601
+ t_20 = (function() {
4602
+ var output = "";
4603
+ output += "<div class=\"govcy-accordion-step\">";
4604
+ output += runtime.suppressValue(runtime.memberLookup((runtime.contextOrFrameLookup(context, frame, "loop")),"index"), env.opts.autoescape);
4605
+ output += "</div>";
4606
+ ;
4607
+ return output;
4608
+ })()
4609
+ ;
4610
+ frame.set("itemStep", t_20, true);
4611
+ if(frame.topLevel) {
4612
+ context.setVariable("itemStep", t_20);
4613
+ }
4614
+ if(frame.topLevel) {
4615
+ context.addExport("itemStep", t_20);
4616
+ }
4617
+ var t_21;
4618
+ t_21 = (function() {
4619
+ var output = "";
4620
+ output += "<span class=\"govcy-visually-hidden\">";
4621
+ output += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "stepText"), env.opts.autoescape);
4622
+ output += " ";
4623
+ output += runtime.suppressValue(runtime.memberLookup((runtime.contextOrFrameLookup(context, frame, "loop")),"index"), env.opts.autoescape);
4624
+ output += ", </span>";
4625
+ ;
4626
+ return output;
4627
+ })()
4628
+ ;
4629
+ frame.set("itemStepVisallyHidden", t_21, true);
4630
+ if(frame.topLevel) {
4631
+ context.setVariable("itemStepVisallyHidden", t_21);
4632
+ }
4633
+ if(frame.topLevel) {
4634
+ context.addExport("itemStepVisallyHidden", t_21);
4635
+ }
4636
+ ;
4637
+ }
4638
+ ;
4639
+ }
4640
+ t_2 += "\r\n <div class=\"govcy-accordion-item";
4641
+ if(runtime.memberLookup((t_15),"classes")) {
4642
+ t_2 += " ";
4643
+ t_2 += runtime.suppressValue(runtime.memberLookup((t_15),"classes"), env.opts.autoescape);
4644
+ ;
4645
+ }
4646
+ t_2 += "\"";
4647
+ if(runtime.memberLookup((l_params),"id")) {
4648
+ t_2 += " id=\"";
4649
+ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
4650
+ t_2 += "-item-";
4651
+ t_2 += runtime.suppressValue(runtime.memberLookup((runtime.contextOrFrameLookup(context, frame, "loop")),"index"), env.opts.autoescape);
4652
+ t_2 += "\"";
4653
+ ;
4654
+ }
4655
+ t_2 += ">\r\n ";
4656
+ t_2 += runtime.suppressValue(env.getFilter("safe").call(context, runtime.contextOrFrameLookup(context, frame, "itemStep")), env.opts.autoescape);
4657
+ t_2 += "\r\n <h3 class=\"govcy-pt-4\">\r\n ";
4658
+ t_2 += runtime.suppressValue(env.getFilter("safe").call(context, runtime.contextOrFrameLookup(context, frame, "itemStepVisallyHidden")), env.opts.autoescape);
4659
+ t_2 += runtime.suppressValue((lineno = 61, colno = 75, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((t_15),"heading"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4660
+ t_2 += "</h3> \r\n <div>\r\n ";
4661
+ t_2 += runtime.suppressValue((lineno = 64, colno = 41, runtime.callWrap(t_8, "govcyElementsFromArray", context, [runtime.memberLookup((t_15),"elements"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
4662
+ t_2 += "\r\n </div>\r\n </div>";
4663
+ ;
4664
+ }
4665
+ }
4666
+ frame = frame.pop();
4667
+ t_2 += "\r\n</div>";
4668
+ ;
4669
+ }
4670
+ })});
4671
+ frame = callerFrame;
4672
+ return new runtime.SafeString(t_2);
4673
+ });
4674
+ context.addExport("stepByStepStatic");
4675
+ context.setVariable("stepByStepStatic", macro_t_1);
4676
+ if(parentTemplate) {
4677
+ parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);
4678
+ } else {
4679
+ cb(null, output);
4680
+ }
4681
+ ;
4682
+ } catch (e) {
4683
+ cb(runtime.handleError(e, lineno, colno));
4684
+ }
4685
+ }
4686
+ return {
4687
+ root: root
4688
+ };
4689
+
4690
+ })();
4691
+ })();
4692
+
4409
4693
  (function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/summaryList.njk"] = (function() {
4410
4694
  function root(env, context, frame, runtime, cb) {
4411
4695
  var lineno = 0;
@@ -6374,7 +6658,7 @@ var output = "";
6374
6658
  try {
6375
6659
  var parentTemplate = null;
6376
6660
  var t_1;
6377
- t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput","taskList","errorSummary","details"];
6661
+ t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput","taskList","errorSummary","details","stepByStepStatic"];
6378
6662
  frame.set("macroSimpleBlocks", t_1, true);
6379
6663
  if(frame.topLevel) {
6380
6664
  context.setVariable("macroSimpleBlocks", t_1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gov-cy/govcy-frontend-renderer",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Render html for design elements of the Unified design system using njk or json template.",
5
5
  "author": "DMRID - DSF Team",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@
2
2
  @param {string} action. Will escape text
3
3
  @param {string} id The hint id. Will escape text
4
4
  @param {string} classes Additional classes to add to the outer div. Optional
5
+ @param {string} method The form method. Will escape text. Optional
5
6
  @param {array} elements If defined will be rendered elements inside the form.
6
7
  i.e. `[
7
8
  {element:"button",params:{text:{en:"Button 1",el:"Κουμπί 1"},lang:"en",id:"govcy-test-23b"} },
@@ -10,7 +11,7 @@
10
11
  @returns govcy form html
11
12
  #}
12
13
  {% macro form(params) -%}
13
- <form {% if params.id %}id="{{ params.id }}" {% endif %}action="{{ params.action }}" class="govcy-form{% if params.classes %} {{ params.classes }}{% endif %}" novalidate="">
14
+ <form {% if params.id %}id="{{ params.id }}" {% endif %}{% if params.method %} method="{{ params.method }}" {% endif %}action="{{ params.action }}" class="govcy-form{% if params.classes %} {{ params.classes }}{% endif %}" novalidate="">
14
15
  {{ caller() }}
15
16
  {#- if it has elements to be called -#}
16
17
  {%- if params.elements -%}
@@ -0,0 +1,71 @@
1
+ {# stepByStepStatic
2
+ @param {string} lang The language used. Can be 'en','el'. Optional.
3
+ @param {string} id The id of the step by step. Will escape text. Optional
4
+ @param {array} items The array of items to turn into steps
5
+ @param {string} item.heading The heading of the item. Will escape text. Example `{"en":"Content","el":"Περιεχομένο"}`.
6
+ @param {array} item.elements, govcy-elements to be rendered inside the item's body.
7
+ @param {string} item.type The item type. Can be ''(which is incremental steps) ,'or','and'. Optional, default is ''
8
+ @param {string} item.classes Additional classes to add to the item. Optional
9
+ i.e. ` [
10
+ {
11
+ "heading":{"en":"Step 1","el":"Βήμα 1"},
12
+ "elements":[
13
+ {"element":"textElement",
14
+ "params":{
15
+ "text":{"en":"Content","el":"Περιεχομένο"}
16
+ }
17
+ },
18
+ {"element":"markdown",
19
+ "params":{
20
+ "text":{"en":"- item1\n- item2","el":"- item1 el\n- item2 el"}
21
+ }
22
+ }
23
+ ]
24
+ },
25
+ {
26
+ "heading":{"en":"Step 2","el":"Βήμα 2"},
27
+ "elements":[
28
+ {"element":"textElement","params":{"text":{"en":"Content 2","el":"Περιεχομένο 2"} } }
29
+ ],
30
+ "type":"or",
31
+ "classes":"govcy-test-class"
32
+ }
33
+ ]`
34
+ @param {string} classes Additional classes to add to the outer `<details>`. Optional
35
+ @returns govcy stepByStepStatic html
36
+ #}
37
+ {% macro stepByStepStatic(params) -%}
38
+ {#- Import localizer from utilities -#}
39
+ {%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute, govcyElementsFromArray -%}
40
+ {#- set default values -#}
41
+ {%- set orText -%} {{- govcyLocalizeContent({en:'Or',el:'Ή'}, params.lang) -}}{%- endset -%}
42
+ {%- set andText -%} {{- govcyLocalizeContent({en:'And',el:'Και'}, params.lang) -}}{%- endset -%}
43
+ {%- set stepText -%} {{- govcyLocalizeContent({en:'Step',el:'Βήμα'}, params.lang) -}}{%- endset -%}
44
+ {#- items are mandatory -#}
45
+ {%- if params.items %}
46
+ <div class="govcy-accordion govcy-accordion-steps govcy-mb-0{% if params.classes %} {{ params.classes }}{% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %}{{ govcyLangAttribute(params.lang) }}>
47
+ {#- for each item render checkbox item -#}
48
+ {%- for item in params.items %}
49
+ {%- if item.type == 'or' -%}
50
+ {%- set itemStep -%}<div class="govcy-accordion-step govcy-accordion-step-conditional">{{ orText }}</div>{%- endset -%}
51
+ {%- set itemStepVisallyHidden -%}<span class="govcy-visually-hidden">{{ orText }}, </span>{%- endset -%}
52
+ {%- elif item.type == 'and' -%}
53
+ {%- set itemStep -%}<div class="govcy-accordion-step govcy-accordion-step-conditional">{{ andText }}</div>{%- endset -%}
54
+ {%- set itemStepVisallyHidden -%}<span class="govcy-visually-hidden">{{ andText }}, </span>{%- endset -%}
55
+ {%- else -%}
56
+ {%- set itemStep -%}<div class="govcy-accordion-step">{{ loop.index }}</div>{%- endset -%}
57
+ {%- set itemStepVisallyHidden -%}<span class="govcy-visually-hidden">{{ stepText }} {{ loop.index}}, </span>{%- endset -%}
58
+ {%- endif %}
59
+ <div class="govcy-accordion-item{% if item.classes %} {{ item.classes }}{% endif %}"{% if params.id %} id="{{ params.id }}-item-{{ loop.index }}"{% endif %}>
60
+ {{ itemStep | safe }}
61
+ <h3 class="govcy-pt-4">
62
+ {{ itemStepVisallyHidden | safe }} {{- govcyLocalizeContent(item.heading, params.lang) -}}
63
+ </h3>
64
+ <div>
65
+ {{ govcyElementsFromArray(item.elements, params.lang) }}
66
+ </div>
67
+ </div>
68
+ {%- endfor %}
69
+ </div>
70
+ {%- endif %}
71
+ {%- endmacro %}
@@ -1,7 +1,7 @@
1
1
  {# textElement
2
2
  @param {string} lang The language used. Can be 'en','el'. Optional.
3
3
  @param {object} text The text. Will escape text, Example `{en:"Content",el:"Περιεχομένο"}`
4
- @param {string} type The type of the element. Can be `p`,`h1`,`h2`,`h3`,`h4`. Default is `p`
4
+ @param {string} type The type of the element. Can be `p`,`h1`,`h2`,`h3`,`h4`,`span`. Default is `p`
5
5
  @param {string} id The elemen't id. Will escape text. Optional
6
6
  @param {string} classes Additional classes to add to the outer div. Optional
7
7
  @returns html Elements with sanitzed html
@@ -13,7 +13,7 @@
13
13
  {%- if params.text -%}
14
14
  {#- Import localizer from utilities -#}
15
15
  {%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
16
- {%- if textType == 'p' or textType == 'h1' or textType == 'h2' or textType == 'h3' or textType == 'h4' -%}
16
+ {%- if textType == 'p' or textType == 'h1' or textType == 'h2' or textType == 'h3' or textType == 'h4' or textType == 'span' -%}
17
17
  {%- set textTag = textType -%}
18
18
  <{{ textType }}{% if params.id %} id="{{ params.id }}"{% endif %}{% if params.classes %} class="{{ params.classes }}"{% endif %}{{ govcyLangAttribute(params.lang) }}>
19
19
  {{ govcyLocalizeContent(params.text, params.lang) }}
@@ -25,7 +25,7 @@ To use:
25
25
  {%- set macroSimpleBlocks = ['label', 'legend', 'hint', 'button',
26
26
  'errorMessage','select','textElement','htmlElement','textInput','radios','checkboxes',
27
27
  'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea','markdown',
28
- 'panel', 'datePicker','dateInput', 'taskList', 'errorSummary', 'details'] -%}
28
+ 'panel', 'datePicker','dateInput', 'taskList', 'errorSummary', 'details', 'stepByStepStatic'] -%}
29
29
  {%- set macroCallerBlocks = ['formControl','form','fieldset'] -%}
30
30
  {%- macro govcyElement(component, params) -%}
31
31
  {#- Simple blocks -#}
@@ -5,6 +5,18 @@ To use this template you need to pass the following data:
5
5
  {
6
6
  site: {
7
7
  "lang": "en",
8
+ "languages": [
9
+ {"code": "el", "label": "EL", "alt": "Ελληνική γλώσσα", "href": "?lang=el"},
10
+ {"code": "en", "label": "EN", "alt": "English language", "href": "?lang=en"},
11
+ {"code": "tr", "label": "TR", "alt": "Türkçe", "href": "?lang=tr"}
12
+ ],
13
+ "footerLinks": [
14
+ {"label": {"en":"Privacy statement", "el":"Δήλωση απορρήτου"}, "href": "#"},
15
+ {"label": {"en":"Cookies", "el":"Cookies"}, "href": "#"},
16
+ {"label": {"en":"Accessibility", "el":"Προσβασιμότητα"}, "href": "#"},
17
+ {"label": {"en":"Help us improve this service", "el":"Βοηθήστε μας να βελτιώσουμε αυτή την υπηρεσία"}, "href": "#"},
18
+ ],
19
+ "menu" : {"en":"Menu", "el":"Μενου"},
8
20
  "title" : {"en":"Service title", "el":"Τιτλός υπηρεσίας"},
9
21
  "headerTitle" : {"en":"Header title", "el":"Τιτλός επικεφαλιδας"},
10
22
  "description" : {"en":"Service description", "el":"Περιγραφή υπηρεσίας"},
@@ -83,9 +95,34 @@ To use this template you need to pass the following data:
83
95
  <a href="https://gov.cy" class="govcy-logo" title="Go to the gov.cy homepage"><img alt="gov.cy Logo"></a>
84
96
  <span class="govcy-service-name">{{ govcyLocalizeContent(site.headerTitle, site.lang) }}</span>
85
97
  </div>
98
+ {%- if site.languages -%}
99
+ <ul class="govcy-menu-items">
100
+ {%- for iLang in site.languages %}
101
+ <li class="govcy-desktop-menu-only"><span><a href="{{ iLang.href }}"
102
+ class="govcy-menu-item{% if iLang.code == site.lang %} active{% endif %}"
103
+ {% if iLang.code == site.lang %} aria-current="true"{% endif %}
104
+ aria-label="{{ iLang.alt }}" lang="{{ iLang.code }}">{{ iLang.label }}</a></span>
105
+ </li>{%- endfor %}
106
+ <li class="govcy-mobile-menu govcy-mobile-menu-only govcy-dropdown govcy-ms-auto"><span><a href="#" class="govcy-menu-item govcy-expand-btn">{{ govcyLocalizeContent(pageData.menu, site.lang) }}</a></span></li>
107
+ </ul>
108
+ {%- endif %}
86
109
  </div>
87
110
  </div>
88
111
  </div>
112
+
113
+ {%- if site.languages -%}
114
+ <div class="govcy-header-menu-area">
115
+ <nav class="govcy-mainmenu" aria-label="{{ govcyLocalizeContent(pageData.menu, site.lang) }}">
116
+ <div class="govcy-container">
117
+ <ul class="govcy-menu-items govcy-header-language-area govcy-mobile-menu-only">
118
+ {%- for iLang in site.languages %}
119
+ <li><a href="{{ iLang.href }}" class="govcy-menu-item{% if iLang.code == site.lang %} active{% endif %}" {% if iLang.code == site.lang %} aria-current="true"{% endif %} aria-label="{{ iLang.alt }}" lang="{{ iLang.code }}">{{ iLang.label }}</a></li>
120
+ {%- endfor %}
121
+ </ul>
122
+ </div>
123
+ </nav>
124
+ </div>
125
+ {%- endif %}
89
126
  {% endblock %}
90
127
  </header>
91
128
 
@@ -115,12 +152,13 @@ To use this template you need to pass the following data:
115
152
  <div class="govcy-container">
116
153
  <div class="govcy-d-flex govcy-justify-content-between govcy-align-items-end govcy-flex-wrap">
117
154
  <div class="govcy-my-4">
155
+ {%- if site.footerLinks %}
118
156
  <ul>
119
- <li><a href="#">Privacy statement</a></li>
120
- <li><a href="#">Cookies</a></li>
121
- <li><a href="#">Accessibility</a></li>
122
- <li><a href="#">Help us improve this service</a></li>
157
+ {%- for iLink in site.footerLinks %}
158
+ <li><a href="{{ iLink.href }}">{{ govcyLocalizeContent(iLink.label, site.lang) }}</a></li>
159
+ {%- endfor %}
123
160
  </ul>
161
+ {%- endif %}
124
162
  <div class="govcy-d-flex govcy-align-items-center govcy-flex-wrap">
125
163
  <span class="govcy-fs-2 govcy-fw-bold govcy-mr-6">gov.cy</span>
126
164
  <span class="govcy-mr-6 govcy-mt-2 govcy-mb-2">&copy; Republic of Cyprus, 2023</span>