Skip to content

Commit

Permalink
Dropping nationalities without labels from enum clientside. Refs #191
Browse files Browse the repository at this point in the history
  • Loading branch information
Yomguithereal committed Jan 23, 2017
1 parent 7273d1e commit 14c99a3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Expand Up @@ -162,7 +162,12 @@ export class IsariMultiSelectComponent implements OnInit {
}

private findOption(item) {
return this.options.find(option => (option.value && option.value === item.value) || (option.id && option.id === item.id));
return this.options.find(option => {
return (
(option.value && option.value === item.value) ||
(option.id && option.id === item.id)
);
});
}

private setExtend() {
Expand Down
15 changes: 14 additions & 1 deletion client/src/app/isari-data.service.ts
Expand Up @@ -562,7 +562,20 @@ export class IsariDataService {
}

const url = `${this.enumUrl}/${src}`;
let $enum = this.http.get(url).map(response => response.json())
let $enum = this.http.get(url)
.map(response => {
let json = response.json();

// NOTE: this is a dirty special case for nationalities.
// Might be generic one day...
if (src === 'nationalities') {
json = json.filter(item => {
return !!item.label.fr;
});
}

return json;
})
.publishReplay(1)
.refCount();
this.enumsCache[src] = $enum;
Expand Down

0 comments on commit 14c99a3

Please sign in to comment.