effective_polls 0.0.1

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.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +132 -0
  4. data/Rakefile +32 -0
  5. data/app/assets/config/effective_polls_manifest.js +1 -0
  6. data/app/assets/stylesheets/effective_polls.scss +0 -0
  7. data/app/controllers/admin/poll_notifications_controller.rb +15 -0
  8. data/app/controllers/admin/poll_questions_controller.rb +15 -0
  9. data/app/controllers/admin/polls_controller.rb +23 -0
  10. data/app/controllers/effective/ballots_controller.rb +70 -0
  11. data/app/controllers/effective/polls_controller.rb +19 -0
  12. data/app/datatables/admin/effective_poll_notifications_datatable.rb +43 -0
  13. data/app/datatables/admin/effective_poll_questions_datatable.rb +28 -0
  14. data/app/datatables/admin/effective_poll_results_datatable.rb +50 -0
  15. data/app/datatables/admin/effective_polls_datatable.rb +29 -0
  16. data/app/datatables/effective_polls_datatable.rb +30 -0
  17. data/app/helpers/effective_polls_helper.rb +23 -0
  18. data/app/mailers/effective/polls_mailer.rb +23 -0
  19. data/app/models/effective/access_denied.rb +17 -0
  20. data/app/models/effective/ballot.rb +73 -0
  21. data/app/models/effective/ballot_response.rb +92 -0
  22. data/app/models/effective/ballot_response_option.rb +6 -0
  23. data/app/models/effective/poll.rb +149 -0
  24. data/app/models/effective/poll_notification.rb +144 -0
  25. data/app/models/effective/poll_question.rb +76 -0
  26. data/app/models/effective/poll_question_option.rb +26 -0
  27. data/app/views/admin/poll_notifications/_form.html.haml +55 -0
  28. data/app/views/admin/poll_questions/_form.html.haml +100 -0
  29. data/app/views/admin/polls/_form.html.haml +20 -0
  30. data/app/views/admin/polls/_form_content.html.haml +27 -0
  31. data/app/views/admin/polls/_form_poll.html.haml +32 -0
  32. data/app/views/admin/polls/_poll.html.haml +2 -0
  33. data/app/views/admin/polls/results.html.haml +6 -0
  34. data/app/views/effective/ballot_responses/_ballot_response.html.haml +2 -0
  35. data/app/views/effective/ballot_responses/_fields.html.haml +14 -0
  36. data/app/views/effective/ballot_responses/fields/_choose_one.html.haml +1 -0
  37. data/app/views/effective/ballot_responses/fields/_date.html.haml +1 -0
  38. data/app/views/effective/ballot_responses/fields/_email.html.haml +1 -0
  39. data/app/views/effective/ballot_responses/fields/_long_answer.html.haml +1 -0
  40. data/app/views/effective/ballot_responses/fields/_number.html.haml +1 -0
  41. data/app/views/effective/ballot_responses/fields/_select_all_that_apply.html.haml +1 -0
  42. data/app/views/effective/ballot_responses/fields/_select_upto_1.html.haml +1 -0
  43. data/app/views/effective/ballot_responses/fields/_select_upto_2.html.haml +1 -0
  44. data/app/views/effective/ballot_responses/fields/_select_upto_3.html.haml +1 -0
  45. data/app/views/effective/ballot_responses/fields/_select_upto_4.html.haml +1 -0
  46. data/app/views/effective/ballot_responses/fields/_select_upto_5.html.haml +1 -0
  47. data/app/views/effective/ballot_responses/fields/_short_answer.html.haml +1 -0
  48. data/app/views/effective/ballot_responses/fields/_upload_file.html.haml +1 -0
  49. data/app/views/effective/ballot_responses/responses/_choose_one.html.haml +1 -0
  50. data/app/views/effective/ballot_responses/responses/_date.html.haml +1 -0
  51. data/app/views/effective/ballot_responses/responses/_email.html.haml +1 -0
  52. data/app/views/effective/ballot_responses/responses/_long_answer.html.haml +1 -0
  53. data/app/views/effective/ballot_responses/responses/_number.html.haml +1 -0
  54. data/app/views/effective/ballot_responses/responses/_select_all_that_apply.html.haml +5 -0
  55. data/app/views/effective/ballot_responses/responses/_select_upto_1.html.haml +1 -0
  56. data/app/views/effective/ballot_responses/responses/_select_upto_2.html.haml +5 -0
  57. data/app/views/effective/ballot_responses/responses/_select_upto_3.html.haml +5 -0
  58. data/app/views/effective/ballot_responses/responses/_select_upto_4.html.haml +5 -0
  59. data/app/views/effective/ballot_responses/responses/_select_upto_5.html.haml +5 -0
  60. data/app/views/effective/ballot_responses/responses/_short_answer.html.haml +1 -0
  61. data/app/views/effective/ballot_responses/responses/_upload_file.html.haml +4 -0
  62. data/app/views/effective/ballots/_ballot.html.haml +14 -0
  63. data/app/views/effective/ballots/complete.html.haml +11 -0
  64. data/app/views/effective/ballots/start.html.haml +17 -0
  65. data/app/views/effective/ballots/submit.html.haml +17 -0
  66. data/app/views/effective/ballots/vote.html.haml +19 -0
  67. data/app/views/effective/poll_results/_poll_result.html.haml +2 -0
  68. data/app/views/effective/poll_results/_results.html.haml +38 -0
  69. data/app/views/effective/poll_results/results/_choose_one.html.haml +2 -0
  70. data/app/views/effective/poll_results/results/_date.html.haml +14 -0
  71. data/app/views/effective/poll_results/results/_email.html.haml +14 -0
  72. data/app/views/effective/poll_results/results/_long_answer.html.haml +2 -0
  73. data/app/views/effective/poll_results/results/_number.html.haml +14 -0
  74. data/app/views/effective/poll_results/results/_poll_question_option.html.haml +17 -0
  75. data/app/views/effective/poll_results/results/_select_all_that_apply.html.haml +2 -0
  76. data/app/views/effective/poll_results/results/_select_upto_1.html.haml +2 -0
  77. data/app/views/effective/poll_results/results/_select_upto_2.html.haml +2 -0
  78. data/app/views/effective/poll_results/results/_select_upto_3.html.haml +2 -0
  79. data/app/views/effective/poll_results/results/_select_upto_4.html.haml +2 -0
  80. data/app/views/effective/poll_results/results/_select_upto_5.html.haml +2 -0
  81. data/app/views/effective/poll_results/results/_short_answer.html.haml +2 -0
  82. data/app/views/effective/poll_results/results/_upload_file.html.haml +3 -0
  83. data/app/views/effective/polls/_form.html.haml +10 -0
  84. data/app/views/effective/polls/_poll.html.haml +2 -0
  85. data/app/views/layouts/effective_polls_mailer_layout.html.haml +7 -0
  86. data/config/effective_polls.rb +59 -0
  87. data/config/routes.rb +23 -0
  88. data/db/migrate/01_create_effective_polls.rb.erb +92 -0
  89. data/lib/effective_polls.rb +50 -0
  90. data/lib/effective_polls/engine.rb +11 -0
  91. data/lib/effective_polls/version.rb +3 -0
  92. data/lib/generators/effective_polls/install_generator.rb +46 -0
  93. data/lib/generators/templates/effective_polls_mailer_preview.rb +35 -0
  94. data/lib/tasks/effective_polls_tasks.rake +24 -0
  95. metadata +276 -0
