effective_polls 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57df19aaa933dd133ba655525265e129ca1c2bd7a60a78a5a8f2fe89ec1aa5cc
4
- data.tar.gz: 86fe4a6defeef051e4ff9c8543480fd6db703e213d80cf100781f4c71cc60e4b
3
+ metadata.gz: '092395996d087f516aca9b5aa9f42e170c56702b0dd9c7c7479332cb18a0c2c7'
4
+ data.tar.gz: 316a9df7d201ed389316f1cc11c5a77310038957520bdaf711666bfcf867ed7a
5
5
  SHA512:
6
- metadata.gz: 1b6f6ace193a55d55b49184f8a2b9a1a0766b0e1249c5c3daa65bfac034a7bb7b8ae1920b66ed04d1605137a88798d749951f0f714e2289774f63dfc5d820ca4
7
- data.tar.gz: e0b94cefd83a9af17f232cedc37369615ed0042543b886a496174fd807a3117cab3a876bcb6eb34d61f2ca50a70ede2c2c92d965df67d4b0619dc9a3fd05f052
6
+ metadata.gz: d4f8a181881338bd4f274194770d82fb632f0456910d1df843ec404025d4eaceb219fca21215e70d44c278a6f1791dff199fbab9b3cd2f6e88fadc6498fbfa7a
7
+ data.tar.gz: 7dae7c572c9236edcae987f7d3a4e1afce6cd65557890a82c81797b7a7d12816157020d0966379c3f70322d08ffdc7a0bde593c755ffe824153e3a97a4be3a4f
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2021 Code and Effect Inc.
1
+ Copyright 2023 Code and Effect Inc.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -10,7 +10,7 @@ Works with action_text for content bodies, and active_storage for file uploads.
10
10
 
11
11
  ## Getting Started
12
12
 
13
- This requires Rails 6+ and Twitter Bootstrap 4 and just works with Devise.
13
+ This requires Rails 6 and Twitter Bootstrap 4 and just works with Devise.
14
14
 
