Skip to content

Commit

Permalink
Merge pull request #64 from IHIW/develop
Browse files Browse the repository at this point in the history
align branches for release 1.0.14
  • Loading branch information
cyt-as authored Feb 17, 2020
2 parents bd0039b + 5a527e9 commit d4f634b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.ihiw.management</groupId>
<artifactId>ihiw-management</artifactId>
<version>1.0.13</version>
<version>1.0.14</version>
<packaging>jar</packaging>
<name>Ihiw Management</name>

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/account/register/register.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ <h1 jhiTranslate="register.title">Registration</h1>
<div class="form-group" *ngIf="registerForm.get('existingLab').value === 'false'">
<label class="form-control-label" for="country" jhiTranslate="global.form.country.label">Country of your lab</label>
<select type="text" class="form-control" id="country" name="country" formControlName="country">
<option *ngFor="let country of countries" [value]="country" >
{{country}}
<option *ngFor="let country of countries" [value]="country[0]" >
{{country[1]}}
</option>
</select>
<div *ngIf="registerForm.get('country').invalid && (registerForm.get('country').dirty || registerForm.get('country').touched)">
Expand Down
14 changes: 11 additions & 3 deletions src/main/webapp/app/account/register/register.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class RegisterComponent implements OnInit, AfterViewInit {
errorUserExists: string;
success: boolean;
modalRef: NgbModalRef;
countries: string[] = [];
countries: [string, string][] = [];

registerForm = this.fb.group({
login: ['', [Validators.required, Validators.minLength(1), Validators.maxLength(50), Validators.pattern('^[_.@A-Za-z0-9-]*$')]],
Expand Down Expand Up @@ -59,10 +59,18 @@ export class RegisterComponent implements OnInit, AfterViewInit {
const lookup = require('country-code-lookup');
const countryLookup: any = lookup.countries;

this.countries = new Array(countryLookup.length);
this.countries = new Array<[string, string]>(countryLookup.length);
for (let i = 0, len = countryLookup.length; i < len; i++) {
this.countries[i] = countryLookup[i].country;
// initialize empty tuple
this.countries[i] = ['', ''];
// value used as value in the dropdown
this.countries[i][0] = countryLookup[i].country.toString();
// value used to sort, remove the 'The' at the beginning and put it at the end
this.countries[i][1] = countryLookup[i].country.replace(/^The (.+)$/i, '$1, The');
}

// sort the countries on the second value, without 'The'
this.countries.sort((a, b) => a[1].localeCompare(b[1]));
}

setRegistrationValidators() {
Expand Down

0 comments on commit d4f634b

Please sign in to comment.