Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make country as dropdown and add validation for gender #3809

Merged
merged 1 commit into from
Jan 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/components/forms/orders/order-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default Component.extend(FormMixin, {
rules: [
{
type : 'empty',
prompt : this.l10n.t('Please enter your country')
prompt : this.l10n.t('Please select your country')
}
]
};
Expand Down Expand Up @@ -379,7 +379,7 @@ export default Component.extend(FormMixin, {
rules : [
{
type : 'empty',
prompt : this.l10n.t('Please enter your country')
prompt : this.l10n.t('Please select your country')
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/custom-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export default Mixin.create(MutableArray, {
this.store.createRecord('custom-form', {
fieldIdentifier : 'country',
form : 'attendee',
type : 'text',
type : 'select',
isRequired : false,
isIncluded : false,
event : parent
Expand Down
2 changes: 2 additions & 0 deletions app/templates/components/forms/orders/attendee-list.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
</h4>
{{#if (is-input-field field.type) }}
<span>{{get holder field.fieldIdentifier}}</span>
{{else if (eq field.type 'select')}}
<span>{{get holder field.fieldIdentifier}}</span>
{{/if}}
</div>
{{/if}}
Expand Down
18 changes: 16 additions & 2 deletions app/templates/components/forms/orders/order-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
name=(if field.isRequired (concat field.fieldIdentifier '_required_' index) (concat field.fieldIdentifier '_' index))}}

{{/if}}
{{/if}}
{{#if (eq field.fieldIdentifier 'gender')}}
{{else if (eq field.fieldIdentifier 'gender')}}
{{#ui-dropdown class='search selection' value=(mut (get holder field.fieldIdentifier)) onChange=(action (mut holder.gender)) as |execute mapper|}}
{{input type='hidden' name=(if field.isRequired (concat field.fieldIdentifier '_required_' index) (concat field.fieldIdentifier '_' index))}}
<i class="dropdown icon"></i>
<div class="default text">{{t 'Select your gender'}}</div>
<div class="menu">
Expand All @@ -76,6 +76,20 @@
{{/each}}
</div>
{{/ui-dropdown}}
{{else if (eq field.fieldIdentifier 'country')}}
{{#ui-dropdown class='search selection' value=(mut (get holder field.fieldIdentifier)) onChange=(action (mut holder.country)) as |execute mapper|}}
{{input type='hidden' name=(if field.isRequired (concat field.fieldIdentifier '_required_' index) (concat field.fieldIdentifier '_' index))}}
<i class="dropdown icon"></i>
<div class="default text">{{t 'Select your country'}}</div>
<div class="menu">
{{#each countries as |country|}}
<div class="item" data-value="{{map-value mapper country.name}}">
<i class="{{lowercase country.code}} flag"></i>
{{country.name}}
</div>
{{/each}}
</div>
{{/ui-dropdown}}
{{/if}}
</div>
{{/if}}
Expand Down