refinerycms-ballots 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/ballots_controller.rb +1 -1
- data/app/controllers/votes_controller.rb +1 -1
- data/app/helpers/admin/ballots_helper.rb +4 -0
- data/app/models/ballot.rb +7 -2
- data/app/views/votes/login.html.erb +1 -1
- data/lib/refinerycms-ballots.rb +0 -1
- metadata +9 -8
- data/lib/member_extensions.rb +0 -12
@@ -37,7 +37,7 @@ protected
|
|
37
37
|
if !@member
|
38
38
|
flash[:error] = 'Please double check your number and try again. If it is correct, you may need to contact an admin.'
|
39
39
|
redirect_to login_ballot_votes_path(@ballot)
|
40
|
-
elsif @
|
40
|
+
elsif @ballot.voted_on_by?(@member)
|
41
41
|
flash[:error] = "You have already voted on this ballot, revoting isn't allowed"
|
42
42
|
redirect_to login_ballot_votes_path(@ballot)
|
43
43
|
else
|
data/app/models/ballot.rb
CHANGED
@@ -48,11 +48,11 @@ class Ballot < ActiveRecord::Base
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def voting_members
|
51
|
-
Member.all.select { |member|
|
51
|
+
Member.all.select { |member| voted_on_by? member }
|
52
52
|
end
|
53
53
|
|
54
54
|
def nonvoting_members
|
55
|
-
Member.all.reject { |member|
|
55
|
+
Member.all.reject { |member| voted_on_by? member }
|
56
56
|
end
|
57
57
|
|
58
58
|
|
@@ -60,6 +60,11 @@ class Ballot < ActiveRecord::Base
|
|
60
60
|
return if start_date < end_date
|
61
61
|
errors[:start_date] << 'must be after end date'
|
62
62
|
end
|
63
|
+
|
64
|
+
def voted_on_by?(member)
|
65
|
+
ballot_votes.where(:member_id => member.id, :ballot_id => id).any?
|
66
|
+
end
|
67
|
+
|
63
68
|
private
|
64
69
|
def today
|
65
70
|
Time.now
|
data/lib/refinerycms-ballots.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-ballots
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-13 00:00:00.000000000
|
12
|
+
date: 2011-09-13 00:00:00.000000000 -05:00
|
13
|
+
default_executable:
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: refinerycms-simple_members
|
16
|
-
requirement: &
|
17
|
+
requirement: &70235273747320 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ~>
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: 0.1.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *70235273747320
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: factory_girl
|
27
|
-
requirement: &
|
28
|
+
requirement: &70235273746620 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
@@ -32,7 +33,7 @@ dependencies:
|
|
32
33
|
version: 2.1.0
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *70235273746620
|
36
37
|
description: Ruby on Rails Ballots engine for Refinery CMS
|
37
38
|
email:
|
38
39
|
executables: []
|
@@ -40,7 +41,6 @@ extensions: []
|
|
40
41
|
extra_rdoc_files: []
|
41
42
|
files:
|
42
43
|
- lib/generators/refinerycms_ballots_generator.rb
|
43
|
-
- lib/member_extensions.rb
|
44
44
|
- lib/refinerycms-ballots.rb
|
45
45
|
- lib/tasks/ballots.rake
|
46
46
|
- config/locales/en.yml
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- app/views/votes/create.html.erb
|
79
79
|
- app/views/votes/login.html.erb
|
80
80
|
- app/views/votes/new.html.erb
|
81
|
+
has_rdoc: true
|
81
82
|
homepage:
|
82
83
|
licenses: []
|
83
84
|
post_install_message:
|
@@ -98,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
99
|
version: '0'
|
99
100
|
requirements: []
|
100
101
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.
|
102
|
+
rubygems_version: 1.6.2
|
102
103
|
signing_key:
|
103
104
|
specification_version: 3
|
104
105
|
summary: Ballots engine for Refinery CMS
|