Skip to content

Commit 4f07a7f

Browse files
Hieu Lam - TMAkhangonodkhang
authored
feature-8790: Add consent form field to attendee form (#8813)
* feature-8790: Add consent form field to attendee form * feature-8790: Add consent form field to attendee form * feature-8790: Add consent form field to attendee form * feature-8790: Merge code development * feature-8790: Add translate --------- Co-authored-by: Khang On - TMA <[email protected]> Co-authored-by: khangon <[email protected]>
1 parent 0347991 commit 4f07a7f

File tree

26 files changed

+530
-67
lines changed

26 files changed

+530
-67
lines changed

app/components/forms/orders/order-form.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,15 @@ export default Component.extend(FormMixin, {
460460
]
461461
};
462462

463+
const isConsentFormFieldValidation = {
464+
rules: [
465+
{
466+
type : 'empty',
467+
prompt : this.l10n.t('Please enter Consent form field.')
468+
}
469+
]
470+
};
471+
463472
const languageForm1Validation = {
464473
rules: [
465474
{
@@ -599,6 +608,7 @@ export default Component.extend(FormMixin, {
599608
validationRules.fields[`instagram_required_${ index}`] = instagramRequiredValidation;
600609
validationRules.fields[`linkedin_${ index}`] = linkedinValidation;
601610
validationRules.fields[`linkedin_required_${ index}`] = linkedinRequiredValidation;
611+
validationRules.fields[`is_consent_form_field_${ index}`] = isConsentFormFieldValidation;
602612
validationRules.fields[`language_form_1_required_${ index}`] = languageForm1Validation;
603613
validationRules.fields[`language_form_2_required_${ index}`] = languageForm2Validation;
604614
this.allFields.attendee.filter(field => field.isComplex && field.isRequired).forEach(field => {

app/components/forms/wizard/custom-forms/table.hbs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@
5252
<DraggableObject @overrideClass="{{if field.isIncluded 'positive'}} table-row" @content={{field}} @isSortable={{true}}>
5353
<td class="{{if this.device.isMobile 'center' 'right'}} border right aligned">
5454
<label class="{{if field.isFixed 'required'}}">
55-
{{t-var field.name}}
55+
{{#if (eq field.fieldIdentifier 'is_consent_form_field')}}
56+
<span>{{ t 'I agree to the terms of the'}} </span>
57+
<a href="https://foundation.wikimedia.org/wiki/Policy:Universal_Code_of_Conduct">{{t 'Universal Code of Conduct'}} </a>
58+
<span> {{t 'and the'}} </span>
59+
<a href="https://foundation.wikimedia.org/wiki/Policy:Friendly_space_policy">{{t 'Friendly Space Policy'}}</a>
60+
<span> .</span>
61+
{{else}}
62+
{{t-var field.name}}
63+
{{/if}}
5664
{{#if field.isComplex}}
5765
<div class="ui icon d-inline" data-tooltip="Custom Field">
5866
<i class="info icon"></i>

app/mixins/custom-form.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,17 @@ export default Mixin.create(MutableArray, {
660660
isIncluded : false,
661661
isPublic : false,
662662
event : parent
663+
}),
664+
this.store.createRecord('custom-form', {
665+
name : 'Consent form field',
666+
fieldIdentifier : 'is_consent_form_field',
667+
formID : _formID,
668+
form : 'attendee',
669+
type : 'select',
670+
isRequired : false,
671+
isIncluded : false,
672+
isPublic : false,
673+
event : parent
663674
})
664675
];
665676
}

app/models/attendee.js

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,44 @@ export default ModelBase.extend({
77
/**
88
* Attributes
99
*/
10-
city : attr('string'),
11-
firstname : attr('string'),
12-
lastname : attr('string'),
13-
isCheckedIn : attr('boolean', { defaultValue: false }),
14-
checkinTimes : attr('string'),
15-
checkoutTimes : attr('string'),
16-
state : attr('string'),
17-
address : attr('string'),
18-
pdfUrl : attr('string'),
19-
country : attr('string'),
20-
email : attr('string'),
21-
jobTitle : attr('string'),
22-
phone : attr('string'),
23-
company : attr('string'),
24-
taxBusinessInfo : attr('string'),
25-
billingAddress : attr('string'),
26-
homeAddress : attr('string'),
27-
shippingAddress : attr('string'),
28-
workAddress : attr('string'),
29-
workPhone : attr('string'),
30-
website : attr('string'),
31-
blog : attr('string'),
32-
twitter : attr('string'),
33-
facebook : attr('string'),
34-
github : attr('string'),
35-
instagram : attr('string'),
36-
linkedin : attr('string'),
37-
gender : attr('string'),
38-
ageGroup : attr('string'),
39-
acceptReceiveEmails : attr('boolean', { defaultValue: true }),
40-
acceptVideoRecording : attr('boolean', { defaultValue: true }),
41-
acceptShareDetails : attr('boolean', { defaultValue: true }),
42-
birthDate : attr('moment'),
43-
complexFieldValues : attr(),
44-
language_form_1 : attr('string'),
45-
language_form_2 : attr('string'),
46-
home_wiki : attr('string'),
10+
city : attr('string'),
11+
firstname : attr('string'),
12+
lastname : attr('string'),
13+
isCheckedIn : attr('boolean', { defaultValue: false }),
14+
checkinTimes : attr('string'),
15+
checkoutTimes : attr('string'),
16+
state : attr('string'),
17+
address : attr('string'),
18+
pdfUrl : attr('string'),
19+
country : attr('string'),
20+
email : attr('string'),
21+
jobTitle : attr('string'),
22+
phone : attr('string'),
23+
company : attr('string'),
24+
taxBusinessInfo : attr('string'),
25+
billingAddress : attr('string'),
26+
homeAddress : attr('string'),
27+
shippingAddress : attr('string'),
28+
workAddress : attr('string'),
29+
workPhone : attr('string'),
30+
website : attr('string'),
31+
blog : attr('string'),
32+
twitter : attr('string'),
33+
facebook : attr('string'),
34+
github : attr('string'),
35+
instagram : attr('string'),
36+
linkedin : attr('string'),
37+
gender : attr('string'),
38+
ageGroup : attr('string'),
39+
acceptReceiveEmails : attr('boolean', { defaultValue: true }),
40+
acceptVideoRecording : attr('boolean', { defaultValue: true }),
41+
acceptShareDetails : attr('boolean', { defaultValue: true }),
42+
birthDate : attr('moment'),
43+
complexFieldValues : attr(),
44+
language_form_1 : attr('string'),
45+
language_form_2 : attr('string'),
46+
home_wiki : attr('string'),
47+
is_consent_form_field : attr('boolean', { defaultValue: false }),
4748

4849
/**
4950
* Relationships

app/models/custom-form.js

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,35 @@ export default ModelBase.extend({
8282
speaker: SPEAKER_FORM_FIELDS,
8383

8484
attendee: {
85-
firstname : tn.t('First Name'),
86-
lastname : tn.t('Last Name'),
87-
email : tn.t('Email'),
88-
address : tn.t('Address (Street, Building, Number etc.)'),
89-
city : tn.t('City'),
90-
state : tn.t('State'),
91-
country : tn.t('Country'),
92-
jobTitle : tn.t('Job Title'),
93-
phone : tn.t('Phone'),
94-
taxBusinessInfo : tn.t('Tax Business Info'),
95-
company : tn.t('Organisation'),
96-
workPhone : tn.t('Work Phone'),
97-
website : tn.t('Website'),
98-
blog : tn.t('Blog'),
99-
twitter : tn.t('Twitter'),
100-
facebook : tn.t('Facebook'),
101-
github : tn.t('GitHub'),
102-
instagram : tn.t('Instagram'),
103-
linkedin : tn.t('LinkedIn'),
104-
mastodon : tn.t('Mastodon'),
105-
gender : tn.t('Gender'),
106-
acceptReceiveEmails : tn.t('Email consent'),
107-
acceptVideoRecording : tn.t('Photo & video & text consent'),
108-
acceptShareDetails : tn.t('Partner contact consent'),
109-
ageGroup : tn.t('Age Group'),
110-
homeWiki : tn.t('What is your home wiki'),
111-
languageForm1 : tn.t('What is your native language, or what language are you most fluent in?'),
112-
languageForm2 : tn.t('Are you fluent in any other of the following languages?')
85+
firstname : tn.t('First Name'),
86+
lastname : tn.t('Last Name'),
87+
email : tn.t('Email'),
88+
address : tn.t('Address (Street, Building, Number etc.)'),
89+
city : tn.t('City'),
90+
state : tn.t('State'),
91+
country : tn.t('Country'),
92+
jobTitle : tn.t('Job Title'),
93+
phone : tn.t('Phone'),
94+
taxBusinessInfo : tn.t('Tax Business Info'),
95+
company : tn.t('Organisation'),
96+
workPhone : tn.t('Work Phone'),
97+
website : tn.t('Website'),
98+
blog : tn.t('Blog'),
99+
twitter : tn.t('Twitter'),
100+
facebook : tn.t('Facebook'),
101+
github : tn.t('GitHub'),
102+
instagram : tn.t('Instagram'),
103+
linkedin : tn.t('LinkedIn'),
104+
mastodon : tn.t('Mastodon'),
105+
gender : tn.t('Gender'),
106+
acceptReceiveEmails : tn.t('Email consent'),
107+
acceptVideoRecording : tn.t('Photo & video & text consent'),
108+
acceptShareDetails : tn.t('Partner contact consent'),
109+
ageGroup : tn.t('Age Group'),
110+
homeWiki : tn.t('What is your home wiki'),
111+
languageForm1 : tn.t('What is your native language, or what language are you most fluent in?'),
112+
languageForm2 : tn.t('Are you fluent in any other of the following languages?'),
113+
is_consent_form_field : tn.t('Consent form field')
113114
},
114115

115116
ready() {

app/templates/components/forms/orders/order-form.hbs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,17 @@
214214
@label={{t "I agree that the event organizer is allowed to take photo, video and/or audio recordings of me or my profile and also texts created by me in the chats which might be published on the event organizer's websites and/or social media channels."}}
215215
@checked={{holder.acceptVideoRecording}}
216216
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
217-
@onChange={{action (mut holder.acceptVideoRecording)}}/>
217+
@onChange={{action (mut holder.acceptVideoRecording)}}/>
218+
{{else if (eq field.fieldIdentifier 'is_consent_form_field')}}
219+
<UiCheckbox
220+
@checked={{get holder field.identifierPath}}
221+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
222+
@onChange={{action (mut (get holder field.identifierPath))}} />
223+
<span>{{t 'I agree to the terms of the'}} </span>
224+
<a href="https://foundation.wikimedia.org/wiki/Policy:Universal_Code_of_Conduct">{{t 'Universal Code of Conduct'}}</a>
225+
<span> {{t 'and the'}} </span>
226+
<a href="https://foundation.wikimedia.org/wiki/Policy:Friendly_space_policy">{{t 'Friendly Space Policy'}}</a>
227+
<span> .</span>
218228
{{/if}}
219229
{{#if (eq field.type 'year')}}
220230
<UiDropdown

translations/ar.po

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11650,10 +11650,31 @@ msgstr "Ո՞րն է ձեր տնային վիքին"
1165011650
#: app/templates/components/forms/orders/order-form.hbs:192:48
1165111651
msgid "Select your home wiki"
1165211652
msgstr "Ընտրեք ձեր տնային վիքին"
11653+
1165311654
#: app/models/custom-form.js:110:27
1165411655
msgid "What is your native language, or what language are you most fluent in?"
1165511656
msgstr ""
1165611657

1165711658
#: app/models/custom-form.js:111:27
1165811659
msgid "Are you fluent in any other of the following languages?"
1165911660
msgstr ""
11661+
11662+
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
11663+
msgid "I agree to the terms of the"
11664+
msgstr ""
11665+
11666+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11667+
msgid "and the"
11668+
msgstr ""
11669+
11670+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11671+
msgid "Universal Code of Conduct"
11672+
msgstr ""
11673+
11674+
#: app/components/forms/wizard/custom-forms/table.hbs:59:97
11675+
msgid "Friendly Space Policy"
11676+
msgstr ""
11677+
11678+
#: app/models/custom-form.js:113:28
11679+
msgid "Consent form field"
11680+
msgstr ""

translations/bn.po

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11649,10 +11649,31 @@ msgstr "আপনার হোম উইকি কি"
1164911649
#: app/templates/components/forms/orders/order-form.hbs:192:48
1165011650
msgid "Select your home wiki"
1165111651
msgstr "আপনার হোম উইকি নির্বাচন করুন"
11652+
1165211653
#: app/models/custom-form.js:110:27
1165311654
msgid "What is your native language, or what language are you most fluent in?"
1165411655
msgstr "আপনার মাতৃভাষা কি, বা আপনি কোন ভাষায় সবচেয়ে সাবলীল?"
1165511656

1165611657
#: app/models/custom-form.js:111:27
1165711658
msgid "Are you fluent in any other of the following languages?"
1165811659
msgstr "আপনি কি নিচের অন্য কোন ভাষায় পারদর্শী?"
11660+
11661+
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
11662+
msgid "I agree to the terms of the"
11663+
msgstr "আমি শর্তাবলী সম্মত"
11664+
11665+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11666+
msgid "and the"
11667+
msgstr "এবং"
11668+
11669+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11670+
msgid "Universal Code of Conduct"
11671+
msgstr "সর্বজনীন আচরণবিধি"
11672+
11673+
#: app/components/forms/wizard/custom-forms/table.hbs:59:97
11674+
msgid "Friendly Space Policy"
11675+
msgstr "বন্ধুত্বপূর্ণ মহাকাশ নীতি"
11676+
11677+
#: app/models/custom-form.js:113:28
11678+
msgid "Consent form field"
11679+
msgstr "সম্মতি ফর্ম ক্ষেত্র"

translations/de.po

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11664,10 +11664,31 @@ msgstr "Was ist Ihr Home-Wiki?"
1166411664
#: app/templates/components/forms/orders/order-form.hbs:192:48
1166511665
msgid "Select your home wiki"
1166611666
msgstr "Wählen Sie Ihr Heim-Wiki aus"
11667+
1166711668
#: app/models/custom-form.js:110:27
1166811669
msgid "What is your native language, or what language are you most fluent in?"
1166911670
msgstr "Was ist Ihre Muttersprache bzw. welche Sprache beherrschen Sie am besten?"
1167011671

1167111672
#: app/models/custom-form.js:111:27
1167211673
msgid "Are you fluent in any other of the following languages?"
1167311674
msgstr "Beherrschen Sie eine der folgenden Sprachen fließend?"
11675+
11676+
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
11677+
msgid "I agree to the terms of the"
11678+
msgstr "Ich stimme den Bedingungen zu"
11679+
11680+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11681+
msgid "and the"
11682+
msgstr "und das"
11683+
11684+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11685+
msgid "Universal Code of Conduct"
11686+
msgstr "Universeller Verhaltenskodex"
11687+
11688+
#: app/components/forms/wizard/custom-forms/table.hbs:59:97
11689+
msgid "Friendly Space Policy"
11690+
msgstr "Freundliche Weltraumpolitik"
11691+
11692+
#: app/models/custom-form.js:113:28
11693+
msgid "Consent form field"
11694+
msgstr "Feld „Einwilligungsformular“."

translations/de_DIVEO.po

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11649,10 +11649,32 @@ msgstr ""
1164911649

1165011650
#: app/templates/components/forms/orders/order-form.hbs:192:48
1165111651
msgid "Select your home wiki"
11652+
msgstr ""
11653+
1165211654
#: app/models/custom-form.js:110:27
1165311655
msgid "What is your native language, or what language are you most fluent in?"
1165411656
msgstr ""
1165511657

1165611658
#: app/models/custom-form.js:111:27
1165711659
msgid "Are you fluent in any other of the following languages?"
1165811660
msgstr ""
11661+
11662+
#: app/components/forms/wizard/custom-forms/table.hbs:56:25
11663+
msgid "I agree to the terms of the"
11664+
msgstr ""
11665+
11666+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11667+
msgid "and the"
11668+
msgstr ""
11669+
11670+
#: app/components/forms/wizard/custom-forms/table.hbs:58:25
11671+
msgid "Universal Code of Conduct"
11672+
msgstr ""
11673+
11674+
#: app/components/forms/wizard/custom-forms/table.hbs:59:97
11675+
msgid "Friendly Space Policy"
11676+
msgstr ""
11677+
11678+
#: app/models/custom-form.js:113:28
11679+
msgid "Consent form field"
11680+
msgstr ""

0 commit comments

Comments
 (0)