decide.nolog.cz/app/components/poll-evaluation-summary-option.hbs
2023-11-04 14:54:30 +01:00

65 lines
No EOL
2 KiB
Handlebars

{{!
There must not be a line break between option text and "</strong>." cause otherwise
we will see a space between option string and following dot.
}}
{{!
Checking `@evaluationBestOption.option.jsDate` is the same as checking `@isFindADate`.
If poll type is `FindADate` we can be sure that every option is a valid ISO861
string. Therefore `Option.jsDate` must be `true` by design. But Glint / TypeScript
does not understand that. Therefore we need to use the less readable form.
}}
{{#if @evaluationBestOption.option.jsDate}}
<strong data-test-best-option={{@evaluationBestOption.option.title}}>
{{format-date
@evaluationBestOption.option.jsDate
dateStyle="full"
timeStyle=(if @evaluationBestOption.option.hasTime "short" undefined)
timeZone=(if @timeZone @timeZone undefined)
}}</strong>.
{{else}}
<strong
data-test-best-option={{@evaluationBestOption.option.title}}
>{{@evaluationBestOption.option.title}}</strong>.
{{/if}}
<br />
{{#if @isFindADate}}
{{#if @evaluationBestOption.answers.yes}}
{{t
"poll.evaluation.bestOptionParticipants.findADate.yes"
count=@evaluationBestOption.answers.yes
}}
{{/if}}
{{#if @evaluationBestOption.answers.maybe}}
{{t
"poll.evaluation.bestOptionParticipants.findADate.maybe"
count=@evaluationBestOption.answers.maybe
}}
{{/if}}
{{#if @evaluationBestOption.answers.no}}
{{t
"poll.evaluation.bestOptionParticipants.findADate.no"
count=@evaluationBestOption.answers.no
}}
{{/if}}
{{else}}
{{#if @evaluationBestOption.answers.yes}}
{{t
"poll.evaluation.bestOptionParticipants.makeAPoll.yes"
count=@evaluationBestOption.answers.yes
}}
{{/if}}
{{#if @evaluationBestOption.answers.maybe}}
{{t
"poll.evaluation.bestOptionParticipants.makeAPoll.maybe"
count=@evaluationBestOption.answers.maybe
}}
{{/if}}
{{#if @evaluationBestOption.answers.no}}
{{t
"poll.evaluation.bestOptionParticipants.makeAPoll.no"
count=@evaluationBestOption.answers.no
}}
{{/if}}
{{/if}}