@@ -0,0 +1,32 @@
1
+ = effective_form_with(model: [:admin, poll], engine: true) do |f|
2
+ = f.text_field :title, hint: 'The title of your poll.'
3
+
4
+ = f.datetime_field :start_at, input_js: { minDate: [f.object.start_at.presence, Time.zone.now].compact.min.strftime('%F') }
5
+ = f.datetime_field :end_at
6
+
7
+ -# Audience
8
+ = f.radios :audience, Effective::Poll::AUDIENCES
9
+
10
+ = f.show_if :audience, 'All Users' do
11
+ .card
12
+ .card-body
13
+ %h5 All Users
14
+ %p All users may complete this poll
15
+
16
+ = f.show_if :audience, 'Individual Users' do
17
+ .card
18
+ .card-body
19
+ %h5 Individual Users
20
+ %p Only the following individual users may complete this poll
21
+
22
+ - user_ids = User.respond_to?(:sorted) ? User.sorted : User.all
23
+ = f.select :audience_scope, user_ids, multiple: true, label: false
24
+
25
+ = f.show_if :audience, 'Selected Users' do
26
+ .card
27
+ .card-body
28
+ %h5 Selected Users
29
+ %p Users within any of the following groups may complete this poll
30
+ = f.checks :audience_scope, effective_polls_audience_scope_collection(), multiple: true, label: false
31
+
32
+ = effective_submit(f)
@@ -0,0 +1,2 @@
1
+ %p= poll.title
2
+ %p= poll.body
@@ -0,0 +1,6 @@
1
+ %h1= @page_title
2
+
3
+ = render 'effective/poll_results/results', poll: @poll
4
+
5
+ %h2 Raw Results
6
+ = render_datatable(@datatable)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/ballot_responses/responses/' + ballot_response.category_partial
2
+ = render(partial, ballot_response: ballot_response)
@@ -0,0 +1,14 @@
1
+ .row
2
+ .col
3
+ %h3= poll_question
4
+ %p.text-muted.mb-2= poll_question.category
5
+
6
+ - if poll_question.body.present?
7
+ .mb-3= poll_question.body
8
+
9
+ = f.hidden_field :poll_id
10
+ = f.hidden_field :poll_question_id
11
+
12
+ - ballot_response = f.object
13
+ - partial = 'effective/ballot_responses/fields/' + poll_question.category_partial
14
+ = render(partial, f: f, ballot_response: ballot_response, poll_question: poll_question)
@@ -0,0 +1 @@
1
+ = f.radios :poll_question_option_ids, poll_question.poll_question_options, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.date_field :date, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.email_field :email, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.text_area :long_answer, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.number_field :number, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, actions: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, actions: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, actions: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, actions: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.checks :poll_question_option_ids, poll_question.poll_question_options, label: false, actions: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.text_field :short_answer, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = f.file_field :upload_file, label: false, required: poll_question.required?
@@ -0,0 +1 @@
1
+ = ballot_response.response.presence || '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response&.strftime('%F') || '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response.present? ? mail_to(ballot_response.response) : '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response.presence || '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response.presence || '-'
@@ -0,0 +1,5 @@
1
+ - ballot_response.response.each do |poll_question_option|
2
+ %div= poll_question_option.title
3
+
4
+ - if ballot_response.response.blank?
5
+ = '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response&.title || '-'
@@ -0,0 +1,5 @@
1
+ - ballot_response.response.each do |poll_question_option|
2
+ %div= poll_question_option.title
3
+
4
+ - if ballot_response.response.blank?
5
+ = '-'
@@ -0,0 +1,5 @@
1
+ - ballot_response.response.each do |poll_question_option|
2
+ %div= poll_question_option.title
3
+
4
+ - if ballot_response.response.blank?
5
+ = '-'
@@ -0,0 +1,5 @@
1
+ - ballot_response.response.each do |poll_question_option|
2
+ %div= poll_question_option.title
3
+
4
+ - if ballot_response.response.blank?
5
+ = '-'
@@ -0,0 +1,5 @@
1
+ - ballot_response.response.each do |poll_question_option|
2
+ %div= poll_question_option.title
3
+
4
+ - if ballot_response.response.blank?
5
+ = '-'
@@ -0,0 +1 @@
1
+ = ballot_response.response.presence || '-'
@@ -0,0 +1,4 @@
1
+ - if ballot_response.response&.attached?
2
+ = link_to(ballot_response.response.filename, url_for(ballot_response.response), target: '_blank')
3
+ - else
4
+ = '-'
@@ -0,0 +1,14 @@
1
+ .effective-ballot
2
+ %table.table.table-hover
3
+ %thead
4
+ %tr
5
+ %th Poll Question
6
+ %th Ballot Response
7
+
8
+ %tbody
9
+ - ballot.poll.poll_questions.each_with_index do |poll_question, index|
10
+ - ballot_response = ballot.ballot_response(poll_question)
11
+
12
+ %tr
13
+ %td= poll_question
14
+ %td= render(ballot_response)
@@ -0,0 +1,11 @@
1
+ = render_wizard_sidebar(resource) do
2
+ %h1= @page_title
3
+
4
+ - if resource.poll.all_steps_content.present?
5
+ .mb-2= resource.poll.all_steps_content
6
+
7
+ - if resource.poll.complete_content.present?
8
+ .mb-2= resource.poll.complete_content
9
+
10
+ .text-center
11
+ %p= link_to 'Home', root_path, class: 'btn btn-primary'
@@ -0,0 +1,17 @@
1
+ = render_wizard_sidebar(resource) do
2
+ %h1 Poll: #{resource.poll}
3
+
4
+ .alert.alert-warning
5
+ This is a <strong>Secret Ballot</strong>.
6
+ Only you will know what you have submitted and no one has access to individual ballots.
7
+
8
+ - if resource.poll.all_steps_content.present?
9
+ .mb-2= resource.poll.all_steps_content
10
+
11
+ - if resource.poll.start_content.present?
12
+ .mb-2= resource.poll.start_content
13
+
14
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
15
+ = f.hidden_field :current_step
16
+
17
+ = f.submit 'Start', center: true
@@ -0,0 +1,17 @@
1
+ = render_wizard_sidebar(resource) do
2
+ %h1 Review: #{resource.poll}
3
+
4
+ - if resource.poll.all_steps_content.present?
5
+ .mb-2= resource.poll.all_steps_content
6
+
7
+ - if resource.poll.submit_content.present?
8
+ .mb-2= resource.poll.submit_content
9
+
10
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
11
+ = f.hidden_field :current_step
12
+
13
+ = render(resource)
14
+
15
+ = f.submit(center: true) do
16
+ = link_to 'Change Ballot', wizard_path(:vote), class: 'btn btn-secondary'
17
+ = f.save 'Submit Ballot'
@@ -0,0 +1,19 @@
1
+ = render_wizard_sidebar(resource) do
2
+ %h1 Ballot: #{resource.poll}
3
+
4
+ - if resource.poll.all_steps_content.present?
5
+ .mb-2= resource.poll.all_steps_content
6
+
7
+ - if resource.poll.vote_content.present?
8
+ .mb-2= resource.poll.vote_content
9
+
10
+ = effective_form_with(model: resource, url: wizard_path(step), method: :put) do |f|
11
+ = f.hidden_field :current_step
12
+
13
+ - resource.poll.poll_questions.deep.all.each_with_index do |poll_question, index|
14
+ - ballot_response = resource.ballot_response(poll_question)
15
+
16
+ = f.fields_for :ballot_responses, ballot_response do |fbr|
17
+ = render('/effective/ballot_responses/fields', f: fbr, poll_question: poll_question)
18
+
19
+ = f.submit 'Save and Continue', center: true
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/' + poll_question.category_partial
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,38 @@
1
+ .card.mb-3
2
+ .card-body
3
+ %h5.card-title Results
4
+
5
+ %p #{poll} was available from #{poll.available_date}.
6
+
7
+ %p
8
+ %strong
9
+ = pluralize(poll.completed_ballots.count, 'users')
10
+ completed
11
+ ballots from an audience of
12
+ = succeed('.') do
13
+ %strong= pluralize(poll.users.count, 'total users')
14
+
15
+ .card.mb-3
16
+ .card-body
17
+ %h5.card-title Question Results
18
+
19
+ .effective-ballot
20
+ %table.table.table-hover
21
+ %thead
22
+ %tr
23
+ %th Poll Question
24
+ %th Results
25
+
26
+ %tbody
27
+ - ballots = poll.ballots
28
+
29
+ - poll.poll_questions.each_with_index do |poll_question, index|
30
+ - ballot_responses = poll.poll_results(poll_question: poll_question)
31
+
32
+ %tr
33
+ %td
34
+ #{poll_question.position + 1}. #{poll_question}
35
+ %br
36
+ %small.text-muted= poll_question.category
37
+
38
+ %td= render('effective/poll_results/poll_result', poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,14 @@
1
+ - sorted = ballot_responses.sort { |a, b| (a.date || Time.zone.now.end_of_year) <=> (b.date || Time.zone.now.end_of_year) }
2
+
3
+ - sorted.group_by { |br| br.response }.each do |response, responses|
4
+ - count = responses.length
5
+ - total = ballot_responses.length
6
+ - percent = (total.zero? ? 0 : ((count * 100.0) / total).round)
7
+
8
+ .poll-result-option
9
+ .d-flex
10
+ .mr-auto= response.blank? ? 'None of the Above' : response.strftime('%F')
11
+ .text-muted #{count} (#{percent}%)
12
+
13
+ .progress.mb-3
14
+ .progress-bar{role: 'progressbar', 'aria-valuenow': count, 'aria-valuemin': 0, 'aria-valuemax': total, style: "width: #{percent}%"}
@@ -0,0 +1,14 @@
1
+ - sorted = ballot_responses.sort { |a, b| (a.email || '') <=> (b.email || '') }
2
+
3
+ - sorted.group_by { |br| br.response }.each do |response, responses|
4
+ - count = responses.length
5
+ - total = ballot_responses.length
6
+ - percent = (total.zero? ? 0 : ((count * 100.0) / total).round)
7
+
8
+ .poll-result-option
9
+ .d-flex
10
+ .mr-auto= response.blank? ? 'None of the Above' : response
11
+ .text-muted #{count} (#{percent}%)
12
+
13
+ .progress.mb-3
14
+ .progress-bar{role: 'progressbar', 'aria-valuenow': count, 'aria-valuemin': 0, 'aria-valuemax': total, style: "width: #{percent}%"}
@@ -0,0 +1,2 @@
1
+ - ballot_responses.select { |br| br.long_answer.present? }.each do |ballot_response|
2
+ .poll-result-long-answer= ballot_response.response
@@ -0,0 +1,14 @@
1
+ - sorted = ballot_responses.sort { |a, b| (a.number || 999999999) <=> (b.number || 999999999) }
2
+
3
+ - sorted.group_by { |br| br.response }.each do |response, responses|
4
+ - count = responses.length
5
+ - total = ballot_responses.length
6
+ - percent = (total.zero? ? 0 : ((count * 100.0) / total).round)
7
+
8
+ .poll-result-option
9
+ .d-flex
10
+ .mr-auto= response.blank? ? 'None of the Above' : response
11
+ .text-muted #{count} (#{percent}%)
12
+
13
+ .progress.mb-3
14
+ .progress-bar{role: 'progressbar', 'aria-valuenow': count, 'aria-valuemin': 0, 'aria-valuemax': total, style: "width: #{percent}%"}
@@ -0,0 +1,17 @@
1
+ - (poll_question.poll_question_options + [nil]).each do |poll_question_option|
2
+ - responses = ballot_responses.select { |br| br.response.blank? } if poll_question_option.blank?
3
+ - responses ||= ballot_responses.select { |br| Array(br.response).include?(poll_question_option) }
4
+
5
+ - count = responses.length
6
+ - total = ballot_responses.length
7
+ - percent = (total.zero? ? 0 : ((count * 100.0) / total).round)
8
+
9
+ - next if poll_question_option.blank? && count == 0
10
+
11
+ .poll-result-option
12
+ .d-flex
13
+ .mr-auto= poll_question_option.blank? ? 'None of the Above' : poll_question_option
14
+ .text-muted #{count} (#{percent}%)
15
+
16
+ .progress.mb-3
17
+ .progress-bar{role: 'progressbar', 'aria-valuenow': count, 'aria-valuemin': 0, 'aria-valuemax': total, style: "width: #{percent}%"}
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - partial = 'effective/poll_results/results/poll_question_option'
2
+ = render(partial, poll_question: poll_question, ballot_responses: ballot_responses)
@@ -0,0 +1,2 @@
1
+ - ballot_responses.select { |br| br.short_answer.present? }.each do |ballot_response|
2
+ .poll-result-short-answer= ballot_response.response
@@ -0,0 +1,3 @@
1
+ - ballot_responses.select { |br| br.response&.attached? }.each do |ballot_response|
2
+ .poll-result-upload-file
3
+ = link_to(ballot_response.response.filename, url_for(ballot_response.response), target: '_blank')
@@ -0,0 +1,10 @@
1
+ = effective_form_with(model: poll, engine: true) do |f|
2
+ = f.text_field :title, hint: 'The title of your poll.'
3
+ = f.text_area :body
4
+
5
+ = f.datetime_field :start_at
6
+ = f.datetime_field :end_at
7
+
8
+ = f.check_box :draft, hint: 'Save this poll as a draft. It will not be accessible on the website.'
9
+
10
+ = effective_submit(f)
@@ -0,0 +1,2 @@
1
+ %p= poll.title
2
+ %p= poll.body
@@ -0,0 +1,7 @@
1
+ !!!
2
+ %html{style: 'background: #fff;'}
3
+ %head
4
+ %meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}
5
+
6
+ %body{style: 'background: #fff;'}
7
+ = yield
@@ -0,0 +1,59 @@
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
+ # Authorization Method
11
+ #
12
+ # This method is called by all controller actions with the appropriate action and resource
13
+ # If it raises an exception or returns false, an Effective::AccessDenied Error will be raised
14
+ #
15
+ # Use via Proc:
16
+ # Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCan
17
+ # Proc.new { |controller, action, resource| can?(action, resource) } # CanCan with skip_authorization_check
18
+ # Proc.new { |controller, action, resource| authorize "#{action}?", resource } # Pundit
19
+ # Proc.new { |controller, action, resource| current_user.is?(:admin) } # Custom logic
20
+ #
21
+ # Use via Boolean:
22
+ # config.authorization_method = true # Always authorized
23
+ # config.authorization_method = false # Always unauthorized
24
+ #
25
+ # Use via Method (probably in your application_controller.rb):
26
+ # config.authorization_method = :my_authorization_method
27
+ # def my_authorization_method(resource, action)
28
+ # true
29
+ # end
30
+ config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) }
31
+
32
+ # Layout Settings
33
+ # Configure the Layout per controller, or all at once
34
+ config.layout = {
35
+ polls: 'application',
36
+ admin: 'admin'
37
+ }
38
+
39
+ # Audience Scope Collection
40
+ #
41
+ # When creating a new poll, an Array of User scopes can be provided
42
+ # The User model must respond to these
43
+ #
44
+ # config.audience_user_scopes = [:all, :registered]
45
+ # config.audience_user_scopes = [['All Users', :all], ['Registered Users', :registered]]
46
+ #
47
+ config.audience_user_scopes = [['All Users', :all]]
48
+
49
+ # Notifications Mailer Settings
50
+ #
51
+ # Schedule rake effective_polls:notify to run every 10 minutes
52
+ # to send out email poll notifications
53
+ #
54
+ config.mailer = {
55
+ layout: 'effective_polls_mailer_layout',
56
+ default_from: 'info@example.com'
57
+ }
58
+
59
+ end