I finally got round to polish and package the umbraco poll I made some time ago. So here it is …
The package installs the following:
The document types (Polls, Poll, Poll Answer) will be used to setup the polls.
So you’ll have a Polls document that will contain several Poll documents and these will have several Poll Answer documents beneath it.
After you have setup a poll with some answers in your content area you can get the poll on your page.
First add a reference to the installed stylesheet (/css/Nibble.Umb.Poll.css) and then place the Poll macro on your template.
Please note that:
- The macro will have to be placed inside a form with runat=”server” attribute
- There has to be a scriptmanager on the page
The poll macro has several parameters:
- Poll Node Id: This is the id of the Poll content node that you want to display
- Display Only: Check this if you only want to display the results of a poll
- Submit On Select: Check this if you want to submit the vote when a user selects a answer
- Hide Submit: Check this if you want to hide the submit button
- Sort Results: Check this if you want that the results are sorted by number of votes
- Width Total Votes: Instead of the highest number of votes being equal to 100% width, the total number of votes is 100%
- Hide Question: Check this if you want to hide the question
- Random Poll: Check this if you want to display a random Poll, you’ll also have to update the Poll Node Id to the Polls document (containing the different polls)
So depending on the parameters (Submit On Select and Hide Submit) your poll can look like:
or (with submit button)
The Results can look like this:
Width Total Votes:
You can download the package here: http://our.umbraco.org/projects/poll