Skip to content

Commit c9cb8e4

Browse files
committed
Merge branch 'development'
2 parents 8e41504 + 2011e1e commit c9cb8e4

File tree

26 files changed

+3758
-2597
lines changed

26 files changed

+3758
-2597
lines changed

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

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,26 @@ 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+
472+
const isConsentOfRefundPolicyValidation = {
473+
optional : true,
474+
rules : [
475+
{
476+
type : 'regExp',
477+
value : compulsoryProtocolValidUrlPattern,
478+
prompt : this.l10n.t('Please consent to the Refund Policy.')
479+
}
480+
]
481+
};
482+
463483
const languageForm1Validation = {
464484
rules: [
465485
{
@@ -599,6 +619,8 @@ export default Component.extend(FormMixin, {
599619
validationRules.fields[`instagram_required_${ index}`] = instagramRequiredValidation;
600620
validationRules.fields[`linkedin_${ index}`] = linkedinValidation;
601621
validationRules.fields[`linkedin_required_${ index}`] = linkedinRequiredValidation;
622+
validationRules.fields[`is_consent_of_refund_policy_required_${ index}`] = isConsentOfRefundPolicyValidation;
623+
validationRules.fields[`is_consent_form_field_${ index}`] = isConsentFormFieldValidation;
602624
validationRules.fields[`language_form_1_required_${ index}`] = languageForm1Validation;
603625
validationRules.fields[`language_form_2_required_${ index}`] = languageForm2Validation;
604626
this.allFields.attendee.filter(field => field.isComplex && field.isRequired).forEach(field => {
@@ -617,16 +639,28 @@ export default Component.extend(FormMixin, {
617639
},
618640

619641
allFields: computed('fields', function() {
620-
const requiredFixed = this.fields.toArray()?.filter(field => field.isFixed);
621-
const customFields = orderBy(this.fields.toArray()?.filter(field => !field.isFixed), ['position']);
642+
let customFields = [];
643+
const requiredFixed = [];
644+
this.fields.forEach(field => {
645+
if (field.isFixed) {
646+
requiredFixed.push(field);
647+
} else {
648+
customFields.push(field);
649+
}
650+
field.nameConvert = field.name;
651+
if (field.name === 'Consent of refund policy') {
652+
field.nameConvert = 'I agree to the terms of the refund policy of the event.';
653+
}
654+
});
655+
customFields = orderBy(customFields, ['position']);
622656
return groupBy(requiredFixed.concat(customFields), field => field.get('form'));
623657
}),
624658

625659
genders : orderBy(genders, 'name'),
626660
ageGroups : orderBy(ageGroups, 'position'),
627661
countries : orderBy(countries, 'name'),
628662
years : orderBy(years, 'year'),
629-
languageForms : orderBy(languageForms, 'item'),
663+
languageForms : orderBy(languageForms, 'name'),
630664
homeWikis : orderBy(homeWikis, 'item'),
631665

632666
actions: {

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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,28 @@ export default Mixin.create(MutableArray, {
660660
isIncluded : false,
661661
isPublic : false,
662662
event : parent
663+
}),
664+
this.store.createRecord('custom-form', {
665+
name : 'Consent of refund policy',
666+
fieldIdentifier : 'is_consent_of_refund_policy',
667+
formID : _formID,
668+
form : 'attendee',
669+
type : 'checkbox',
670+
isRequired : false,
671+
isIncluded : false,
672+
isPublic : false,
673+
event : parent
674+
}),
675+
this.store.createRecord('custom-form', {
676+
name : 'Consent form field',
677+
fieldIdentifier : 'is_consent_form_field',
678+
formID : _formID,
679+
form : 'attendee',
680+
type : 'checkbox',
681+
isRequired : false,
682+
isIncluded : false,
683+
isPublic : false,
684+
event : parent
663685
})
664686
];
665687
}

app/models/attendee.js

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,45 @@ 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+
is_consent_of_refund_policy : attr('boolean', { defaultValue: false }),
45+
language_form_1 : attr('string'),
46+
language_form_2 : attr('string'),
47+
home_wiki : attr('string'),
48+
is_consent_form_field : attr('boolean', { defaultValue: false }),
4749

4850
/**
4951
* Relationships

app/models/custom-form.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,36 @@ 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+
isConsentOfRefundPolicy : tn.t('Consent of refund policy'),
111+
homeWiki : tn.t('What is your home wiki'),
112+
languageForm1 : tn.t('What is your native language, or what language are you most fluent in?'),
113+
languageForm2 : tn.t('Are you fluent in any other of the following languages?'),
114+
is_consent_form_field : tn.t('Consent form field')
113115
},
114116

115117
ready() {

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,53 @@
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>
228+
{{else if (eq field.type 'checkbox')}}
229+
{{#if (and (not-eq field.fieldIdentifier "language_form_1") (not-eq field.fieldIdentifier "language_form_2"))}}
230+
<UiCheckbox
231+
@checked={{get holder field.identifierPath}}
232+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
233+
@onChange={{action (mut (get holder field.identifierPath))}}/>
234+
{{t field.nameConvert}}
235+
{{/if}}
236+
{{/if}}
237+
{{#if (eq field.type 'year')}}
238+
<UiDropdown
239+
@class="search selection"
240+
@selected={{mut (get holder field.identifierPath)}}
241+
@onChange={{action (mut holder.year)}}>
242+
<Input
243+
@type="hidden"
244+
@value={{get holder field.identifierPath}}
245+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}} />
246+
<i class="dropdown icon"></i>
247+
<div class="default text">{{t 'Select your year'}}</div>
248+
<div class="menu">
249+
{{#each this.years as |years|}}
250+
<div class="item" data-value="{{@years.year}}">
251+
{{years.year}}
252+
</div>
253+
{{/each}}
254+
</div>
255+
</UiDropdown>
256+
{{/if}}
257+
{{#if (or (eq field.fieldIdentifier "language_form_1") (eq field.fieldIdentifier "language_form_2"))}}
258+
<Widgets::Forms::UiCheckboxGroup
259+
@options={{languageForms}}
260+
@onChange={{action "updateLanguageFormsSelection"}}
261+
@holder={{holder}}
262+
@field={{field}}
263+
/>
218264
{{/if}}
219265
{{#if (eq field.type 'year')}}
220266
<UiDropdown

0 commit comments

Comments
 (0)