@gov-cy/govcy-frontend-renderer 1.10.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.
|
package/package.json
CHANGED
|
@@ -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 -%}
|
|
@@ -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) }}
|
|
@@ -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
|
-
|
|
120
|
-
<li><a href="
|
|
121
|
-
|
|
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">© Republic of Cyprus, 2023</span>
|