15
15
  Please first install the [effective_datatables](https://github.com/code-and-effect/effective_datatables) gem.
16
16
 
@@ -19,7 +19,7 @@ Please download and install the [Twitter Bootstrap4](http://getbootstrap.com)
19
19
  Add to your Gemfile:
20
20
 
21
21
  ```ruby
22
- gem 'haml-rails' # or try using gem 'hamlit-rails'
22
+ gem 'haml'
23
23
  gem 'effective_polls'
24
24
  ```
25
25
 
data/Rakefile CHANGED
@@ -1,27 +1,13 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'EffectivePolls'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
1
+ require "bundler/setup"
16
2
 
17
3
  APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
4
+ load "rails/tasks/engine.rake"
19
5
 
20
- load 'rails/tasks/statistics.rake'
6
+ load "rails/tasks/statistics.rake"
21
7
 
22
- require 'bundler/gem_tasks'
8
+ require "bundler/gem_tasks"
23
9
 
24
- require 'rake/testtask'
10
+ require "rake/testtask"
25
11
 
26
12
  Rake::TestTask.new(:test) do |t|
27
13
  t.libs << 'test'
@@ -1,12 +1,4 @@
1
1
  EffectivePolls.setup do |config|
2
- config.polls_table_name = :polls
3
- config.poll_notifications_table_name = :poll_notifications
4
- config.poll_questions_table_name = :poll_questions
5
- config.poll_question_options_table_name = :poll_question_options
6
- config.ballots_table_name = :ballots
7
- config.ballot_responses_table_name = :ballot_responses
8
- config.ballot_response_options_table_name = :ballot_response_options
9
-
10
2
  # Layout Settings
11
3
  # Configure the Layout per controller, or all at once
12
4
  # config.layout = { application: 'application', admin: 'admin' }
@@ -1,6 +1,6 @@
1
1
  class CreateEffectivePolls < ActiveRecord::Migration[6.0]
2
2
  def change
3
- create_table <%= @polls_table_name %> do |t|
3
+ create_table :polls do |t|
4
4
  t.string :title
5
5
 
6
6
  t.string :token
@@ -14,8 +14,8 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
14
14
  t.datetime :created_at
15
15
  end
16
16
 
17
- create_table <%= @poll_notifications_table_name %> do |t|
18
- t.references :poll
17
+ create_table :poll_notifications do |t|
18
+ t.integer :poll_id
19
19
 
20
20
  t.string :category
21
21
  t.integer :reminder
@@ -31,8 +31,8 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
31
31
  t.datetime :created_at
32
32
  end
33
33
 
34
- create_table <%= @poll_questions_table_name %> do |t|
35
- t.references :poll
34
+ create_table :poll_questions do |t|
35
+ t.integer :poll_id
36
36
 
37
37
  t.string :title
38
38
  t.string :category
@@ -44,8 +44,8 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
44
44
  t.datetime :created_at
45
45
  end
46
46
 
47
- create_table <%= @poll_question_options_table_name %> do |t|
48
- t.references :poll_question
47
+ create_table :poll_question_options do |t|
48
+ t.integer :poll_question_id
49
49
 
50
50
  t.string :title
51
51
  t.integer :position
@@ -54,9 +54,9 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
54
54
  t.datetime :created_at
55
55
  end
56
56
 
57
- create_table <%= @ballots_table_name %> do |t|
58
- t.references :poll
59
- t.references :user
57
+ create_table :ballots do |t|
58
+ t.integer :poll_id
59
+ t.integer :user_id
60
60
 
61
61
  t.string :token
62
62
  t.text :wizard_steps
@@ -66,10 +66,10 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
66
66
  t.datetime :created_at
67
67
  end
68
68
 
69
- create_table <%= @ballot_responses_table_name %> do |t|
70
- t.references :ballot
71
- t.references :poll
72
- t.references :poll_question
69
+ create_table :ballot_responses do |t|
70
+ t.integer :ballot_id
71
+ t.integer :poll_id
72
+ t.integer :poll_question_id
73
73
 
74
74
  t.date :date
75
75
  t.string :email
@@ -81,9 +81,9 @@ class CreateEffectivePolls < ActiveRecord::Migration[6.0]
81
81
  t.datetime :created_at
82
82
  end
83
83
 
84
- create_table <%= @ballot_response_options_table_name %> do |t|
85
- t.references :ballot_response
86
- t.references :poll_question_option
84
+ create_table :ballot_response_options do |t|
85
+ t.integer :ballot_response_id
86
+ t.integer :poll_question_option_id
87
87
 
88
88
  t.datetime :updated_at
89
89
  t.datetime :created_at
data/db/seeds.rb ADDED
@@ -0,0 +1,35 @@
1
+ puts "Running effective_polls seeds"
2
+
3
+ Effective::Poll.all.each { |poll| poll.destroy! }
4
+
5
+ Effective::Ballot.delete_all
6
+
7
+ def build_effective_poll
8
+ poll = Effective::Poll.new(
9
+ title: 'Effective Poll',
10
+ start_at: (Time.zone.now + 1.day).beginning_of_day,
11
+ end_at: (Time.zone.now + 1.day).end_of_day,
12
+ audience: 'All Users'
13
+ )
14
+
15
+ build_poll_question(poll, Effective::PollQuestion::CATEGORIES)
16
+
17
+ poll.save!
18
+ poll
19
+ end
20
+
21
+ def build_poll_question(poll, category)
22
+ questions = Array(category).map.with_index do |category, index|
23
+ question = poll.poll_questions.build(title: "#{category} Question ##{index+1}", category: category)
24
+
25
+ if question.poll_question_option?
26
+ question.poll_question_options.build(title: 'Option A')
27
+ question.poll_question_options.build(title: 'Option B')
28
+ question.poll_question_options.build(title: 'Option C')
29
+ end
30
+ end
31
+
32
+ questions.length == 1 ? questions.first : questions
33
+ end
34
+
35
+ build_effective_poll()
@@ -1,3 +1,3 @@
1
1
  module EffectivePolls
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -20,15 +20,7 @@ module EffectivePolls
20
20
  end
21
21
 
22
22
  def create_migration_file
23
- @polls_table_name = ':' + EffectivePolls.polls_table_name.to_s
24
- @poll_questions_table_name = ':' + EffectivePolls.poll_questions_table_name.to_s
25
- @poll_notifications_table_name = ':' + EffectivePolls.poll_notifications_table_name.to_s
26
- @poll_question_options_table_name = ':' + EffectivePolls.poll_question_options_table_name.to_s
27
- @ballots_table_name = ':' + EffectivePolls.ballots_table_name.to_s
28
- @ballot_responses_table_name = ':' + EffectivePolls.ballot_responses_table_name.to_s
29
- @ballot_response_options_table_name = ':' + EffectivePolls.ballot_response_options_table_name.to_s
30
-
31
- migration_template ('../' * 3) + 'db/migrate/01_create_effective_polls.rb.erb', 'db/migrate/create_effective_polls.rb'
23
+ migration_template ('../' * 3) + 'db/migrate/101_create_effective_polls.rb', 'db/migrate/create_effective_polls.rb'
32
24
  end
33
25
 
34
26
  def copy_mailer_preview
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_polls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2023-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 6.0.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: sass
28
+ name: effective_bootstrap
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,21 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: effective_bootstrap
42
+ name: effective_datatables
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: effective_resources
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -53,21 +67,21 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
- name: effective_datatables
70
+ name: wicked
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 4.0.0
75
+ version: '0'
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 4.0.0
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: effective_resources
84
+ name: sassc
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
@@ -80,6 +94,118 @@ dependencies:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: devise
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: haml
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry-byebug
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: effective_test_bot
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: effective_email_templates
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: effective_developer
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: psych
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - "<"
200
+ - !ruby/object:Gem::Version
201
+ version: '4'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - "<"
207
+ - !ruby/object:Gem::Version
208
+ version: '4'
83
209
  description: Online polls and user voting.
84
210
  email:
85
211
  - info@codeandeffect.com
@@ -178,7 +304,8 @@ files:
178
304
  - app/views/effective/polls_mailer/poll_when_poll_starts.liquid
179
305
  - config/effective_polls.rb
180
306
  - config/routes.rb
181
- - db/migrate/01_create_effective_polls.rb.erb
307
+ - db/migrate/101_create_effective_polls.rb
308
+ - db/seeds.rb
182
309
  - lib/effective_polls.rb
183
310
  - lib/effective_polls/engine.rb
184
311
  - lib/effective_polls/version.rb
@@ -204,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
331
  - !ruby/object:Gem::Version
205
332
  version: '0'
206
333
  requirements: []
207
- rubygems_version: 3.1.2
334
+ rubygems_version: 3.3.7
208
335
  signing_key:
209
336
  specification_version: 4
210
337
  summary: Online polls and user voting.