refinerycms-polls 0.0.1.dev → 0.0.2.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +37 -2
- data/app/models/refinery/polls/question.rb +3 -1
- data/config/routes.rb +1 -0
- data/lib/refinery/polls/version.rb +1 -1
- data/refinerycms-polls.gemspec +2 -0
- metadata +5 -3
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Include the latest [gem](http://rubygems.org/gems/refinerycms-polls) into your Refinery CMS application's Gemfile:
|
6
6
|
|
7
|
-
gem 'refinerycms-polls', '~>
|
7
|
+
gem 'refinerycms-polls', '~> 0.0.1.dev'
|
8
8
|
|
9
9
|
Then type the following at command line inside your Refinery CMS application's root directory:
|
10
10
|
|
@@ -21,6 +21,34 @@ Add pages to the database and you're done:
|
|
21
21
|
|
22
22
|
rake db:seed
|
23
23
|
|
24
|
+
## Set vote interval by ip:
|
25
|
+
After install "generate refinery:polls" you will have an initializer called refinery/poll.rb, you can modify vote interval there.
|
26
|
+
|
27
|
+
Refinery::Polls.configure do |config|
|
28
|
+
# Configure how long is going to be valid a vote for a guest
|
29
|
+
config.vote_duration = 1.week
|
30
|
+
end
|
31
|
+
|
32
|
+
# Render a Poll
|
33
|
+
|
34
|
+
You can get all actives polls with:
|
35
|
+
|
36
|
+
Refinery::Polls::Question.actives
|
37
|
+
|
38
|
+
all questions will be orderer by default with position value in admin reorder functionality.
|
39
|
+
|
40
|
+
And pick up one question to render a poll with the partial "poll":
|
41
|
+
|
42
|
+
render '/refinery/polls/questions/poll', :question => question
|
43
|
+
|
44
|
+
Override default view for partial _poll
|
45
|
+
|
46
|
+
You can override the default partial view for a poll replacing this partial:
|
47
|
+
|
48
|
+
/refinery/polls/questions/_poll.html.erb
|
49
|
+
|
50
|
+
You only need to create that path and file in your app tree.
|
51
|
+
|
24
52
|
## About
|
25
53
|
|
26
54
|
__Add polls to your Refinery site.__
|
@@ -32,4 +60,11 @@ In summary you can:
|
|
32
60
|
* Set when starts and ends your polls.
|
33
61
|
* Show results for your polls.
|
34
62
|
* Set votes for anonymous users by IP addres
|
35
|
-
* Set aa duration period to vote. (if a guest vote it will need to wait x time to vote again)
|
63
|
+
* Set aa duration period to vote. (if a guest vote it will need to wait x time to vote again)
|
64
|
+
|
65
|
+
## Todo
|
66
|
+
|
67
|
+
* Vote tracking by cookies.
|
68
|
+
* Documentation
|
69
|
+
* Tests
|
70
|
+
* Wiki
|
@@ -14,6 +14,8 @@ module Refinery
|
|
14
14
|
attr_accessible :title, :start_date, :end_date, :position
|
15
15
|
attr_accessor :locale
|
16
16
|
|
17
|
+
default_scope order("position ASC")
|
18
|
+
|
17
19
|
class Translation
|
18
20
|
attr_accessible :locale
|
19
21
|
end
|
@@ -25,7 +27,7 @@ module Refinery
|
|
25
27
|
has_many :answers, :class_name => '::Refinery::Polls::Answer'
|
26
28
|
|
27
29
|
def self.actives
|
28
|
-
where("start_date
|
30
|
+
where("start_date <= ? and end_date >= ?", Date.today, Date.today)
|
29
31
|
end
|
30
32
|
|
31
33
|
def answers_with_data
|
data/config/routes.rb
CHANGED
@@ -16,6 +16,7 @@ Refinery::Core::Engine.routes.append do
|
|
16
16
|
# Admin routes
|
17
17
|
namespace :polls, :path => '' do
|
18
18
|
namespace :admin, :path => 'refinery' do
|
19
|
+
#hack for delete action in admin, it can't handle nested routes
|
19
20
|
match "/refinery/questions/:question_id/answers" => "refinery/polls/admin/answers#index", :as => :answer
|
20
21
|
resources :questions, :except => :show do
|
21
22
|
collection do
|
data/refinerycms-polls.gemspec
CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.authors = ['Agustin Viñao']
|
18
18
|
s.email = %q{agustinvinao@gmail.com}
|
19
19
|
s.homepage = 'https://github.com/agustinvinao/refinerycms-polls'
|
20
|
+
s.license = 'MIT'
|
21
|
+
s.post_install_message = "Thanks for installing! If you have any ideas or comments please contact me agustinvinao@gmail.com"
|
20
22
|
|
21
23
|
# Runtime dependencies
|
22
24
|
s.add_dependency 'refinerycms-core' , '~> 2.0.2'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-polls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2.dev
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -133,8 +133,10 @@ files:
|
|
133
133
|
- tasks/rspec.rake
|
134
134
|
- tasks/testing.rake
|
135
135
|
homepage: https://github.com/agustinvinao/refinerycms-polls
|
136
|
-
licenses:
|
137
|
-
|
136
|
+
licenses:
|
137
|
+
- MIT
|
138
|
+
post_install_message: Thanks for installing! If you have any ideas or comments please
|
139
|
+
contact me agustinvinao@gmail.com
|
138
140
|
rdoc_options: []
|
139
141
|
require_paths:
|
140
142
|
- lib
|