decide.nolog.cz/app/templates/poll.hbs
2015-08-19 13:27:14 +02:00

252 lines
9.3 KiB
Handlebars

<div id="poll">
<div class="row">
<div class="col-sm-6 col-lg-5">
<div class="box meta-data">
<h2 class="title">{{model.title}}</h2>
<p class="description">{{model.description}}</p>
<p class="creationDate">{{t "poll.created-time" creationDateBinding="view.creationDateFormatted"}}</p>
</div>
</div>
<div class="col-sm-6 col-lg-5 col-lg-offset-2">
<div class="box share-link">
<p>{{t "poll.share"}}</p>
<p class="link"><a {{bind-attr href=pollUrl}}>{{pollUrl}}</a></p>
<p class="notice">
{{t "poll.share.notice"}}
</p>
</div>
</div>
</div>
<div class="box">
<div class="table-scroll">
<table class="user-selections-table table table-striped table-condensed">
<thead>
{{#if model.isDateTime}}
<tr class="dateGroups">
<th>&nbsp;</th>
{{#each dateGroup in dateGroups}}
<th {{bind-attr colspan="dateGroup.colspan"}}>
{{formattedDate dateGroup.value}}
</th>
{{/each}}
<th>&nbsp;</th>
</tr>
{{/if}}
<tr>
<th>&nbsp;</th>
{{#if model.isFindADate}}
{{#each date in dates}}
<th>
{{#if model.isDateTime}}
{{formattedDate date.title format="LT" times=true}}
{{else}}
{{formattedDate date.title}}
{{/if}}
</th>
{{/each}}
{{else}}
{{#each option in model.options}}
<th>
{{option.title}}
</th>
{{/each}}
{{/if}}
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr class='newUser'>
<td>
{{#form-wrapper}}
{{#input newUserName}}
{{input-field newUserName
placeholderTranslation="poll.input.newUserName.placeholder"
}}
{{#if view.showError}}
{{error-field newUserName}}
{{/if}}
{{/input}}
{{/form-wrapper}}
</td>
{{#each newUserSelection in newUserSelections}}
<td class="newUserSelection">
{{#form-wrapper}}
{{#if model.isFreeText}}
{{#input newUserSelection.value}}
{{input-field newUserSelection.value}}
{{/input}}
{{else}}
{{#each answer in model.answers}}
<div class="radio">
{{#radio-button value=answer groupValue=newUserSelection.value}}
<span {{bind-attr class="answer.id"}}>
<span {{bind-attr class="answer.icon"}}></span>
{{answer.label}}
</span>
{{/radio-button}}
</div>
{{/each}}
{{/if}}
{{/form-wrapper}}
</td>
{{/each}}
<td>
<button {{action "submitNewUser"}} class="btn btn-default btn-primary">
{{t "poll.save"}}
</button>
<span style="white-space: normal;">
{{#input everyOptionIsAnswered}}
{{#if view.showError}}
{{error-field everyOptionIsAnswered}}
{{/if}}
{{/input}}
</span>
</td>
</tr>
{{#each user in model.users}}
<tr class="user">
<td>{{user.name}}</td>
{{#each selection in user.selections}}
<td>
{{#if model.isFreeText}}
{{selection.value}}
{{else}}
<span {{bind-attr class="selection.value.id"}}>
<span {{bind-attr class="selection.value.icon"}}></span>
{{selection.value.label}}
</span>
{{/if}}
</td>
{{/each}}
<td>&nbsp;</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
{{#if isEvaluable}}
<div class="box">
<h2>
{{t "poll.evaluation.label"}}
</h2>
<p>
{{t "poll.evaluation.participants" count=evaluationParticipants}}
</p>
<p>
{{#if model.isFindADate}}
{{t "poll.evaluation.bestOption.label.findADate" count=evaluationBestOptions.length}}
{{else}}
{{t "poll.evaluation.bestOption.label.makeAPoll" count=evaluationBestOptions.length}}
{{/if}}
{{#if evaluationBestOptionsMultiple}}
<ul>
{{#each evaluationBestOption in evaluationBestOptions}}
<li>
<strong>
{{#if model.isFindADate}}
{{formattedDate evaluationBestOption.title times=model.isDateTime}}.
{{else}}
{{evaluationBestOption.title}}.
{{/if}}
</strong>
<br/>
{{#if model.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}}
</li>
{{/each}}
</ul>
{{else}}
<strong>
{{#if model.isFindADate}}
{{formattedDate evaluationBestOptions.[0].title times=model.isDateTime}}.
{{else}}
{{evaluationBestOptions.[0].title}}.
{{/if}}
</strong>
{{#if model.isFindADate}}
{{#if evaluationBestOptions.[0].answers.yes}}
{{t "poll.evaluation.bestOptionParticipants.findADate.yes" count=evaluationBestOptions.[0].answers.yes}}
{{/if}}
{{#if evaluationBestOptions.[0].answers.maybe}}
{{t "poll.evaluation.bestOptionParticipants.findADate.maybe" count=evaluationBestOptions.[0].answers.maybe}}
{{/if}}
{{#if evaluationBestOptions.[0].answers.no}}
{{t "poll.evaluation.bestOptionParticipants.findADate.no" count=evaluationBestOptions.[0].answers.no}}
{{/if}}
{{else}}
{{#if evaluationBestOptions.[0].answers.yes}}
{{t "poll.evaluation.bestOptionParticipants.makeAPoll.yes" count=evaluationBestOptions.[0].answers.yes}}
{{/if}}
{{#if evaluationBestOptions.[0].answers.maybe}}
{{t "poll.evaluation.bestOptionParticipants.makeAPoll.maybe" count=evaluationBestOptions.[0].answers.maybe}}
{{/if}}
{{#if evaluationBestOptions.[0].answers.no}}
{{t "poll.evaluation.bestOptionParticipants.makeAPoll.no" count=evaluationBestOptions.[0].answers.no}}
{{/if}}
{{/if}}
{{/if}}
</p>
<p>
{{t "poll.evaluation.lastParticipation" ago=(moment-from-now evaluationLastParticipation)}}
</p>
</div>
{{/if}}
</div>
<div class="modal fade" id="timezoneDiffers">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title">
{{t "poll.modal.timezoneDiffers.title"}}
</h4>
</div>
<div class="modal-body">
<p>
{{t "poll.modal.timezoneDiffers.body"}}
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal" {{action "useLocalTimezone" target="view"}} class="use-local-timezone">
{{t "poll.modal.timezoneDiffers.button.useLocalTimezone"}}
</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" class="use-poll-timezone">
{{t "poll.modal.timezoneDiffers.button.usePollTimezone"}}
</button>
</div>
</div>
</div>
</div>