polls
Provides the ability to access and render a poll.
The polls
object allows you to select a specific poll or poll placement:
<div>
{% assign poll = polls["Poll Name"] %}
<h4>{{ poll.question }}</h4>
{% for option in poll.options %}
<div>
<input type="radio" name="{{ poll.name }}" id="{{ option.id }}" />
<label for="{{ option.id }}">{{ option.answer }}</label>
</div>
{% endfor %}
<button type="button">{{ poll.submit_button_label }}</button>
</div>
Polls Attributes
placements |
Returns the |
[poll name or id] |
You can access any {% assign poll = polls["Poll Name"] %} |
Poll Placements Attributes
[poll placement name or id] |
You can access any {% assign placement = polls.placements["Placement Name or Id"] %} |
Poll Placement Attributes
name |
Returns the Name field for the poll placement. |
placement_url |
The URL that can be used to retrieve the poll placement fully rendered by a template. |
polls |
Returns the collection of Iteration tags and array filters may be used with this collection. |
random_url |
The URL that can be used to retrieve a random poll from the placement fully rendered by a template. |
submit_url |
The URL to which a completed poll is submitted. |
Poll Attributes
has_user_voted |
Returns true if the current user (logged in or anonymous) has already voted in this poll. |
name |
Returns the Name field for the poll. |
options |
Returns the collection of Iteration tags and array filters may be used with this collection. |
poll_url |
The URL that can be used to retrieve the poll fully rendered by a template. |
question |
Returns the Question field for the poll. |
submit_button_label |
Returns a string that can be used to override the submit button label for the poll. |
submit_url |
The URL to which a completed poll is submitted. |
user_selected_option |
Returns the |
votes |
Returns the number of votes that have been tabulated for the poll. |
Poll Option Attributes
answer |
Returns the Answer field for the poll. |
percentage |
Returns the percentage of votes in the poll for the option as a decimal number between 0 and 100. |
votes |
Returns the number of votes that have been tabulated for the option. |