decide.nolog.cz/app/templates/components/poll-evaluation-summary.hbs
Jeldrik Hanschke 77afc0d9fa
remove implicit this usage in templates (#352)
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.
2020-01-18 12:17:06 +01:00

52 lines
1.3 KiB
Handlebars

<h2>
{{t "poll.evaluation.label"}}
</h2>
<p class="participants">
{{t "poll.evaluation.participants" count=this.participantsCount}}
</p>
<p class="best-options">
{{#if @poll.isFindADate}}
{{t
"poll.evaluation.bestOption.label.findADate"
count=this.bestOptions.length
}}
{{else}}
{{t
"poll.evaluation.bestOption.label.makeAPoll"
count=this.bestOptions.length
}}
{{/if}}
{{#if this.multipleBestOptions}}
<ul>
{{#each this.bestOptions as |evaluationBestOption|}}
<li>
<PollEvaluationSummaryOption
@currentLocale={{this.currentLocale}}
@evaluationBestOption={{evaluationBestOption}}
@isFindADate={{@poll.isFindADate}}
@momentLongDayFormat={{@momentLongDayFormat}}
@timezone={{@timezone}}
/>
</li>
{{/each}}
</ul>
{{else}}
<PollEvaluationSummaryOption
@currentLocale={{this.currentLocale}}
@evaluationBestOption={{this.bestOptions.firstObject}}
@isFindADate={{@poll.isFindADate}}
@momentLongDayFormat={{@momentLongDayFormat}}
@timezone={{@timezone}}
/>
{{/if}}
</p>
<p class="last-participation">
{{t
"poll.evaluation.lastParticipation"
ago=(moment-from-now this.lastParticipationAt locale=this.currentLocale timezone=@timezone)
}}
</p>