@ministryofjustice/frontend 3.6.1 → 3.6.3
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/moj/all.jquery.min.js +1 -1
- package/moj/all.js +81 -81
- package/moj/all.mjs +3 -3
- package/moj/all.scss +1 -1
- package/moj/components/add-another/add-another.js +10 -10
- package/moj/components/add-another/add-another.mjs +10 -10
- package/moj/components/alert/template.njk +4 -4
- package/moj/components/badge/template.njk +1 -1
- package/moj/components/banner/template.njk +11 -11
- package/moj/components/cookie-banner/_cookie-banner.scss +1 -1
- package/moj/components/cookie-banner/template.njk +1 -1
- package/moj/components/currency-input/template.njk +10 -10
- package/moj/components/date-picker/template.njk +2 -2
- package/moj/components/filter/template.njk +1 -1
- package/moj/components/filter-toggle-button/filter-toggle-button.js +8 -8
- package/moj/components/filter-toggle-button/filter-toggle-button.mjs +8 -8
- package/moj/components/form-validator/form-validator.js +4 -4
- package/moj/components/form-validator/form-validator.mjs +4 -4
- package/moj/components/header/template.njk +8 -8
- package/moj/components/identity-bar/template.njk +1 -1
- package/moj/components/messages/template.njk +6 -6
- package/moj/components/multi-file-upload/multi-file-upload.js +23 -23
- package/moj/components/multi-file-upload/multi-file-upload.mjs +23 -23
- package/moj/components/multi-file-upload/template.njk +1 -1
- package/moj/components/multi-select/multi-select.js +7 -7
- package/moj/components/multi-select/multi-select.mjs +7 -7
- package/moj/components/notification-badge/template.njk +1 -1
- package/moj/components/organisation-switcher/template.njk +3 -3
- package/moj/components/page-header-actions/template.njk +1 -1
- package/moj/components/pagination/template.njk +2 -2
- package/moj/components/password-reveal/password-reveal.js +4 -4
- package/moj/components/password-reveal/password-reveal.mjs +4 -4
- package/moj/components/primary-navigation/template.njk +2 -2
- package/moj/components/progress-bar/template.njk +4 -4
- package/moj/components/rich-text-editor/rich-text-editor.js +6 -6
- package/moj/components/rich-text-editor/rich-text-editor.mjs +6 -6
- package/moj/components/search/template.njk +7 -7
- package/moj/components/search-toggle/search-toggle.js +8 -8
- package/moj/components/search-toggle/search-toggle.mjs +8 -8
- package/moj/components/side-navigation/template.njk +3 -3
- package/moj/components/sortable-table/sortable-table.js +11 -11
- package/moj/components/sortable-table/sortable-table.mjs +11 -11
- package/moj/components/sub-navigation/template.njk +2 -2
- package/moj/components/task-list/template.njk +4 -4
- package/moj/components/ticket-panel/template.njk +2 -2
- package/moj/components/timeline/template.njk +2 -2
- package/moj/moj-frontend.min.js +1 -1
- package/package.json +1 -9
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<span class="moj-badge {{-
|
|
1
|
+
<span class="moj-badge {{- " " + params.classes if params.classes }}" {%- if (params.label) %} aria-label=""{% endif -%} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
|
2
2
|
{{- params.html | safe if params.html else params.text -}}
|
|
3
3
|
</span>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{#- Set classes for this component #}
|
|
2
2
|
{%- set classNames = ["moj-banner"] -%}
|
|
3
3
|
|
|
4
|
-
{%- if params.type ==
|
|
4
|
+
{%- if params.type == "success" %}
|
|
5
5
|
{%- set classNames = classNames.concat("moj-banner--success") %}
|
|
6
|
-
{%- elif params.type ==
|
|
6
|
+
{%- elif params.type == "warning" %}
|
|
7
7
|
{%- set classNames = classNames.concat("moj-banner--warning") %}
|
|
8
|
-
{%- elif params.type ==
|
|
8
|
+
{%- elif params.type == "information" %}
|
|
9
9
|
{%- set classNames = classNames.concat("moj-banner--information") %}
|
|
10
10
|
{%- endif %}
|
|
11
11
|
|
|
@@ -13,22 +13,22 @@
|
|
|
13
13
|
{%- set classNames = classNames.concat(params.classes) %}
|
|
14
14
|
{%- endif %}
|
|
15
15
|
|
|
16
|
-
{%- set classNames = classNames | join(
|
|
16
|
+
{%- set classNames = classNames | join(" ") -%}
|
|
17
17
|
|
|
18
|
-
<div
|
|
19
|
-
class="{{ classNames }}"
|
|
20
|
-
{%- for attribute, value in params.attributes %}
|
|
18
|
+
<div
|
|
19
|
+
class="{{ classNames }}"
|
|
20
|
+
{%- for attribute, value in params.attributes %}
|
|
21
21
|
{{ attribute }}="{{ value }}"
|
|
22
22
|
{% endfor %}
|
|
23
23
|
role="region"
|
|
24
24
|
aria-label="{{ params.iconFallbackText | default(params.type) | default("banner") }}"
|
|
25
25
|
>
|
|
26
26
|
|
|
27
|
-
{% if params.type ==
|
|
27
|
+
{% if params.type == "success" %}
|
|
28
28
|
<svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M25,6.2L8.7,23.2L0,14.1l4-4.2l4.7,4.9L21,2L25,6.2z"/></svg>
|
|
29
|
-
{% elif params.type ==
|
|
29
|
+
{% elif params.type == "warning" %}
|
|
30
30
|
<svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M13.6,15.4h-2.3v-4.5h2.3V15.4z M13.6,19.8h-2.3v-2.2h2.3V19.8z M0,23.2h25L12.5,2L0,23.2z"/></svg>
|
|
31
|
-
{% elif params.type ==
|
|
31
|
+
{% elif params.type == "information" %}
|
|
32
32
|
<svg class="moj-banner__icon" fill="currentColor" role="presentation" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 25" height="25" width="25"><path d="M13.7,18.5h-2.4v-2.4h2.4V18.5z M12.5,13.7c-0.7,0-1.2-0.5-1.2-1.2V7.7c0-0.7,0.5-1.2,1.2-1.2s1.2,0.5,1.2,1.2v4.8
|
|
33
33
|
C13.7,13.2,13.2,13.7,12.5,13.7z M12.5,0.5c-6.6,0-12,5.4-12,12s5.4,12,12,12s12-5.4,12-12S19.1,0.5,12.5,0.5z"/></svg>
|
|
34
34
|
{% endif %}
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
{{- params.html | safe if params.html else params.text -}}
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
|
-
</div>
|
|
40
|
+
</div>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<div class="govuk-grid-column-full govuk-grid-column-one-half-from-desktop">
|
|
13
13
|
{{ govukButton({
|
|
14
14
|
text: item.text,
|
|
15
|
-
classes:
|
|
15
|
+
classes: "govuk-button button--inline " + item.class,
|
|
16
16
|
type: item.type,
|
|
17
17
|
element: item.element,
|
|
18
18
|
href: item.href
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
for: params.id
|
|
16
16
|
}) | indent(2) | trim }}
|
|
17
17
|
{% if params.hint %}
|
|
18
|
-
{% set hintId = params.id +
|
|
19
|
-
{% set describedBy = describedBy +
|
|
18
|
+
{% set hintId = params.id + "-hint" %}
|
|
19
|
+
{% set describedBy = describedBy + " " + hintId if describedBy else hintId %}
|
|
20
20
|
{{ govukHint({
|
|
21
21
|
id: hintId,
|
|
22
22
|
classes: params.hint.classes,
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}) | indent(2) | trim }}
|
|
27
27
|
{% endif %}
|
|
28
28
|
{% if params.errorMessage %}
|
|
29
|
-
{% set errorId = params.id +
|
|
30
|
-
{% set describedBy = describedBy +
|
|
29
|
+
{% set errorId = params.id + "-error" %}
|
|
30
|
+
{% set describedBy = describedBy + " " + errorId if describedBy else errorId %}
|
|
31
31
|
{{ govukErrorMessage({
|
|
32
32
|
id: errorId,
|
|
33
33
|
classes: params.errorMessage.classes,
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
visuallyHiddenText: params.errorMessage.visuallyHiddenText
|
|
38
38
|
}) | indent(2) | trim }}
|
|
39
39
|
{% endif %}
|
|
40
|
-
<span class="moj-label__currency {%- if params.errorMessage %} moj-label__currency--error{% endif %} {{-
|
|
41
|
-
{{- params.currencyLabel.html if params.currencyLabel.html else params.currencyLabel.text | default(
|
|
40
|
+
<span class="moj-label__currency {%- if params.errorMessage %} moj-label__currency--error{% endif %} {{- " " + params.currencyLabel.classes if params.currencyLabel.classes}}">
|
|
41
|
+
{{- params.currencyLabel.html if params.currencyLabel.html else params.currencyLabel.text | default("£") | safe -}}
|
|
42
42
|
</span>
|
|
43
|
-
<input class="govuk-input moj-input__currency {{-
|
|
43
|
+
<input class="govuk-input moj-input__currency {{- " " + params.classes if params.classes}} {%- if params.errorMessage %} govuk-input--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="{{ params.type | default("text") }}"
|
|
44
44
|
{%- if params.value %} value="{{ params.value }}"{% endif %}
|
|
45
45
|
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
|
|
46
|
-
autocomplete="{{ params.autocomplete | default(
|
|
47
|
-
pattern="{{ params.pattern | default(
|
|
46
|
+
autocomplete="{{ params.autocomplete | default("off") }}"
|
|
47
|
+
pattern="{{ params.pattern | default("[0-9]*") }}"
|
|
48
48
|
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
|
49
|
-
</div>
|
|
49
|
+
</div>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
{% endif %}
|
|
9
9
|
|
|
10
10
|
{% set attributes = {
|
|
11
|
-
"data-module":
|
|
11
|
+
"data-module": "moj-date-picker",
|
|
12
12
|
"data-min-date": {
|
|
13
13
|
value: params.minDate,
|
|
14
14
|
optional: true
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
autocomplete: "off",
|
|
45
45
|
formGroup: params.formGroup,
|
|
46
46
|
label: params.label,
|
|
47
|
-
hint: params.hint,
|
|
47
|
+
hint: params.hint,
|
|
48
48
|
errorMessage: params.errorMessage
|
|
49
49
|
}) }}
|
|
50
50
|
</div>
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
function FilterToggleButton(options) {
|
|
8
8
|
this.options = options;
|
|
9
|
-
this.container =
|
|
10
|
-
this.filterContainer =
|
|
9
|
+
this.container = $(this.options.toggleButton.container);
|
|
10
|
+
this.filterContainer = $(this.options.filter.container);
|
|
11
11
|
|
|
12
12
|
this.createToggleButton();
|
|
13
13
|
this.setupResponsiveChecks();
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
|
|
20
20
|
FilterToggleButton.prototype.setupResponsiveChecks = function () {
|
|
21
21
|
this.mq = window.matchMedia(this.options.bigModeMediaQuery);
|
|
22
|
-
this.mq.addListener(
|
|
22
|
+
this.mq.addListener($.proxy(this, 'checkMode'));
|
|
23
23
|
this.checkMode(this.mq);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
FilterToggleButton.prototype.createToggleButton = function () {
|
|
27
|
-
this.menuButton =
|
|
27
|
+
this.menuButton = $(
|
|
28
28
|
`<button class="govuk-button ${this.options.toggleButton.classes}" type="button" aria-haspopup="true" aria-expanded="false">${this.options.toggleButton.showText}</button>`
|
|
29
29
|
);
|
|
30
|
-
this.menuButton.on('click',
|
|
30
|
+
this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
|
|
31
31
|
this.container.append(this.menuButton);
|
|
32
32
|
};
|
|
33
33
|
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
|
|
52
52
|
FilterToggleButton.prototype.addCloseButton = function () {
|
|
53
53
|
if (this.options.closeButton) {
|
|
54
|
-
this.closeButton =
|
|
54
|
+
this.closeButton = $(
|
|
55
55
|
`<button class="moj-filter__close" type="button">${this.options.closeButton.text}</button>`
|
|
56
56
|
);
|
|
57
|
-
this.closeButton.on('click',
|
|
58
|
-
|
|
57
|
+
this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
|
|
58
|
+
$(this.options.closeButton.container).append(this.closeButton);
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function FilterToggleButton(options) {
|
|
2
2
|
this.options = options;
|
|
3
|
-
this.container =
|
|
4
|
-
this.filterContainer =
|
|
3
|
+
this.container = $(this.options.toggleButton.container);
|
|
4
|
+
this.filterContainer = $(this.options.filter.container);
|
|
5
5
|
|
|
6
6
|
this.createToggleButton();
|
|
7
7
|
this.setupResponsiveChecks();
|
|
@@ -13,15 +13,15 @@ function FilterToggleButton(options) {
|
|
|
13
13
|
|
|
14
14
|
FilterToggleButton.prototype.setupResponsiveChecks = function () {
|
|
15
15
|
this.mq = window.matchMedia(this.options.bigModeMediaQuery);
|
|
16
|
-
this.mq.addListener(
|
|
16
|
+
this.mq.addListener($.proxy(this, 'checkMode'));
|
|
17
17
|
this.checkMode(this.mq);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
FilterToggleButton.prototype.createToggleButton = function () {
|
|
21
|
-
this.menuButton =
|
|
21
|
+
this.menuButton = $(
|
|
22
22
|
`<button class="govuk-button ${this.options.toggleButton.classes}" type="button" aria-haspopup="true" aria-expanded="false">${this.options.toggleButton.showText}</button>`
|
|
23
23
|
);
|
|
24
|
-
this.menuButton.on('click',
|
|
24
|
+
this.menuButton.on('click', $.proxy(this, 'onMenuButtonClick'));
|
|
25
25
|
this.container.append(this.menuButton);
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -45,11 +45,11 @@ FilterToggleButton.prototype.enableSmallMode = function () {
|
|
|
45
45
|
|
|
46
46
|
FilterToggleButton.prototype.addCloseButton = function () {
|
|
47
47
|
if (this.options.closeButton) {
|
|
48
|
-
this.closeButton =
|
|
48
|
+
this.closeButton = $(
|
|
49
49
|
`<button class="moj-filter__close" type="button">${this.options.closeButton.text}</button>`
|
|
50
50
|
);
|
|
51
|
-
this.closeButton.on('click',
|
|
52
|
-
|
|
51
|
+
this.closeButton.on('click', $.proxy(this, 'onCloseClick'));
|
|
52
|
+
$(this.options.closeButton.container).append(this.closeButton);
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
this.form = form;
|
|
39
39
|
this.errors = [];
|
|
40
40
|
this.validators = [];
|
|
41
|
-
|
|
41
|
+
$(this.form).on('submit', $.proxy(this, 'onSubmit'));
|
|
42
42
|
this.summary =
|
|
43
|
-
options && options.summary ?
|
|
43
|
+
options && options.summary ? $(options.summary) : $('.govuk-error-summary');
|
|
44
44
|
this.originalTitle = document.title;
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
const errorSpan = `<span class="govuk-error-message" id="${
|
|
123
123
|
errorSpanId
|
|
124
124
|
}">${this.escapeHtml(error.message)}</span>`;
|
|
125
|
-
const control =
|
|
125
|
+
const control = $(`#${error.fieldName}`);
|
|
126
126
|
const fieldContainer = control.parents('.govuk-form-group');
|
|
127
127
|
const label = fieldContainer.find('label');
|
|
128
128
|
const legend = fieldContainer.find('legend');
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
FormValidator.prototype.removeInlineError = function (error) {
|
|
149
|
-
const control =
|
|
149
|
+
const control = $(`#${error.fieldName}`);
|
|
150
150
|
const fieldContainer = control.parents('.govuk-form-group');
|
|
151
151
|
fieldContainer.find('.govuk-error-message').remove();
|
|
152
152
|
fieldContainer.removeClass('govuk-form-group--error');
|
|
@@ -4,9 +4,9 @@ function FormValidator(form, options) {
|
|
|
4
4
|
this.form = form;
|
|
5
5
|
this.errors = [];
|
|
6
6
|
this.validators = [];
|
|
7
|
-
|
|
7
|
+
$(this.form).on('submit', $.proxy(this, 'onSubmit'));
|
|
8
8
|
this.summary =
|
|
9
|
-
options && options.summary ?
|
|
9
|
+
options && options.summary ? $(options.summary) : $('.govuk-error-summary');
|
|
10
10
|
this.originalTitle = document.title;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -88,7 +88,7 @@ FormValidator.prototype.showInlineError = function (error) {
|
|
|
88
88
|
const errorSpan = `<span class="govuk-error-message" id="${
|
|
89
89
|
errorSpanId
|
|
90
90
|
}">${this.escapeHtml(error.message)}</span>`;
|
|
91
|
-
const control =
|
|
91
|
+
const control = $(`#${error.fieldName}`);
|
|
92
92
|
const fieldContainer = control.parents('.govuk-form-group');
|
|
93
93
|
const label = fieldContainer.find('label');
|
|
94
94
|
const legend = fieldContainer.find('legend');
|
|
@@ -112,7 +112,7 @@ FormValidator.prototype.removeInlineErrors = function () {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
FormValidator.prototype.removeInlineError = function (error) {
|
|
115
|
-
const control =
|
|
115
|
+
const control = $(`#${error.fieldName}`);
|
|
116
116
|
const fieldContainer = control.parents('.govuk-form-group');
|
|
117
117
|
fieldContainer.find('.govuk-error-message').remove();
|
|
118
118
|
fieldContainer.removeClass('govuk-form-group--error');
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<header class="moj-header {{-
|
|
1
|
+
<header class="moj-header {{- " " + params.classes if params.classes}}" role="banner" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
|
2
2
|
|
|
3
3
|
<div class="moj-header__container {%- if params.containerClasses %} {{ params.containerClasses }}{% endif %}">
|
|
4
4
|
|
|
5
5
|
<div class="moj-header__logo">
|
|
6
6
|
|
|
7
|
-
{%- if params.logotype ==
|
|
7
|
+
{%- if params.logotype == "crown" %}
|
|
8
8
|
|
|
9
9
|
<svg aria-hidden="true" focusable="false" class="moj-header__logotype-crown" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 132 97" height="32" width="36">
|
|
10
10
|
<path fill="#ffffff" fill-rule="evenodd" d="M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.1zm64.4-5.6c-3.6 1.5-7.8-.2-9.1-3.7-1.5-3.6.2-7.8 3.8-9.2 3.6-1.4 7.7.3 9.2 3.9 1.3 3.5-.4 7.5-3.9 9zm15.9 9.3c-3.6 1.5-7.7-.2-9.1-3.7-1.5-3.6.2-7.8 3.7-9.1 3.6-1.5 7.7.2 9.2 3.8 1.5 3.5-.3 7.5-3.8 9zm4.7 17.7c-3.6 1.5-7.8-.2-9.2-3.8-1.5-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.3 3.5-.4 7.6-3.9 9.1zM89.3 35.8c-3.6 1.5-7.8-.2-9.2-3.8-1.4-3.6.2-7.7 3.9-9.1 3.6-1.5 7.7.3 9.2 3.8 1.4 3.6-.3 7.7-3.9 9.1zM69.7 17.7l8.9 4.7V9.3l-8.9 2.8c-.2-.3-.5-.6-.9-.9L72.4 0H59.6l3.5 11.2c-.3.3-.6.5-.9.9l-8.8-2.8v13.1l8.8-4.7c.3.3.6.7.9.9l-5 15.4v.1c-.2.8-.4 1.6-.4 2.4 0 4.1 3.1 7.5 7 8.1h.2c.3 0 .7.1 1 .1.4 0 .7 0 1-.1h.2c4-.6 7.1-4.1 7.1-8.1 0-.8-.1-1.7-.4-2.4V34l-5.1-15.4c.4-.2.7-.6 1-.9zM66 92.8c16.9 0 32.8 1.1 47.1 3.2 4-16.9 8.9-26.7 14-33.5l-9.6-3.4c1 4.9 1.1 7.2 0 10.2-1.5-1.4-3-4.3-4.2-8.7L108.6 76c2.8-2 5-3.2 7.5-3.3-4.4 9.4-10 11.9-13.6 11.2-4.3-.8-6.3-4.6-5.6-7.9 1-4.7 5.7-5.9 8-.5 4.3-8.7-3-11.4-7.6-8.8 7.1-7.2 7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z"></path>
|
|
@@ -49,24 +49,24 @@
|
|
|
49
49
|
{% endif -%}
|
|
50
50
|
|
|
51
51
|
{%- if (params.organisationLabel) %}
|
|
52
|
-
{% set organisationLabelElement =
|
|
52
|
+
{% set organisationLabelElement = "span" %}
|
|
53
53
|
{%- if (params.organisationLabel.href) %}
|
|
54
|
-
{% set organisationLabelElement =
|
|
54
|
+
{% set organisationLabelElement = "a" %}
|
|
55
55
|
{% endif -%}
|
|
56
56
|
|
|
57
|
-
<{{organisationLabelElement}} class="moj-header__link moj-header__link--organisation-name" {% if params.organisationLabel.href %} href="{{ params.organisationLabel.href | default(
|
|
57
|
+
<{{organisationLabelElement}} class="moj-header__link moj-header__link--organisation-name" {% if params.organisationLabel.href %} href="{{ params.organisationLabel.href | default("/") }}" {% endif %}>
|
|
58
58
|
{{- params.organisationLabel.html | safe if params.organisationLabel.html else params.organisationLabel.text -}}
|
|
59
59
|
</{{organisationLabelElement}}>
|
|
60
60
|
{% endif -%}
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
{%- if (params.serviceLabel) %}
|
|
64
|
-
{% set serviceLabelElement =
|
|
64
|
+
{% set serviceLabelElement = "span" %}
|
|
65
65
|
{%- if (params.serviceLabel.href) %}
|
|
66
|
-
{% set serviceLabelElement =
|
|
66
|
+
{% set serviceLabelElement = "a" %}
|
|
67
67
|
{% endif -%}
|
|
68
68
|
|
|
69
|
-
<{{serviceLabelElement}} class="moj-header__link moj-header__link--service-name" {% if params.serviceLabel.href %} href="{{ params.serviceLabel.href | default(
|
|
69
|
+
<{{serviceLabelElement}} class="moj-header__link moj-header__link--service-name" {% if params.serviceLabel.href %} href="{{ params.serviceLabel.href | default("/") }}" {% endif %}>
|
|
70
70
|
{{- params.serviceLabel.html | safe if params.serviceLabel.html else params.serviceLabel.text -}}
|
|
71
71
|
</{{serviceLabelElement}}>
|
|
72
72
|
{% endif -%}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{%- from "moj/components/button-menu/macro.njk" import mojButtonMenu %}
|
|
2
2
|
{% from "govuk/macros/attributes.njk" import govukAttributes %}
|
|
3
|
-
<div class="moj-identity-bar {{-
|
|
3
|
+
<div class="moj-identity-bar {{- " " + params.classes if params.classes}}" {{- govukAttributes(params.attributes) -}}>
|
|
4
4
|
<div class="moj-identity-bar__container">
|
|
5
5
|
<div class="moj-identity-bar__details">
|
|
6
6
|
{% if params.title %}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<div id="{{ params.id | default(
|
|
1
|
+
<div id="{{ params.id | default("messages") }}" class="moj-messages-container {{- " " + params.classes if params.classes}}" {%- if (params.label) %} aria-label="{{ params.label }}"{% endif %} {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
|
|
2
2
|
|
|
3
3
|
<div class="moj-message-list">
|
|
4
4
|
|
|
5
5
|
{%- for item in params.items %}
|
|
6
6
|
|
|
7
|
-
{%- if previous_timestamp != item.timestamp | mojDate(
|
|
7
|
+
{%- if previous_timestamp != item.timestamp | mojDate("date") %}
|
|
8
8
|
|
|
9
|
-
<time class="moj-message-list__date" datetime="{{ item.timestamp | mojDate(
|
|
10
|
-
{{- item.timestamp | mojDate(
|
|
9
|
+
<time class="moj-message-list__date" datetime="{{ item.timestamp | mojDate("date") }}">
|
|
10
|
+
{{- item.timestamp | mojDate("date") -}}
|
|
11
11
|
</time>
|
|
12
12
|
|
|
13
13
|
{% endif -%}
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
{{- item.html | safe if item.html else item.text -}}
|
|
18
18
|
</div>
|
|
19
19
|
<div class="moj-message-item__meta">
|
|
20
|
-
<span class="moj-message-item__meta--sender">{{ item.sender }}</span> at <time class="moj-message-item__meta--timestamp" datetime="{{ item.timestamp | mojDate(
|
|
20
|
+
<span class="moj-message-item__meta--sender">{{ item.sender }}</span> at <time class="moj-message-item__meta--timestamp" datetime="{{ item.timestamp | mojDate("time") }}">{{ item.timestamp | mojDate("time") }}</time>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
|
|
24
|
-
{%- set previous_timestamp = item.timestamp | mojDate(
|
|
24
|
+
{%- set previous_timestamp = item.timestamp | mojDate("date") -%}
|
|
25
25
|
|
|
26
26
|
{% endfor -%}
|
|
27
27
|
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
this.defaultParams = {
|
|
28
|
-
uploadFileEntryHook:
|
|
29
|
-
uploadFileExitHook:
|
|
30
|
-
uploadFileErrorHook:
|
|
31
|
-
fileDeleteHook:
|
|
28
|
+
uploadFileEntryHook: $.noop,
|
|
29
|
+
uploadFileExitHook: $.noop,
|
|
30
|
+
uploadFileErrorHook: $.noop,
|
|
31
|
+
fileDeleteHook: $.noop,
|
|
32
32
|
uploadStatusText: 'Uploading files, please wait',
|
|
33
33
|
dropzoneHintText: 'Drag and drop files here or',
|
|
34
34
|
dropzoneButtonText: 'Choose files'
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
this.params =
|
|
38
|
-
this.container =
|
|
37
|
+
this.params = $.extend({}, this.defaultParams, params);
|
|
38
|
+
this.container = $(this.params.container);
|
|
39
39
|
|
|
40
40
|
this.container.addClass('moj-multi-file-upload--enhanced');
|
|
41
41
|
|
|
@@ -49,20 +49,20 @@
|
|
|
49
49
|
this.container.on(
|
|
50
50
|
'click',
|
|
51
51
|
'.moj-multi-file-upload__delete',
|
|
52
|
-
|
|
52
|
+
$.proxy(this, 'onFileDeleteClick')
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
MultiFileUpload.prototype.setupDropzone = function () {
|
|
57
57
|
this.fileInput.wrap('<div class="moj-multi-file-upload__dropzone" />');
|
|
58
58
|
this.dropzone = this.container.find('.moj-multi-file-upload__dropzone');
|
|
59
|
-
this.dropzone.on('dragover',
|
|
60
|
-
this.dropzone.on('dragleave',
|
|
61
|
-
this.dropzone.on('drop',
|
|
59
|
+
this.dropzone.on('dragover', $.proxy(this, 'onDragOver'));
|
|
60
|
+
this.dropzone.on('dragleave', $.proxy(this, 'onDragLeave'));
|
|
61
|
+
this.dropzone.on('drop', $.proxy(this, 'onDrop'));
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
MultiFileUpload.prototype.setupLabel = function () {
|
|
65
|
-
this.label =
|
|
65
|
+
this.label = $(
|
|
66
66
|
`<label for="${this.fileInput[0].id}" class="govuk-button govuk-button--secondary">${this.params.dropzoneButtonText}</label>`
|
|
67
67
|
);
|
|
68
68
|
this.dropzone.append(
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
|
|
74
74
|
MultiFileUpload.prototype.setupFileInput = function () {
|
|
75
75
|
this.fileInput = this.container.find('.moj-multi-file-upload__input');
|
|
76
|
-
this.fileInput.on('change',
|
|
77
|
-
this.fileInput.on('focus',
|
|
78
|
-
this.fileInput.on('blur',
|
|
76
|
+
this.fileInput.on('change', $.proxy(this, 'onFileChange'));
|
|
77
|
+
this.fileInput.on('focus', $.proxy(this, 'onFileFocus'));
|
|
78
|
+
this.fileInput.on('blur', $.proxy(this, 'onFileBlur'));
|
|
79
79
|
};
|
|
80
80
|
|
|
81
81
|
MultiFileUpload.prototype.setupStatusBox = function () {
|
|
82
|
-
this.status =
|
|
82
|
+
this.status = $(
|
|
83
83
|
'<div aria-live="polite" role="status" class="govuk-visually-hidden" />'
|
|
84
84
|
);
|
|
85
85
|
this.dropzone.append(this.status);
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
this.feedbackContainer.removeClass('moj-hidden');
|
|
113
113
|
this.status.html(this.params.uploadStatusText);
|
|
114
114
|
this.uploadFiles(e.currentTarget.files);
|
|
115
|
-
this.fileInput.replaceWith(
|
|
115
|
+
this.fileInput.replaceWith($(e.currentTarget).val('').clone(true));
|
|
116
116
|
this.setupFileInput();
|
|
117
117
|
this.fileInput.get(0).focus();
|
|
118
118
|
};
|
|
@@ -153,18 +153,18 @@
|
|
|
153
153
|
|
|
154
154
|
MultiFileUpload.prototype.uploadFile = function (file) {
|
|
155
155
|
this.params.uploadFileEntryHook(this, file);
|
|
156
|
-
const item =
|
|
156
|
+
const item = $(this.getFileRowHtml(file));
|
|
157
157
|
const formData = new FormData();
|
|
158
158
|
formData.append('documents', file);
|
|
159
159
|
this.feedbackContainer.find('.moj-multi-file-upload__list').append(item);
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
$.ajax({
|
|
162
162
|
url: this.params.uploadUrl,
|
|
163
163
|
type: 'post',
|
|
164
164
|
data: formData,
|
|
165
165
|
processData: false,
|
|
166
166
|
contentType: false,
|
|
167
|
-
success:
|
|
167
|
+
success: $.proxy(function (response) {
|
|
168
168
|
if (response.error) {
|
|
169
169
|
item
|
|
170
170
|
.find('.moj-multi-file-upload__message')
|
|
@@ -181,7 +181,7 @@
|
|
|
181
181
|
.append(this.getDeleteButtonHtml(response.file));
|
|
182
182
|
this.params.uploadFileExitHook(this, file, response);
|
|
183
183
|
}, this),
|
|
184
|
-
error:
|
|
184
|
+
error: $.proxy(function (jqXHR, textStatus, errorThrown) {
|
|
185
185
|
this.params.uploadFileErrorHook(
|
|
186
186
|
this,
|
|
187
187
|
file,
|
|
@@ -212,15 +212,15 @@
|
|
|
212
212
|
|
|
213
213
|
MultiFileUpload.prototype.onFileDeleteClick = function (e) {
|
|
214
214
|
e.preventDefault(); // if user refreshes page and then deletes
|
|
215
|
-
const button =
|
|
215
|
+
const button = $(e.currentTarget);
|
|
216
216
|
const data = {};
|
|
217
217
|
data[button[0].name] = button[0].value;
|
|
218
|
-
|
|
218
|
+
$.ajax({
|
|
219
219
|
url: this.params.deleteUrl,
|
|
220
220
|
type: 'post',
|
|
221
221
|
dataType: 'json',
|
|
222
222
|
data,
|
|
223
|
-
success:
|
|
223
|
+
success: $.proxy(function (response) {
|
|
224
224
|
if (response.error) ; else {
|
|
225
225
|
button.parents('.moj-multi-file-upload__row').remove();
|
|
226
226
|
if (
|
|
@@ -6,17 +6,17 @@ function MultiFileUpload(params) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
this.defaultParams = {
|
|
9
|
-
uploadFileEntryHook:
|
|
10
|
-
uploadFileExitHook:
|
|
11
|
-
uploadFileErrorHook:
|
|
12
|
-
fileDeleteHook:
|
|
9
|
+
uploadFileEntryHook: $.noop,
|
|
10
|
+
uploadFileExitHook: $.noop,
|
|
11
|
+
uploadFileErrorHook: $.noop,
|
|
12
|
+
fileDeleteHook: $.noop,
|
|
13
13
|
uploadStatusText: 'Uploading files, please wait',
|
|
14
14
|
dropzoneHintText: 'Drag and drop files here or',
|
|
15
15
|
dropzoneButtonText: 'Choose files'
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
this.params =
|
|
19
|
-
this.container =
|
|
18
|
+
this.params = $.extend({}, this.defaultParams, params);
|
|
19
|
+
this.container = $(this.params.container);
|
|
20
20
|
|
|
21
21
|
this.container.addClass('moj-multi-file-upload--enhanced');
|
|
22
22
|
|
|
@@ -30,20 +30,20 @@ function MultiFileUpload(params) {
|
|
|
30
30
|
this.container.on(
|
|
31
31
|
'click',
|
|
32
32
|
'.moj-multi-file-upload__delete',
|
|
33
|
-
|
|
33
|
+
$.proxy(this, 'onFileDeleteClick')
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
MultiFileUpload.prototype.setupDropzone = function () {
|
|
38
38
|
this.fileInput.wrap('<div class="moj-multi-file-upload__dropzone" />');
|
|
39
39
|
this.dropzone = this.container.find('.moj-multi-file-upload__dropzone');
|
|
40
|
-
this.dropzone.on('dragover',
|
|
41
|
-
this.dropzone.on('dragleave',
|
|
42
|
-
this.dropzone.on('drop',
|
|
40
|
+
this.dropzone.on('dragover', $.proxy(this, 'onDragOver'));
|
|
41
|
+
this.dropzone.on('dragleave', $.proxy(this, 'onDragLeave'));
|
|
42
|
+
this.dropzone.on('drop', $.proxy(this, 'onDrop'));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
MultiFileUpload.prototype.setupLabel = function () {
|
|
46
|
-
this.label =
|
|
46
|
+
this.label = $(
|
|
47
47
|
`<label for="${this.fileInput[0].id}" class="govuk-button govuk-button--secondary">${this.params.dropzoneButtonText}</label>`
|
|
48
48
|
);
|
|
49
49
|
this.dropzone.append(
|
|
@@ -54,13 +54,13 @@ MultiFileUpload.prototype.setupLabel = function () {
|
|
|
54
54
|
|
|
55
55
|
MultiFileUpload.prototype.setupFileInput = function () {
|
|
56
56
|
this.fileInput = this.container.find('.moj-multi-file-upload__input');
|
|
57
|
-
this.fileInput.on('change',
|
|
58
|
-
this.fileInput.on('focus',
|
|
59
|
-
this.fileInput.on('blur',
|
|
57
|
+
this.fileInput.on('change', $.proxy(this, 'onFileChange'));
|
|
58
|
+
this.fileInput.on('focus', $.proxy(this, 'onFileFocus'));
|
|
59
|
+
this.fileInput.on('blur', $.proxy(this, 'onFileBlur'));
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
MultiFileUpload.prototype.setupStatusBox = function () {
|
|
63
|
-
this.status =
|
|
63
|
+
this.status = $(
|
|
64
64
|
'<div aria-live="polite" role="status" class="govuk-visually-hidden" />'
|
|
65
65
|
);
|
|
66
66
|
this.dropzone.append(this.status);
|
|
@@ -93,7 +93,7 @@ MultiFileUpload.prototype.onFileChange = function (e) {
|
|
|
93
93
|
this.feedbackContainer.removeClass('moj-hidden');
|
|
94
94
|
this.status.html(this.params.uploadStatusText);
|
|
95
95
|
this.uploadFiles(e.currentTarget.files);
|
|
96
|
-
this.fileInput.replaceWith(
|
|
96
|
+
this.fileInput.replaceWith($(e.currentTarget).val('').clone(true));
|
|
97
97
|
this.setupFileInput();
|
|
98
98
|
this.fileInput.get(0).focus();
|
|
99
99
|
};
|
|
@@ -134,18 +134,18 @@ MultiFileUpload.prototype.getDeleteButtonHtml = function (file) {
|
|
|
134
134
|
|
|
135
135
|
MultiFileUpload.prototype.uploadFile = function (file) {
|
|
136
136
|
this.params.uploadFileEntryHook(this, file);
|
|
137
|
-
const item =
|
|
137
|
+
const item = $(this.getFileRowHtml(file));
|
|
138
138
|
const formData = new FormData();
|
|
139
139
|
formData.append('documents', file);
|
|
140
140
|
this.feedbackContainer.find('.moj-multi-file-upload__list').append(item);
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
$.ajax({
|
|
143
143
|
url: this.params.uploadUrl,
|
|
144
144
|
type: 'post',
|
|
145
145
|
data: formData,
|
|
146
146
|
processData: false,
|
|
147
147
|
contentType: false,
|
|
148
|
-
success:
|
|
148
|
+
success: $.proxy(function (response) {
|
|
149
149
|
if (response.error) {
|
|
150
150
|
item
|
|
151
151
|
.find('.moj-multi-file-upload__message')
|
|
@@ -162,7 +162,7 @@ MultiFileUpload.prototype.uploadFile = function (file) {
|
|
|
162
162
|
.append(this.getDeleteButtonHtml(response.file));
|
|
163
163
|
this.params.uploadFileExitHook(this, file, response);
|
|
164
164
|
}, this),
|
|
165
|
-
error:
|
|
165
|
+
error: $.proxy(function (jqXHR, textStatus, errorThrown) {
|
|
166
166
|
this.params.uploadFileErrorHook(
|
|
167
167
|
this,
|
|
168
168
|
file,
|
|
@@ -193,15 +193,15 @@ MultiFileUpload.prototype.uploadFile = function (file) {
|
|
|
193
193
|
|
|
194
194
|
MultiFileUpload.prototype.onFileDeleteClick = function (e) {
|
|
195
195
|
e.preventDefault(); // if user refreshes page and then deletes
|
|
196
|
-
const button =
|
|
196
|
+
const button = $(e.currentTarget);
|
|
197
197
|
const data = {};
|
|
198
198
|
data[button[0].name] = button[0].value;
|
|
199
|
-
|
|
199
|
+
$.ajax({
|
|
200
200
|
url: this.params.deleteUrl,
|
|
201
201
|
type: 'post',
|
|
202
202
|
dataType: 'json',
|
|
203
203
|
data,
|
|
204
|
-
success:
|
|
204
|
+
success: $.proxy(function (response) {
|
|
205
205
|
if (response.error) ; else {
|
|
206
206
|
button.parents('.moj-multi-file-upload__row').remove();
|
|
207
207
|
if (
|