This extension requires Ruby 1.9.x. It's time to upgrade our current ruby base systems.
Gem Installation using Bundler (The very best way)
Include the latest gem into your Refinery CMS application's Gemfile:
gem 'refinerycms-polls', '~> 0.0.4.dev'
Then type the following at command line inside your Refinery CMS application's root directory:
Installation on Refinery 2.0.0 or above.
To install the migrations, run:
rails generate refinery:polls rake db:migrate
Add pages to the database and you're done:
Set vote interval by ip:
After install "generate refinery:polls" you will have an initializer called refinery/poll.rb, you can modify vote interval there.
Refinery::Polls.configure do |config| # Configure how long is going to be valid a vote for a guest config.vote_duration = 1.week end
Render a Poll
You can get all actives polls with:
all questions will be orderer by default with position value in admin reorder functionality.
And pick up one question to render a poll with the partial "poll":
render '/refinery/polls/questions/poll', :question => question
Override default view for partial _poll
You can override the default partial view for a poll replacing this partial:
You only need to create that path and file in your app tree.
Add polls to your Refinery site.
In summary you can:
- Create Polls.
- Set anwsers for your polls.
- Set when starts and ends your polls.
- Show results for your polls.
- Set votes for anonymous users by IP addres
- Set duration period to vote. (if a guest vote it will need to wait X time to vote again)
- Vote tracking by cookies.
RefineryCMS Polls extension is released under the MIT license and is copyright (c) 2012 Agustin Viñao