This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/plugins/poll/assets/javascripts/discourse/templates/poll.hbs
2016-07-29 11:09:23 +08:00

62 lines
2.0 KiB
Handlebars

<div>
<div class="poll-container">
{{#if showingResults}}
{{#if isNumber}}
{{poll-results-number isPublic=isPublic poll=poll}}
{{else}}
{{poll-results-standard isPublic=isPublic poll=poll}}
{{/if}}
{{else}}
<ul>
{{#each poll.options as |option|}}
{{poll-option option=option toggle="toggleOption" isMultiple=isMultiple}}
{{/each}}
</ul>
{{/if}}
</div>
<div class="poll-info">
<p>
<span class="info-number">{{poll.voters}}</span>
<span class="info-text">{{votersText}}</span>
</p>
{{#if isMultiple}}
{{#if showingResults}}
<p>
<span class="info-number">{{totalVotes}}</span>
<span class="info-text">{{totalVotesText}}</span>
</p>
{{else}}
<p>{{{multipleHelpText}}}</p>
{{/if}}
{{/if}}
{{#if isPublic}}
{{#unless showingResults}}
<p>{{i18n "poll.public.title"}}</p>
{{/unless}}
{{/if}}
</div>
</div>
<div class="poll-buttons">
{{#if isMultiple}}
{{#unless hideResultsDisabled}}
{{d-button class=castVotesButtonClass title="poll.cast-votes.title" label="poll.cast-votes.label" disabled=castVotesDisabled action="castVotes"}}
{{/unless}}
{{/if}}
{{#if showingResults}}
{{d-button class="toggle-results" title="poll.hide-results.title" label="poll.hide-results.label" icon="eye-slash" disabled=hideResultsDisabled action="toggleResults"}}
{{else}}
{{d-button class="toggle-results" title="poll.show-results.title" label="poll.show-results.label" icon="eye" disabled=showResultsDisabled action="toggleResults"}}
{{/if}}
{{#if canToggleStatus}}
{{#if isClosed}}
{{d-button class="toggle-status" title="poll.open.title" label="poll.open.label" icon="unlock-alt" action="toggleStatus"}}
{{else}}
{{d-button class="toggle-status btn-danger" title="poll.close.title" label="poll.close.label" icon="lock" action="toggleStatus"}}
{{/if}}
{{/if}}
</div>