decide.nolog.cz/app/templates/poll.hbs
2014-09-29 00:48:26 +02:00

136 lines
No EOL
4.2 KiB
Handlebars

<div id="poll">
<div class="row">
<div class="col-sm-6 col-lg-5">
<div class="box meta-data">
<h2 class="title">{{title}}</h2>
<p class="description">{{description}}</p>
<p class="creationDate">{{t "poll.created-time" creationDateBinding="creationDate"}}</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>
<tr>
<th>&nbsp;</th>
{{#each option in options}}
<th>
{{#if isFindADate}}
{{#if isDateTime}}
{{formattedDate option.title 'llll'}}
{{else}}
{{formattedDate option.title 'll'}}
{{/if}}
{{/if}}
{{#if isMakeAPoll}}
{{option.title}}
{{/if}}
</th>
{{/each}}
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr class='newUser'>
{{! ToDo:
should be all together in just one form;
not in several forms for each input.
This work-around is due to a problem of
ember-forms in dealing with propertys of
handlebar each helper
}}
<td>
{{#em-form model=controller submit_button=false}}
{{em-form-label text="name" extraClass="sr-only"}}
{{em-input property="newUserName" placeholder="Enter your name..."}}
{{/em-form}}
</td>
{{#each newUserSelection in controller.newUserSelections}}
<td>
{{#em-form model=newUserSelection submit_button=false}}
{{#if isFreeText}}
{{em-input property="value"}}
{{else}}
{{#each answer in answers}}
<div class="radio">
<label>
{{radio-button checked=newUserSelection.value value=answer}}
<span {{bind-attr class="answer.label"}}>
<span {{bind-attr class="answer.icon"}}></span>
{{answer.label}}
</span>
</label>
</div>
{{/each}}
{{/if}}
{{/em-form}}
</td>
{{/each}}
<td>
<div class="form-group">
<button {{action "addNewUser"}} class="btn btn-default" {{bind-attr disabled=isNotValid}}>
{{t "poll.save"}}
</button>
</div>
</td>
</tr>
{{#each user in users}}
<tr>
<td>{{user.name}}</td>
{{#each selection in user.selections}}
<td>
{{#if isFreeText}}
{{selection.value}}
{{else}}
<span {{bind-attr class="selection.value.label"}}>
<span {{bind-attr class="selection.value.icon"}}></span>
{{selection.value.label}}
</span>
{{/if}}
</td>
{{/each}}
<td>&nbsp;</td>
</tr>
{{/each}}
{{#unless isFreeText}}
<tr class='evaluation evaluation-header'>
<td {{bind-attr colspan=fullRowColspan}}>
{{t "poll.evaluation.label"}}
</td>
</tr>
{{#each answer in evaluation}}
<tr class='evaluation'>
<td>
{{answer.label}}
</td>
{{#each option in answer.options}}
<td>
{{option}}
</td>
{{/each}}
<td>&nbsp;</td>
</tr>
{{/each}}
{{/unless}}
</tbody>
</table>
</div>
</div>