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

feat(data-uploads): Dropdown for filtering forms should contain form.title #3763

Closed
Closed
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
2 changes: 1 addition & 1 deletion editor/src/app/groups/responses/responses.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div id="filter" *ngIf="!hideFilterBy">
<tangy-select name="form" label="Filter by form" (change)="filterByForm($event)">
<option value="*">*</option>
<option *ngFor="let form of forms" value="{{form.id}}">{{form.id}}</option>
<option *ngFor="let form of forms" value="{{form.id}}">{{form.title}}</option>
</tangy-select>
</div>
<div>
Expand Down
14 changes: 13 additions & 1 deletion editor/src/app/groups/responses/responses.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,19 @@ export class ResponsesComponent implements OnInit {

async ngOnInit() {
this.forms = (await this.tangerineFormsService.getFormsInfo(this.groupId))
.filter(formInfo => !this.excludeForms.includes(formInfo.id) )
.filter(formInfo => !this.excludeForms.includes(formInfo.id) ).map(formInfo => {
if(!formInfo.title){
formInfo.title = formInfo.id
return formInfo
}
if(!formInfo.title.includes('t-lang')) return formInfo;
if(formInfo.title.includes('t-lang')) {
const titleDomString = new DOMParser().parseFromString(formInfo.title, 'text/html')
const formTitleEnglish = titleDomString.querySelector('t-lang[en]')
formInfo.title = formTitleEnglish ? formTitleEnglish.textContent : titleDomString.querySelector('t-lang').textContent
return formInfo
}
})
await this.getResponses()
this.ready = true;
this.onSearch$
Expand Down