Skip to content

Commit a1dcdf7

Browse files
Hieu Lam - TMAcweitat
andauthored
feature-8800: Revert UI for 2 field Consent Form Field & Consent Refu… (#8863)
* feature-8800: Revert UI for 2 field Consent Form Field & Consent Refund Policy * feature-8800: Make custom form question translatable by the organizer --------- Co-authored-by: cweitat <cweitat@gmail.com>
1 parent bb58832 commit a1dcdf7

File tree

6 files changed

+67
-28
lines changed

6 files changed

+67
-28
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ export default Component.extend(FormMixin, {
655655

656656
const customFields = orderBy(this.fields.toArray()?.filter(field => {
657657
const { isFixed, main_language } = field;
658-
658+
field.nameConvert = field.name;
659+
if (field.name === 'Consent of refund policy') {
660+
field.nameConvert = 'I agree to the terms of the refund policy of the event.';
661+
}
659662
if ((main_language && main_language.split('-')[0] === current_locale) || !field.translations || !field.translations.length) {
660663
field.transName = field.name;
661664
} else if (field.translations?.length) {

app/components/forms/wizard/custom-form-input-translation.hbs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
<div style="width: 30%">
2-
<Input type="text" placeholder={{t "Field Name"}} @value={{@data.name}}/>
3-
</div>
1+
{{#if (not-eq @type "number")}}
2+
<div style="width: 30%">
3+
<Input type="text" placeholder={{t "Field Name"}} @value={{@data.name}}/>
4+
</div>
5+
{{else}}
6+
<div style="width: 20%">
7+
<Input type="text" placeholder={{t "Field Name"}} @value={{@data.name}}/>
8+
</div>
9+
{{/if}}
410
<UiDropdown class="ui selection dropdown custom-form-dropdown-attendee"
511
@selected={{@data.selectedLang}}
612
@onChange={{action 'onChangeLanguage' }}>

app/components/forms/wizard/custom-form-input.hbs

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,13 @@
77
</div>
88
<div style="display: flex; flex-direction: column">
99
<div {{did-update this.updated @field}} class="ui action input main" style="width: inherit;">
10-
<div style="width: 30%">
11-
<Input type="text" placeholder={{t "Field Name"}} @value={{this.name}}/>
12-
</div>
1310
{{#if (eq this.type "number")}}
14-
<div class="ui action input input-attendee-custom-form">
15-
<Input
16-
@type="number"
17-
@name="min_price"
18-
placeholder={{t "Min"}}
19-
@value={{this.min}} />
11+
<div style="width: 20%">
12+
<Input type="text" placeholder={{t "Field Name"}} @value={{this.name}}/>
2013
</div>
21-
<div class="ui action input input-attendee-custom-form">
22-
<Input
23-
@type="number"
24-
@name="max_price"
25-
placeholder={{t "Max"}}
26-
@value={{this.max}} />
14+
{{else}}
15+
<div style="width: 30%">
16+
<Input type="text" placeholder={{t "Field Name"}} @value={{this.name}}/>
2717
</div>
2818
{{/if}}
2919
{{#if (eq @form 'attendee')}}
@@ -39,6 +29,22 @@
3929
</div>
4030
</UiDropdown>
4131
{{/if}}
32+
{{#if (eq this.type "number")}}
33+
<div class="ui action input input-attendee-custom-form" style="width: 8%;">
34+
<Input
35+
@type="number"
36+
@name="min_price"
37+
placeholder={{t "Min"}}
38+
@value={{this.min}} />
39+
</div>
40+
<div class="ui action input input-attendee-custom-form" style="width: 8%;">
41+
<Input
42+
@type="number"
43+
@name="max_price"
44+
placeholder={{t "Max"}}
45+
@value={{this.max}} />
46+
</div>
47+
{{/if}}
4248
<UiDropdown class="ui selection dropdown custom-form-dropdown-attendee" @selected={{this.type}} @onChange={{action (mut this.type)}}>
4349
<div class="default text">
4450
{{ this.type }}
@@ -67,6 +73,7 @@
6773
{{#unless sub.isDeleted }}
6874
<Forms::Wizard::CustomFormInputTranslation
6975
@data={{sub}}
76+
@type={{this.type}}
7077
@onRemoveTranslation={{action (mut sub.isDeleted) true}}
7178
@onChange={{action 'onChildChangeLanguage'}}
7279
/>

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,22 @@
7070
</div>
7171
{{/each}}
7272
{{else}}
73-
{{t-var field.name}}
73+
{{#if (eq field.fieldIdentifier 'is_consent_form_field')}}
74+
<span>{{ t 'I agree to the terms of the'}} </span>
75+
<a href="https://foundation.wikimedia.org/wiki/Policy:Universal_Code_of_Conduct">{{t 'Universal Code of Conduct'}} </a>
76+
<span> {{t 'and the'}} </span>
77+
<a href="https://foundation.wikimedia.org/wiki/Policy:Friendly_space_policy">{{t 'Friendly Space Policy'}}</a>
78+
<span> .</span>
79+
{{else}}
80+
{{t-var field.name}}
81+
{{/if}}
7482
{{#if field.isComplex}}
75-
<div class="ui icon d-inline" data-tooltip="Custom Field">
76-
<i class="info icon"></i>
77-
</div>
83+
<div class="ui icon d-inline" data-tooltip="Custom Field">
84+
<i class="info icon"></i>
85+
</div>
7886
{{/if}}
7987
{{/if}}
80-
</label>
88+
</label>
8189
</td>
8290
<td class="border center aligned">
8391
{{t-var field.type}}

app/templates/components/forms/orders/attendee-list.hbs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@
6868
<span class="word-break">{{sanitize (get holder field.identifierPath)}}</span>
6969
{{/if}}
7070
{{/if}}
71-
{{#if field.isComplex}}
72-
<span class="word-break">{{t (get holder.complexFieldValues field.fieldIdentifier)}}</span>
73-
{{/if}}
7471
</div>
7572
{{/if}}
7673
{{/if}}

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,25 @@
230230
@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."}}
231231
@checked={{holder.acceptVideoRecording}}
232232
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
233-
@onChange={{action (mut holder.acceptVideoRecording)}}/>
233+
@onChange={{action (mut holder.acceptVideoRecording)}}/>
234+
{{else if (eq field.fieldIdentifier 'is_consent_form_field')}}
235+
<UiCheckbox
236+
@checked={{get holder field.identifierPath}}
237+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
238+
@onChange={{action (mut (get holder field.identifierPath))}} />
239+
<span>{{t 'I agree to the terms of the'}} </span>
240+
<a href="https://foundation.wikimedia.org/wiki/Policy:Universal_Code_of_Conduct">{{t 'Universal Code of Conduct'}}</a>
241+
<span> {{t 'and the'}} </span>
242+
<a href="https://foundation.wikimedia.org/wiki/Policy:Friendly_space_policy">{{t 'Friendly Space Policy'}}</a>
243+
<span> .</span>
244+
{{else if (eq field.type 'checkbox')}}
245+
{{#if (and (not-eq field.fieldIdentifier "language_form_1") (not-eq field.fieldIdentifier "language_form_2"))}}
246+
<UiCheckbox
247+
@checked={{get holder field.identifierPath}}
248+
@name={{if field.isRequired (concat field.fieldIdentifier "_required_" index) (concat field.fieldIdentifier "_" index)}}
249+
@onChange={{action (mut (get holder field.identifierPath))}}/>
250+
{{t field.nameConvert}}
251+
{{/if}}
234252
{{/if}}
235253
{{#if (eq field.type 'year')}}
236254
<UiDropdown

0 commit comments

Comments
 (0)