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.
This commit is contained in:
Jeldrik Hanschke 2020-01-18 12:17:06 +01:00 committed by GitHub
parent c9482786c1
commit 77afc0d9fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 201 additions and 197 deletions

View file

@ -1,5 +1,10 @@
'use strict'; 'use strict';
module.exports = { module.exports = {
extends: 'recommended' extends: 'recommended',
rules: {
'no-implicit-this': {
allow: ['scroll-first-invalid-element-into-view-port'],
},
},
}; };

View file

@ -1,5 +0,0 @@
import classic from 'ember-classic-decorator';
import Component from '@ember/component';
@classic
export default class PollEvaluationSummaryOption extends Component {}

View file

@ -17,7 +17,7 @@
<main role="main" class="container cr-main"> <main role="main" class="container cr-main">
<div id="messages"> <div id="messages">
{{#each flashMessages.queue as |flash|}} {{#each this.flashMessages.queue as |flash|}}
<FlashMessage @flash={{flash}}> <FlashMessage @flash={{flash}}>
{{t flash.message}} {{t flash.message}}
</FlashMessage> </FlashMessage>

View file

@ -17,17 +17,17 @@
<div class="row"> <div class="row">
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">
<InlineDatepicker <InlineDatepicker
@center={{calendarCenter}} @center={{this.calendarCenter}}
@selectedDays={{selectedDays}} @selectedDays={{this.selectedDays}}
@onCenterChange={{action (mut calendarCenter) value="moment"}} @onCenterChange={{action (mut this.calendarCenter) value="moment"}}
@onSelect={{action "daysSelected"}} @onSelect={{action "daysSelected"}}
/> />
</div> </div>
<div class="col-md-6 cr-hide-on-mobile"> <div class="col-md-6 cr-hide-on-mobile">
<InlineDatepicker <InlineDatepicker
@center={{calendarCenterNext}} @center={{this.calendarCenterNext}}
@selectedDays={{selectedDays}} @selectedDays={{this.selectedDays}}
@onCenterChange={{action (mut calendarCenter) value="moment"}} @onCenterChange={{action (mut this.calendarCenter) value="moment"}}
@onSelect={{action "daysSelected"}} @onSelect={{action "daysSelected"}}
/> />
</div> </div>

View file

@ -1,7 +1,7 @@
<div class="cr-form-wrapper box"> <div class="cr-form-wrapper box">
{{#if errorMessage}} {{#if this.errorMessage}}
<BsAlert type="warning"> <BsAlert type="warning">
{{t errorMessage}} {{t this.errorMessage}}
</BsAlert> </BsAlert>
{{/if}} {{/if}}
@ -14,14 +14,14 @@
as |form| as |form|
> >
<div class="days"> <div class="days">
{{#each dates as |date index|}} {{#each @dates as |date index|}}
{{! {{!
show summarized validation state for all times in a day show summarized validation state for all times in a day
}} }}
<div <div
class={{if class={{if
(get daysValidationState date.day) (get this.daysValidationState date.day)
(concat "label-has-" (get daysValidationState date.day)) (concat "label-has-" (get this.daysValidationState date.day))
"label-has-no-validation" "label-has-no-validation"
}} }}
data-test-day={{date.day}} data-test-day={{date.day}}
@ -35,7 +35,7 @@
Therefore we pass in array length if index is null. Cause index starting Therefore we pass in array length if index is null. Cause index starting
by zero there can't be any element with an index === array.length. by zero there can't be any element with an index === array.length.
}} }}
@invisibleLabel={{eq date.dayFormatted (get (object-at (if index (sub index 1) dates.length) dates) "dayFormatted")}} @invisibleLabel={{eq date.dayFormatted (get (object-at (if index (sub index 1) @dates.length) @dates) "dayFormatted")}}
@model={{date}} @model={{date}}
@property="time" @property="time"
class="option" class="option"
@ -77,7 +77,7 @@
@type="link" @type="link"
class="delete" class="delete"
{{! disable delete button if there is only one option }} {{! disable delete button if there is only one option }}
disabled={{lte dates.length 1}} disabled={{lte @dates.length 1}}
> >
<span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span> <span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span>
<span class="sr-only">{{t "create.options.button.delete.label"}}</span> <span class="sr-only">{{t "create.options.button.delete.label"}}</span>
@ -99,7 +99,7 @@
{{/each}} {{/each}}
</div> </div>
{{#if (gt groupedDates.length 1)}} {{#if (gt this.groupedDates.length 1)}}
<form.element> <form.element>
<BsButton <BsButton
@onClick={{action "adoptTimesOfFirstDay"}} @onClick={{action "adoptTimesOfFirstDay"}}

View file

@ -1,5 +1,5 @@
{{#let @form as |form|}} {{#let @form as |form|}}
{{#each options as |option index|}} {{#each @options as |option index|}}
<form.element <form.element
{{! show label only on first item }} {{! show label only on first item }}
@label={{unless index (t "create.options.options.label")}} @label={{unless index (t "create.options.options.label")}}
@ -22,7 +22,7 @@
@type="link" @type="link"
class="delete" class="delete"
{{! disable delete button if there is only one option }} {{! disable delete button if there is only one option }}
disabled={{lte options.length 1}} disabled={{lte @options.length 1}}
> >
<span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span> <span class="oi oi-trash" title={{t "create.options.button.delete.label"}} aria-hidden="true"></span>
<span class="sr-only">{{t "create.options.button.delete.label"}}</span> <span class="sr-only">{{t "create.options.button.delete.label"}}</span>

View file

@ -7,10 +7,10 @@
novalidate novalidate
as |form| as |form|
> >
{{#if isMakeAPoll}} {{#if this.isMakeAPoll}}
<CreateOptionsText @options={{options}} @form={{form}} /> <CreateOptionsText @options={{@options}} @form={{form}} />
{{else}} {{else}}
<CreateOptionsDates @options={{options}} @form={{form}} /> <CreateOptionsDates @options={{@options}} @form={{form}} />
{{/if}} {{/if}}
<div class="row cr-steps-bottom-nav"> <div class="row cr-steps-bottom-nav">

View file

@ -1,4 +1,4 @@
{{#each locales as |locale|}} {{#each this.locales as |locale|}}
<option value={{locale.id}} selected={{locale.selected}}> <option value={{locale.id}} selected={{locale.selected}}>
{{locale.text}} {{locale.text}}
</option> </option>

View file

@ -1 +1 @@
<EmberChart @type="bar" @data={{data}} @options={{chartOptions}} /> <EmberChart @type="bar" @data={{this.data}} @options={{this.chartOptions}} />

View file

@ -11,7 +11,7 @@
</th> </th>
{{#each this.optionsGroupedByDays as |optionGroup|}} {{#each this.optionsGroupedByDays as |optionGroup|}}
<th colspan={{optionGroup.items.length}}> <th colspan={{optionGroup.items.length}}>
{{moment-format optionGroup.value this.momentLongDayFormat}} {{moment-format optionGroup.value @momentLongDayFormat}}
</th> </th>
{{/each}} {{/each}}
</tr> </tr>
@ -28,7 +28,7 @@
{{moment-format option.date "LT"}} {{moment-format option.date "LT"}}
{{/if}} {{/if}}
{{else if this.isFindADate}} {{else if this.isFindADate}}
{{moment-format option.date this.momentLongDayFormat}} {{moment-format option.date @momentLongDayFormat}}
{{else}} {{else}}
{{option.title}} {{option.title}}
{{/if}} {{/if}}

View file

@ -2,59 +2,59 @@
There must not be a line break between option text and "</strong>." cause otherwise 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. we will see a space between option string and following dot.
--}} --}}
{{#if isFindADate}} {{#if @isFindADate}}
{{! Need to disable block indentation rule cause there shouldn't be a space between date and dot }} {{! Need to disable block indentation rule cause there shouldn't be a space between date and dot }}
{{! template-lint-disable block-indentation }} {{! template-lint-disable block-indentation }}
<strong class="best-option-value"> <strong class="best-option-value">
{{moment-format {{moment-format
evaluationBestOption.option.title @evaluationBestOption.option.title
(if evaluationBestOption.option.hasTime "LLLL" momentLongDayFormat) (if @evaluationBestOption.option.hasTime "LLLL" @momentLongDayFormat)
locale=currentLocale locale=@currentLocale
timeZone=timezone timeZone=@timezone
}}</strong>. }}</strong>.
{{! template-lint-enable block-indentation }} {{! template-lint-enable block-indentation }}
{{else}} {{else}}
<strong class="best-option-value">{{evaluationBestOption.option.title}}</strong>. <strong class="best-option-value">{{@evaluationBestOption.option.title}}</strong>.
{{/if}} {{/if}}
<br> <br>
{{#if isFindADate}} {{#if @isFindADate}}
{{#if evaluationBestOption.answers.yes}} {{#if @evaluationBestOption.answers.yes}}
{{t {{t
"poll.evaluation.bestOptionParticipants.findADate.yes" "poll.evaluation.bestOptionParticipants.findADate.yes"
count=evaluationBestOption.answers.yes count=@evaluationBestOption.answers.yes
}} }}
{{/if}} {{/if}}
{{#if evaluationBestOption.answers.maybe}} {{#if @evaluationBestOption.answers.maybe}}
{{t {{t
"poll.evaluation.bestOptionParticipants.findADate.maybe" "poll.evaluation.bestOptionParticipants.findADate.maybe"
count=evaluationBestOption.answers.maybe count=@evaluationBestOption.answers.maybe
}} }}
{{/if}} {{/if}}
{{#if evaluationBestOption.answers.no}} {{#if @evaluationBestOption.answers.no}}
{{t {{t
"poll.evaluation.bestOptionParticipants.findADate.no" "poll.evaluation.bestOptionParticipants.findADate.no"
count=evaluationBestOption.answers.no count=@evaluationBestOption.answers.no
}} }}
{{/if}} {{/if}}
{{else}} {{else}}
{{#if evaluationBestOption.answers.yes}} {{#if @evaluationBestOption.answers.yes}}
{{t {{t
"poll.evaluation.bestOptionParticipants.makeAPoll.yes" "poll.evaluation.bestOptionParticipants.makeAPoll.yes"
count=evaluationBestOption.answers.yes count=@evaluationBestOption.answers.yes
}} }}
{{/if}} {{/if}}
{{#if evaluationBestOption.answers.maybe}} {{#if @evaluationBestOption.answers.maybe}}
{{t {{t
"poll.evaluation.bestOptionParticipants.makeAPoll.maybe" "poll.evaluation.bestOptionParticipants.makeAPoll.maybe"
count=evaluationBestOption.answers.maybe count=@evaluationBestOption.answers.maybe
}} }}
{{/if}} {{/if}}
{{#if evaluationBestOption.answers.no}} {{#if @evaluationBestOption.answers.no}}
{{t {{t
"poll.evaluation.bestOptionParticipants.makeAPoll.no" "poll.evaluation.bestOptionParticipants.makeAPoll.no"
count=evaluationBestOption.answers.no count=@evaluationBestOption.answers.no
}} }}
{{/if}} {{/if}}
{{/if}} {{/if}}

View file

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

View file

@ -1,11 +1,11 @@
{{title (t "create.title")}} {{title (t "create.title")}}
<BsButtonGroup @justified={{true}} class="cr-steps-top-nav form-steps"> <BsButtonGroup @justified={{true}} class="cr-steps-top-nav form-steps">
{{#each formSteps as |formStep|}} {{#each this.formSteps as |formStep|}}
{{#unless formStep.hidden}} {{#unless formStep.hidden}}
<BsButton <BsButton
@onClick={{transition-to formStep.route}} @onClick={{transition-to formStep.route}}
@type={{if (eq router.currentRouteName formStep.route) "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName formStep.route) "primary is-active" "default"}}
disabled={{formStep.disabled}} disabled={{formStep.disabled}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >
@ -15,14 +15,14 @@
{{/each}} {{/each}}
<BsButton <BsButton
@onClick={{transition-to "create.index"}} @onClick={{transition-to "create.index"}}
@type={{if (eq router.currentRouteName "create.index") "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName "create.index") "primary is-active" "default"}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >
{{t "create.formStep.type"}} {{t "create.formStep.type"}}
</BsButton> </BsButton>
<BsButton <BsButton
@onClick={{transition-to "create.meta"}} @onClick={{transition-to "create.meta"}}
@type={{if (eq router.currentRouteName "create.meta") "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName "create.meta") "primary is-active" "default"}}
disabled={{not this.canEnterMetaStep}} disabled={{not this.canEnterMetaStep}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >
@ -30,7 +30,7 @@
</BsButton> </BsButton>
<BsButton <BsButton
@onClick={{transition-to "create.options"}} @onClick={{transition-to "create.options"}}
@type={{if (eq router.currentRouteName "create.options") "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName "create.options") "primary is-active" "default"}}
disabled={{not this.canEnterOptionsStep}} disabled={{not this.canEnterOptionsStep}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >
@ -43,7 +43,7 @@
{{#if this.isFindADate}} {{#if this.isFindADate}}
<BsButton <BsButton
@onClick={{transition-to "create.options-datetime"}} @onClick={{transition-to "create.options-datetime"}}
@type={{if (eq router.currentRouteName "create.options-datetime") "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName "create.options-datetime") "primary is-active" "default"}}
disabled={{not this.canEnterOptionsDatetimeStep}} disabled={{not this.canEnterOptionsDatetimeStep}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >
@ -52,7 +52,7 @@
{{/if}} {{/if}}
<BsButton <BsButton
@onClick={{transition-to "create.settings"}} @onClick={{transition-to "create.settings"}}
@type={{if (eq router.currentRouteName "create.settings") "primary is-active" "default"}} @type={{if (eq this.router.currentRouteName "create.settings") "primary is-active" "default"}}
disabled={{not this.canEnterSettingsStep}} disabled={{not this.canEnterSettingsStep}}
class="cr-steps-top-nav__button" class="cr-steps-top-nav__button"
> >

View file

@ -1,5 +1,5 @@
<CreateOptionsDatetime <CreateOptionsDatetime
@dates={{options}} @dates={{this.options}}
@onNextPage={{action "nextPage"}} @onNextPage={{action "nextPage"}}
@onPrevPage={{action "previousPage"}} @onPrevPage={{action "previousPage"}}
/> />

View file

@ -1,7 +1,7 @@
<CreateOptions <CreateOptions
@isFindADate={{model.isFindADate}} @isFindADate={{@model.isFindADate}}
@isMakeAPoll={{model.isMakeAPoll}} @isMakeAPoll={{@model.isMakeAPoll}}
@options={{model.options}} @options={{@model.options}}
@onPrevPage={{action "previousPage"}} @onPrevPage={{action "previousPage"}}
@onNextPage={{action "nextPage"}} @onNextPage={{action "nextPage"}}
/> />

View file

@ -21,7 +21,7 @@
id={{el.id}} id={{el.id}}
class="custom-select" class="custom-select"
> >
{{#each answerTypes as |answerType|}} {{#each this.answerTypes as |answerType|}}
<option value={{answerType.id}} selected={{eq el.value answerType.id}}> <option value={{answerType.id}} selected={{eq el.value answerType.id}}>
{{t answerType.labelTranslation}} {{t answerType.labelTranslation}}
</option> </option>
@ -42,7 +42,7 @@
onchange={{action (mut el.value) value="target.value"}} onchange={{action (mut el.value) value="target.value"}}
class="custom-select" class="custom-select"
> >
{{#each expirationDurations as |duration|}} {{#each this.expirationDurations as |duration|}}
<option value={{duration.id}} selected={{eq el.value duration.id}}> <option value={{duration.id}} selected={{eq el.value duration.id}}>
{{t duration.labelTranslation}} {{t duration.labelTranslation}}
</option> </option>

View file

@ -3,4 +3,4 @@ Add content you wish automatically added to the documents head
here. The 'model' available in this template can be populated by here. The 'model' available in this template can be populated by
setting values on the 'head-data' service. setting values on the 'head-data' service.
--}} --}}
<title>{{model.title}}</title> <title>{{this.model.title}}</title>

View file

@ -1,12 +1,12 @@
<div class="box"> <div class="box">
{{#if decryptionFailed}} {{#if this.decryptionFailed}}
<h2 data-test-error-type="decryption-failed"> <h2 data-test-error-type="decryption-failed">
{{t "error.poll.decryptionFailed.title"}} {{t "error.poll.decryptionFailed.title"}}
</h2> </h2>
<p> <p>
{{t "error.poll.decryptionFailed.description"}} {{t "error.poll.decryptionFailed.description"}}
</p> </p>
{{else if notFound}} {{else if this.notFound}}
<h2 data-test-error-type="not-found"> <h2 data-test-error-type="not-found">
{{t "error.poll.notFound.title"}} {{t "error.poll.notFound.title"}}
</h2> </h2>

View file

@ -1,92 +1,94 @@
{{title model.title}} {{#let @model as |poll|}}
{{title poll.title}}
<div id="poll"> <div id="poll">
<div class="row"> <div class="row">
<div class="col-sm-6 col-lg-5"> <div class="col-sm-6 col-lg-5">
<div class="box meta-data"> <div class="box meta-data">
<h2 class="title">{{model.title}}</h2> <h2 class="title">{{poll.title}}</h2>
<p class="description">{{model.description}}</p> <p class="description">{{poll.description}}</p>
<p class="dates"> <p class="dates">
<span class="creationDate"> <span class="creationDate">
{{t
"poll.created-date"
date=(moment-format model.creationDate "LLLL" locale=currentLocale)
}}
</span>
{{#if model.expirationDate}}
<br>
<span class="expirationDate">
{{t {{t
"poll.expiration-date" "poll.created-date"
date=(moment-format model.expirationDate "LLLL" locale=currentLocale) date=(moment-format poll.creationDate "LLLL" locale=this.currentLocale)
}} }}
</span> </span>
{{/if}} {{#if poll.expirationDate}}
</p> <br>
<span class="expirationDate">
{{t
"poll.expiration-date"
date=(moment-format poll.expirationDate "LLLL" locale=this.currentLocale)
}}
</span>
{{/if}}
</p>
</div>
</div> </div>
</div> <div class="col-sm-6 col-lg-6 offset-lg-1">
<div class="col-sm-6 col-lg-6 offset-lg-1"> <div class="box poll-link cr-poll-link">
<div class="box poll-link cr-poll-link"> <p>{{t "poll.share"}}</p>
<p>{{t "poll.share"}}</p> <p class="link cr-poll-link__link">
<p class="link cr-poll-link__link"> <small>
<small> <code class="cr-poll-link__url">{{this.pollUrl}}</code>
<code class="cr-poll-link__url">{{pollUrl}}</code> </small>
<CopyButton
@clipboardText={{this.pollUrl}}
@error={{action "linkAction" "selected"}}
@success={{action "linkAction" "copied"}}
class="btn btn-secondary cr-poll-link__copy-btn btn-sm"
>
{{t "poll.link.copy-label"}}&nbsp;
<span class="oi oi-clipboard" title={{t "poll.link.copy-label"}} aria-hidden="true"></span>
</CopyButton>
</p>
<small class="text-muted">
{{t "poll.share.notice"}}
</small> </small>
<CopyButton </div>
@clipboardText={{pollUrl}} </div>
@error={{action "linkAction" "selected"}} </div>
@success={{action "linkAction" "copied"}}
class="btn btn-secondary cr-poll-link__copy-btn btn-sm" {{#if this.showExpirationWarning}}
> <div class="row">
{{t "poll.link.copy-label"}}&nbsp; <div class="col-xs-12">
<span class="oi oi-clipboard" title={{t "poll.link.copy-label"}} aria-hidden="true"></span> <BsAlert @type="warning" class="expiration-warning">
</CopyButton> {{t
</p> "poll.expiration-date-warning"
<small class="text-muted"> timeToNow=(moment-from-now poll.expirationDate locale=this.currentLocale)
{{t "poll.share.notice"}} }}
</small> </BsAlert>
</div>
</div>
{{/if}}
<div class="box">
<ul class="nav nav-tabs" role="tablist">
<LinkTo @route="poll.participation" @model={{poll}} @tagName="li" @activeClass="active" class="participation nav-item">
<LinkTo @route="poll.participation" @model={{poll}} class="nav-link">
{{t "poll.tab-title.participation"}}
</LinkTo>
</LinkTo>
<LinkTo @route="poll.evaluation" @model={{poll}} @tagName="li" @activeClass="active" class="evaluation nav-item">
<LinkTo @route="poll.evaluation" @model={{poll}} class="nav-link">
{{t "poll.tab-title.evaluation"}}
</LinkTo>
</LinkTo>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active">
{{outlet}}
</div>
</div> </div>
</div> </div>
</div> </div>
{{/let}}
{{#if showExpirationWarning}}
<div class="row">
<div class="col-xs-12">
<BsAlert @type="warning" class="expiration-warning">
{{t
"poll.expiration-date-warning"
timeToNow=(moment-from-now model.expirationDate locale=currentLocale)
}}
</BsAlert>
</div>
</div>
{{/if}}
<div class="box">
<ul class="nav nav-tabs" role="tablist">
<LinkTo @route="poll.participation" @model={{model}} @tagName="li" @activeClass="active" class="participation nav-item">
<LinkTo @route="poll.participation" @model={{model}} class="nav-link">
{{t "poll.tab-title.participation"}}
</LinkTo>
</LinkTo>
<LinkTo @route="poll.evaluation" @model={{model}} @tagName="li" @activeClass="active" class="evaluation nav-item">
<LinkTo @route="poll.evaluation" @model={{model}} class="nav-link">
{{t "poll.tab-title.evaluation"}}
</LinkTo>
</LinkTo>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active">
{{outlet}}
</div>
</div>
</div>
</div>
<BsModal <BsModal
@title={{t "poll.modal.timezoneDiffers.title"}} @title={{t "poll.modal.timezoneDiffers.title"}}
@open={{mustChooseTimezone}} @open={{this.mustChooseTimezone}}
@footer={{false}} @footer={{false}}
@closeButton={{false}} @closeButton={{false}}
@keyboard={{false}} @keyboard={{false}}
@ -107,7 +109,7 @@
{{t "poll.modal.timezoneDiffers.button.useLocalTimezone"}} {{t "poll.modal.timezoneDiffers.button.useLocalTimezone"}}
</BsButton> </BsButton>
<BsButton <BsButton
@onClick={{action (mut timezoneChoosen) true}} @onClick={{action (mut this.timezoneChoosen) true}}
data-test-button="use-poll-timezone" data-test-button="use-poll-timezone"
> >
{{t "poll.modal.timezoneDiffers.button.usePollTimezone"}} {{t "poll.modal.timezoneDiffers.button.usePollTimezone"}}

View file

@ -1,21 +1,23 @@
{{#if isEvaluable}} {{#let @model as |poll|}}
<PollEvaluationSummary {{#if this.isEvaluable}}
@momentLongDayFormat={{momentLongDayFormat}} <PollEvaluationSummary
@poll={{poll}} @momentLongDayFormat={{this.momentLongDayFormat}}
@timezone={{timezone}} @poll={{poll}}
/> @timezone={{this.timezone}}
/>
<h3>{{t "poll.evaluation.overview"}}</h3> <h3>{{t "poll.evaluation.overview"}}</h3>
<PollEvaluationChart <PollEvaluationChart
@momentLongDayFormat={{momentLongDayFormat}} @momentLongDayFormat={{this.momentLongDayFormat}}
@poll={{poll}} @poll={{poll}}
@timezone={{timezone}} @timezone={{this.timezone}}
/> />
{{/if}} {{/if}}
<h3>{{t "poll.evaluation.participantTable"}}</h3> <h3>{{t "poll.evaluation.participantTable"}}</h3>
<PollEvaluationParticipantsTable <PollEvaluationParticipantsTable
@momentLongDayFormat={{momentLongDayFormat}} @momentLongDayFormat={{this.momentLongDayFormat}}
@poll={{poll}} @poll={{poll}}
@timezone={{timezone}} @timezone={{this.timezone}}
/> />
{{/let}}

View file

@ -17,16 +17,16 @@
data-test-form-element="name" data-test-form-element="name"
/> />
<div class="selections"> <div class="selections">
{{#each selections as |selection|}} {{#each this.selections as |selection|}}
{{#if isFreeText}} {{#if this.isFreeText}}
<form.element <form.element
@controlType="text" @controlType="text"
@label={{if isFindADate @label={{if this.isFindADate
(moment-format (moment-format
selection.labelValue selection.labelValue
(if (eq selection.momentFormat "day") momentLongDayFormat selection.momentFormat) (if (eq selection.momentFormat "day") this.momentLongDayFormat selection.momentFormat)
locale=currentLocale locale=this.currentLocale
timeZone=timezone timeZone=this.timezone
) )
selection.labelValue selection.labelValue
}} }}
@ -35,12 +35,12 @@
/> />
{{else}} {{else}}
<form.element <form.element
@label={{if isFindADate @label={{if this.isFindADate
(moment-format (moment-format
selection.labelValue selection.labelValue
(if (eq selection.momentFormat "day") momentLongDayFormat selection.momentFormat) (if (eq selection.momentFormat "day") this.momentLongDayFormat selection.momentFormat)
locale=currentLocale locale=this.currentLocale
timeZone=timezone timeZone=this.timezone
) )
selection.labelValue selection.labelValue
}} }}
@ -51,7 +51,7 @@
data-test-form-element={{concat "option-" selection.labelValue}} data-test-form-element={{concat "option-" selection.labelValue}}
as |el| as |el|
> >
{{#each possibleAnswers as |possibleAnswer|}} {{#each this.possibleAnswers as |possibleAnswer|}}
<div class="radio custom-control custom-radio custom-control-inline {{possibleAnswer.type}}"> <div class="radio custom-control custom-radio custom-control-inline {{possibleAnswer.type}}">
<input <input
class="custom-control-input class="custom-control-input
@ -84,9 +84,9 @@
</div> </div>
<BsModal <BsModal
@onHidden={{action (mut savingFailed) false}} @onHidden={{action (mut this.savingFailed) false}}
@onSubmit={{action "save"}} @onSubmit={{action "save"}}
@open={{savingFailed}} @open={{this.savingFailed}}
data-test-modal="saving-failed" data-test-modal="saving-failed"
as |modal| as |modal|
> >