77afc0d9fa
This refactors references to values in templates from `{{foo}}` to either `{{this.foo}}` if it's a property of backing JavaScript class or `{{@foo}}` if it's passed in on invocation. You could find more details on this change in Ember docs: - [required `this` in templates](https://guides.emberjs.com/release/upgrading/current-edition/templates/#toc_required-this-in-templates) - [named arguments](https://guides.emberjs.com/release/upgrading/current-edition/templates/#toc_named-arguments) While doing this I noticed that `<PollEvaluationSummaryOption>` component could be easily refactored to a template-only component. Done it as part of this pull request even so it's technically not related.
67 lines
No EOL
1.8 KiB
Handlebars
67 lines
No EOL
1.8 KiB
Handlebars
<div class="participants-table">
|
|
<table
|
|
class="table"
|
|
data-test-table-of="participants"
|
|
>
|
|
<thead>
|
|
{{#if this.hasTimes}}
|
|
<tr>
|
|
<th>
|
|
{{!-- column for name --}}
|
|
</th>
|
|
{{#each this.optionsGroupedByDays as |optionGroup|}}
|
|
<th colspan={{optionGroup.items.length}}>
|
|
{{moment-format optionGroup.value @momentLongDayFormat}}
|
|
</th>
|
|
{{/each}}
|
|
</tr>
|
|
{{/if}}
|
|
|
|
<tr>
|
|
<th>
|
|
{{!-- column for name --}}
|
|
</th>
|
|
{{#each this.options as |option|}}
|
|
<th>
|
|
{{#if (and this.isFindADate this.hasTimes)}}
|
|
{{#if option.hasTime}}
|
|
{{moment-format option.date "LT"}}
|
|
{{/if}}
|
|
{{else if this.isFindADate}}
|
|
{{moment-format option.date @momentLongDayFormat}}
|
|
{{else}}
|
|
{{option.title}}
|
|
{{/if}}
|
|
</th>
|
|
{{/each}}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
{{#each this.usersSorted as |user|}}
|
|
<tr data-test-participant={{user.id}}>
|
|
<td
|
|
data-test-value-for="name"
|
|
>
|
|
{{user.name}}
|
|
</td>
|
|
{{#each this.options as |option index|}}
|
|
{{#let (object-at index user.selections) as |selection|}}
|
|
<td
|
|
class={{selection.type}}
|
|
data-test-is-selection-cell
|
|
data-test-value-for={{option.value}}
|
|
>
|
|
{{#if selection.labelTranslation}}
|
|
{{t selection.labelTranslation}}
|
|
{{else}}
|
|
{{selection.label}}
|
|
{{/if}}
|
|
</td>
|
|
{{/let}}
|
|
{{/each}}
|
|
</tr>
|
|
{{/each}}
|
|
</tbody>
|
|
</table>
|
|
</div> |