biovision-poll 0.1.180917.0 → 0.2.200324.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/admin/poll_answers_controller.rb +6 -5
- data/app/controllers/admin/poll_questions_controller.rb +6 -5
- data/app/controllers/admin/polls_controller.rb +7 -6
- data/app/controllers/poll_answers_controller.rb +15 -9
- data/app/controllers/poll_questions_controller.rb +15 -9
- data/app/controllers/polls_controller.rb +25 -16
- data/app/helpers/polls_helper.rb +19 -29
- data/app/models/poll.rb +50 -18
- data/app/models/poll_answer.rb +29 -36
- data/app/models/poll_question.rb +33 -39
- data/app/models/poll_user.rb +10 -1
- data/app/models/poll_vote.rb +20 -5
- data/app/services/biovision/components/polls_component.rb +21 -0
- data/app/views/admin/components/links/_polls.html.erb +1 -0
- data/app/views/admin/poll_answers/entity/_data.html.erb +0 -0
- data/app/views/admin/poll_answers/entity/_in_list.html.erb +0 -3
- data/app/views/admin/poll_answers/show.html.erb +25 -35
- data/app/views/admin/poll_questions/entity/_data.html.erb +0 -0
- data/app/views/admin/poll_questions/entity/_in_list.html.erb +6 -5
- data/app/views/admin/poll_questions/show.html.erb +29 -37
- data/app/views/admin/poll_votes/entity/_data.html.erb +0 -0
- data/app/views/admin/poll_votes/entity/_in_list.html.erb +6 -5
- data/app/views/admin/polls/entity/_data.html.erb +0 -0
- data/app/views/admin/polls/entity/_in_list.html.erb +1 -3
- data/app/views/admin/polls/index.html.erb +8 -2
- data/app/views/admin/polls/show.html.erb +32 -30
- data/app/views/admin/polls/users.html.erb +2 -1
- data/app/views/poll_answers/_form.html.erb +36 -30
- data/app/views/poll_answers/_poll_answer.html.erb +22 -2
- data/app/views/poll_answers/edit.html.erb +6 -5
- data/app/views/poll_answers/new.html.erb +8 -7
- data/app/views/poll_questions/_form.html.erb +53 -43
- data/app/views/poll_questions/edit.html.erb +6 -5
- data/app/views/poll_questions/new.html.erb +7 -6
- data/app/views/polls/_form.html.erb +64 -41
- data/app/views/polls/_poll.html.erb +11 -6
- data/app/views/polls/edit.html.erb +5 -4
- data/app/views/polls/new.html.erb +3 -2
- data/app/views/polls/results.html.erb +22 -0
- data/config/locales/polls-ru.yml +28 -26
- data/config/routes.rb +19 -15
- data/db/migrate/20200323000001_create_biovision_polls.rb +121 -0
- data/lib/biovision/poll/version.rb +3 -1
- metadata +10 -12
- data/app/uploaders/poll_image_uploader.rb +0 -46
- data/app/views/admin/index/dashboard/_biovision_poll.html.erb +0 -10
- data/db/migrate/20170906000001_create_polls.rb +0 -70
- data/db/migrate/20170906000002_create_poll_questions.rb +0 -22
- data/db/migrate/20170906000003_create_poll_answers.rb +0 -20
- data/db/migrate/20170906000004_create_poll_votes.rb +0 -20
- data/db/migrate/20180412000010_create_poll_users.rb +0 -21
- data/db/migrate/20180903111111_rename_vote_footprint.rb +0 -11
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biovision-poll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.200324.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maxim Khan-Magomedov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -195,15 +195,19 @@ files:
|
|
195
195
|
- app/models/poll_question.rb
|
196
196
|
- app/models/poll_user.rb
|
197
197
|
- app/models/poll_vote.rb
|
198
|
-
- app/
|
199
|
-
- app/views/admin/
|
198
|
+
- app/services/biovision/components/polls_component.rb
|
199
|
+
- app/views/admin/components/links/_polls.html.erb
|
200
|
+
- app/views/admin/poll_answers/entity/_data.html.erb
|
200
201
|
- app/views/admin/poll_answers/entity/_in_list.html.erb
|
201
202
|
- app/views/admin/poll_answers/show.html.erb
|
203
|
+
- app/views/admin/poll_questions/entity/_data.html.erb
|
202
204
|
- app/views/admin/poll_questions/entity/_in_list.html.erb
|
203
205
|
- app/views/admin/poll_questions/show.html.erb
|
204
206
|
- app/views/admin/poll_users/entity/_in_list.html.erb
|
207
|
+
- app/views/admin/poll_votes/entity/_data.html.erb
|
205
208
|
- app/views/admin/poll_votes/entity/_in_list.html.erb
|
206
209
|
- app/views/admin/polls/_nav_item.html.erb
|
210
|
+
- app/views/admin/polls/entity/_data.html.erb
|
207
211
|
- app/views/admin/polls/entity/_in_list.html.erb
|
208
212
|
- app/views/admin/polls/entity/_user_filter.html.erb
|
209
213
|
- app/views/admin/polls/index.html.erb
|
@@ -230,12 +234,7 @@ files:
|
|
230
234
|
- app/views/polls/show.html.erb
|
231
235
|
- config/locales/polls-ru.yml
|
232
236
|
- config/routes.rb
|
233
|
-
- db/migrate/
|
234
|
-
- db/migrate/20170906000002_create_poll_questions.rb
|
235
|
-
- db/migrate/20170906000003_create_poll_answers.rb
|
236
|
-
- db/migrate/20170906000004_create_poll_votes.rb
|
237
|
-
- db/migrate/20180412000010_create_poll_users.rb
|
238
|
-
- db/migrate/20180903111111_rename_vote_footprint.rb
|
237
|
+
- db/migrate/20200323000001_create_biovision_polls.rb
|
239
238
|
- lib/biovision/poll.rb
|
240
239
|
- lib/biovision/poll/engine.rb
|
241
240
|
- lib/biovision/poll/version.rb
|
@@ -259,8 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
259
258
|
- !ruby/object:Gem::Version
|
260
259
|
version: '0'
|
261
260
|
requirements: []
|
262
|
-
|
263
|
-
rubygems_version: 2.7.6
|
261
|
+
rubygems_version: 3.0.6
|
264
262
|
signing_key:
|
265
263
|
specification_version: 4
|
266
264
|
summary: Polls for biovision-based applications
|
@@ -1,46 +0,0 @@
|
|
1
|
-
class PollImageUploader < CarrierWave::Uploader::Base
|
2
|
-
include CarrierWave::MiniMagick
|
3
|
-
include CarrierWave::BombShelter
|
4
|
-
|
5
|
-
storage :file
|
6
|
-
|
7
|
-
def max_pixel_dimensions
|
8
|
-
[3840, 3840]
|
9
|
-
end
|
10
|
-
|
11
|
-
def store_dir
|
12
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id/10000.floor}/#{model.id/100.floor}/#{model.id}"
|
13
|
-
end
|
14
|
-
|
15
|
-
process :auto_orient
|
16
|
-
|
17
|
-
def auto_orient
|
18
|
-
manipulate! do |image|
|
19
|
-
image.tap(&:auto_orient)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
version :medium_2x do
|
24
|
-
resize_to_fit 1280, 1280
|
25
|
-
end
|
26
|
-
|
27
|
-
version :medium, from_version: :medium_2x do
|
28
|
-
resize_to_fit 640, 640
|
29
|
-
end
|
30
|
-
|
31
|
-
version :small, from_version: :medium do
|
32
|
-
resize_to_fit 320, 320
|
33
|
-
end
|
34
|
-
|
35
|
-
version :preview_2x, from_version: :small do
|
36
|
-
resize_to_fit 160, 160
|
37
|
-
end
|
38
|
-
|
39
|
-
version :preview, from_version: :preview_2x do
|
40
|
-
resize_to_fit 80, 80
|
41
|
-
end
|
42
|
-
|
43
|
-
def extension_white_list
|
44
|
-
%w(jpg jpeg png)
|
45
|
-
end
|
46
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<% if current_user_in_group?(:poll_managers) %>
|
2
|
-
<nav>
|
3
|
-
<div class="heading" id="biovision-poll-nav-heading">
|
4
|
-
<%= t('.heading') %>
|
5
|
-
</div>
|
6
|
-
<ul aria-labelledby="biovision-poll-nav-heading">
|
7
|
-
<li><%= render 'admin/polls/nav_item' %></li>
|
8
|
-
</ul>
|
9
|
-
</nav>
|
10
|
-
<% end %>
|
@@ -1,70 +0,0 @@
|
|
1
|
-
class CreatePolls < ActiveRecord::Migration[5.1]
|
2
|
-
def up
|
3
|
-
unless Poll.table_exists?
|
4
|
-
create_table :polls do |t|
|
5
|
-
t.timestamps
|
6
|
-
t.references :user, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
-
t.integer :region_id, index: true
|
8
|
-
t.references :agent, foreign_key: { on_update: :cascade, on_delete: :nullify }
|
9
|
-
t.inet :ip
|
10
|
-
t.integer :pollable_id
|
11
|
-
t.string :pollable_type
|
12
|
-
t.boolean :visible, default: true, null: false
|
13
|
-
t.boolean :active, default: true, null: false
|
14
|
-
t.boolean :show_on_homepage, default: true, null: false
|
15
|
-
t.boolean :anonymous_votes, default: true, null: false
|
16
|
-
t.boolean :open_results, default: true, null: false
|
17
|
-
t.boolean :exclusive, default: false, null: false
|
18
|
-
t.date :end_date
|
19
|
-
t.integer :poll_questions_count, default: 0, null: false
|
20
|
-
t.integer :comments_count, default: 0, null: false
|
21
|
-
t.string :image
|
22
|
-
t.string :name
|
23
|
-
t.string :description
|
24
|
-
end
|
25
|
-
|
26
|
-
if Gem.loaded_specs.key?('biovision-regions')
|
27
|
-
add_foreign_key :polls, :regions, column: :region_id, on_update: :cascade, on_delete: :cascade
|
28
|
-
end
|
29
|
-
|
30
|
-
create_privileges
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def down
|
35
|
-
if Poll.table_exists?
|
36
|
-
drop_table :polls
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def create_privileges
|
43
|
-
Privilege.create(
|
44
|
-
slug: 'chief_poll_manager',
|
45
|
-
name: 'Главный управляющий опросами',
|
46
|
-
administrative: true
|
47
|
-
)
|
48
|
-
chief = Privilege.find_by!(slug: 'chief_poll_manager')
|
49
|
-
|
50
|
-
Privilege.create(
|
51
|
-
slug: 'poll_manager',
|
52
|
-
name: 'Управляющий опросами центра',
|
53
|
-
parent_id: chief,
|
54
|
-
administrative: true
|
55
|
-
)
|
56
|
-
Privilege.create(
|
57
|
-
slug: 'regional_poll_manager',
|
58
|
-
name: 'Управляющий опросами региона',
|
59
|
-
parent_id: chief,
|
60
|
-
regional: true,
|
61
|
-
administrative: true
|
62
|
-
)
|
63
|
-
|
64
|
-
PrivilegeGroup.create(slug: 'poll_managers', name: 'Управляющие опросами')
|
65
|
-
group = PrivilegeGroup.find_by!(slug: 'poll_managers')
|
66
|
-
|
67
|
-
group.add_privilege(chief)
|
68
|
-
chief.children.each { |privilege| group.add_privilege(privilege) }
|
69
|
-
end
|
70
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
class CreatePollQuestions < ActiveRecord::Migration[5.1]
|
2
|
-
def up
|
3
|
-
unless PollQuestion.table_exists?
|
4
|
-
create_table :poll_questions do |t|
|
5
|
-
t.timestamps
|
6
|
-
t.references :poll, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
-
t.integer :priority, limit: 2, default: 1, null: false
|
8
|
-
t.integer :poll_answers_count, default: 0, null: false
|
9
|
-
t.boolean :multiple_choice, default: false, null: false
|
10
|
-
t.string :image
|
11
|
-
t.string :text, null: false
|
12
|
-
t.string :comment
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def down
|
18
|
-
if PollQuestion.table_exists?
|
19
|
-
drop_table :poll_questions
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class CreatePollAnswers < ActiveRecord::Migration[5.1]
|
2
|
-
def up
|
3
|
-
unless PollAnswer.table_exists?
|
4
|
-
create_table :poll_answers do |t|
|
5
|
-
t.timestamps
|
6
|
-
t.references :poll_question, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
-
t.integer :priority, limit: 2, default: 1, null: false
|
8
|
-
t.integer :poll_votes_count, default: 0, null: false
|
9
|
-
t.string :image
|
10
|
-
t.string :text, null: false
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def down
|
16
|
-
if PollAnswer.table_exists?
|
17
|
-
drop_table :poll_answers
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
class CreatePollVotes < ActiveRecord::Migration[5.1]
|
2
|
-
def up
|
3
|
-
unless PollVote.table_exists?
|
4
|
-
create_table :poll_votes do |t|
|
5
|
-
t.timestamps
|
6
|
-
t.references :poll_answer, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
-
t.references :user, foreign_key: true, on_update: :cascade, on_delete: :cascade
|
8
|
-
t.references :agent, foreign_key: true, on_update: :cascade, on_delete: :nullify
|
9
|
-
t.inet :ip
|
10
|
-
t.string :slug
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def down
|
16
|
-
if PollVote.table_exists?
|
17
|
-
drop_table :poll_votes
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class CreatePollUsers < ActiveRecord::Migration[5.2]
|
2
|
-
def up
|
3
|
-
unless PollUser.table_exists?
|
4
|
-
create_table :poll_users do |t|
|
5
|
-
t.timestamps
|
6
|
-
t.references :poll, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
7
|
-
t.references :user, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
unless column_exists? :polls, :exclusive
|
12
|
-
add_column :polls, :exclusive, :boolean, default: false, null: false
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def down
|
17
|
-
if PollUser.table_exists?
|
18
|
-
drop_table :poll_users
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|