decidim-consultations 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/commands/decidim/consultations/admin/update_consultation.rb +9 -4
- data/app/forms/decidim/consultations/admin/consultation_form.rb +5 -6
- data/app/forms/decidim/consultations/admin/question_form.rb +5 -6
- data/app/models/decidim/consultation.rb +9 -0
- data/app/models/decidim/consultations/question.rb +12 -1
- data/app/models/decidim/consultations/response.rb +4 -0
- data/app/models/decidim/consultations/response_group.rb +4 -0
- data/app/presenters/decidim/consultations/question_stats_presenter.rb +1 -1
- data/app/views/decidim/consultations/questions/_vote_modal_confirm.html.erb +1 -1
- data/app/views/decidim/consultations/questions/show.html.erb +1 -1
- data/app/views/layouts/decidim/consultation.html.erb +1 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/bg.yml +1 -0
- data/config/locales/cs.yml +2 -2
- data/config/locales/da.yml +1 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/fr.yml +2 -2
- data/config/locales/hr.yml +1 -0
- data/config/locales/is.yml +185 -0
- data/config/locales/ja-JP.yml +39 -39
- data/config/locales/ja.yml +367 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/{lv-LV.yml → lv.yml} +0 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/no.yml +2 -0
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +10 -10
- data/config/locales/sl.yml +4 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +367 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200827154143_add_commentable_counter_cache_to_consultations.rb +9 -0
- data/lib/decidim/consultations/admin_engine.rb +1 -0
- data/lib/decidim/consultations/participatory_space.rb +17 -17
- data/lib/decidim/consultations/test/factories.rb +1 -0
- data/lib/decidim/consultations/version.rb +1 -1
- metadata +33 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac6cbb884a436f3a7dae1afc0ecaf4ad669d8017d7e828ff906055d9fe569eb7
|
4
|
+
data.tar.gz: e2dd3b3cd944c643306ae53cd65e9bddc504e7165203c03c2db565c7b78635cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a07bd3bf9559e042f343ac8a8ba5ca851d37eb78844f2ef69b9c832fede0ead52773b083eacbe121ee229634c177c7cf29164a2289a6fae2e3f51561df64e7
|
7
|
+
data.tar.gz: 0121a8c152378ae724b8ca813717f7f83db1f061e364fd45ae3b58a6f677cb89ba88da2dbe7fe467459cb306f7d05316524dcab412ddb1163b21a787b9b22c40
|
@@ -50,15 +50,20 @@ module Decidim
|
|
50
50
|
subtitle: form.subtitle,
|
51
51
|
description: form.description,
|
52
52
|
slug: form.slug,
|
53
|
-
banner_image: form.banner_image,
|
54
|
-
remove_banner_image: form.remove_banner_image,
|
55
53
|
highlighted_scope: form.highlighted_scope,
|
56
54
|
introductory_video_url: form.introductory_video_url,
|
57
55
|
start_voting_date: form.start_voting_date,
|
58
|
-
end_voting_date: form.end_voting_date
|
56
|
+
end_voting_date: form.end_voting_date
|
57
|
+
}.merge(uploader_attributes)
|
58
|
+
end
|
59
|
+
|
60
|
+
def uploader_attributes
|
61
|
+
{
|
62
|
+
banner_image: form.banner_image,
|
63
|
+
remove_banner_image: form.remove_banner_image,
|
59
64
|
introductory_image: form.introductory_image,
|
60
65
|
remove_introductory_image: form.remove_introductory_image
|
61
|
-
}
|
66
|
+
}.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
# A form object used to create consultations from the admin dashboard.
|
7
7
|
class ConsultationForm < Form
|
8
8
|
include TranslatableAttributes
|
9
|
+
include Decidim::HasUploadValidations
|
9
10
|
|
10
11
|
mimic :consultation
|
11
12
|
|
@@ -29,12 +30,10 @@ module Decidim
|
|
29
30
|
validates :end_voting_date, presence: true, date: { after_or_equal_to: :start_voting_date }
|
30
31
|
validate :slug_uniqueness
|
31
32
|
|
32
|
-
validates :banner_image,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } },
|
37
|
-
file_content_type: { allow: ["image/jpeg", "image/png"] }
|
33
|
+
validates :banner_image, passthru: { to: Decidim::Consultation }
|
34
|
+
validates :introductory_image, passthru: { to: Decidim::Consultation }
|
35
|
+
|
36
|
+
alias organization current_organization
|
38
37
|
|
39
38
|
def highlighted_scope
|
40
39
|
@highlighted_scope ||= current_organization.scopes.find_by(id: decidim_highlighted_scope_id)
|
@@ -6,6 +6,7 @@ module Decidim
|
|
6
6
|
# A form object used to create questions for a consultation from the admin dashboard.
|
7
7
|
class QuestionForm < Form
|
8
8
|
include TranslatableAttributes
|
9
|
+
include Decidim::HasUploadValidations
|
9
10
|
|
10
11
|
mimic :question
|
11
12
|
|
@@ -32,17 +33,15 @@ module Decidim
|
|
32
33
|
validates :slug, presence: true, format: { with: Decidim::Consultations::Question.slug_format }
|
33
34
|
validates :title, :promoter_group, :participatory_scope, :subtitle, :what_is_decided, translatable_presence: true
|
34
35
|
validates :decidim_scope_id, presence: true
|
35
|
-
validates :hero_image,
|
36
|
-
|
37
|
-
file_content_type: { allow: ["image/jpeg", "image/png"] }
|
38
|
-
validates :banner_image,
|
39
|
-
file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } },
|
40
|
-
file_content_type: { allow: ["image/jpeg", "image/png"] }
|
36
|
+
validates :hero_image, passthru: { to: Decidim::Consultations::Question }
|
37
|
+
validates :banner_image, passthru: { to: Decidim::Consultations::Question }
|
41
38
|
validate :slug_uniqueness
|
42
39
|
validates :origin_scope, :origin_title, translatable_presence: true, if: :has_origin_data?
|
43
40
|
validates :i_frame_url, presence: true, if: :external_voting
|
44
41
|
validates :order, numericality: { only_integer: true, allow_nil: true, allow_blank: true }
|
45
42
|
|
43
|
+
alias organization current_organization
|
44
|
+
|
46
45
|
private
|
47
46
|
|
48
47
|
def slug_uniqueness
|
@@ -12,6 +12,10 @@ module Decidim
|
|
12
12
|
include Decidim::ParticipatorySpaceResourceable
|
13
13
|
include Decidim::Randomable
|
14
14
|
include Decidim::Searchable
|
15
|
+
include Decidim::HasUploadValidations
|
16
|
+
include Decidim::TranslatableResource
|
17
|
+
|
18
|
+
translatable_fields :title, :subtitle, :description
|
15
19
|
|
16
20
|
belongs_to :organization,
|
17
21
|
foreign_key: "decidim_organization_id",
|
@@ -27,10 +31,15 @@ module Decidim
|
|
27
31
|
inverse_of: :consultation,
|
28
32
|
dependent: :destroy
|
29
33
|
|
34
|
+
alias component_ids question_ids
|
35
|
+
|
30
36
|
validates :slug, uniqueness: { scope: :organization }
|
31
37
|
validates :slug, presence: true, format: { with: Decidim::Consultation.slug_format }
|
32
38
|
|
39
|
+
validates_upload :banner_image
|
33
40
|
mount_uploader :banner_image, Decidim::BannerImageUploader
|
41
|
+
|
42
|
+
validates_upload :introductory_image
|
34
43
|
mount_uploader :introductory_image, Decidim::BannerImageUploader
|
35
44
|
|
36
45
|
scope :upcoming, -> { published.where("start_voting_date > ?", Time.now.utc) }
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
include Decidim::HasResourcePermission
|
8
8
|
include Decidim::Participable
|
9
9
|
include Decidim::Publicable
|
10
|
-
include Decidim::
|
10
|
+
include Decidim::ScopableParticipatorySpace
|
11
11
|
include Decidim::Comments::Commentable
|
12
12
|
include Decidim::Followable
|
13
13
|
include Decidim::HasAttachments
|
@@ -16,6 +16,10 @@ module Decidim
|
|
16
16
|
include Decidim::Loggable
|
17
17
|
include Decidim::ParticipatorySpaceResourceable
|
18
18
|
include Decidim::Randomable
|
19
|
+
include Decidim::HasUploadValidations
|
20
|
+
include Decidim::TranslatableResource
|
21
|
+
|
22
|
+
translatable_fields :title, :subtitle, :what_is_decided, :promoter_group, :participatory_scope, :question_context, :origin_scope, :origin_title, :instructions
|
19
23
|
|
20
24
|
belongs_to :consultation,
|
21
25
|
foreign_key: "decidim_consultation_id",
|
@@ -51,7 +55,10 @@ module Decidim
|
|
51
55
|
dependent: :destroy,
|
52
56
|
as: :participatory_space
|
53
57
|
|
58
|
+
validates_upload :hero_image
|
54
59
|
mount_uploader :hero_image, Decidim::HeroImageUploader
|
60
|
+
|
61
|
+
validates_upload :banner_image
|
55
62
|
mount_uploader :banner_image, Decidim::BannerImageUploader
|
56
63
|
|
57
64
|
default_scope { order(order: :asc) }
|
@@ -193,6 +200,10 @@ module Decidim
|
|
193
200
|
def allow_resource_permissions?
|
194
201
|
true
|
195
202
|
end
|
203
|
+
|
204
|
+
def attachment_context
|
205
|
+
:admin
|
206
|
+
end
|
196
207
|
end
|
197
208
|
end
|
198
209
|
end
|
@@ -3,6 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Consultations
|
5
5
|
class Response < ApplicationRecord
|
6
|
+
include Decidim::TranslatableResource
|
7
|
+
|
8
|
+
translatable_fields :title
|
9
|
+
|
6
10
|
belongs_to :question,
|
7
11
|
foreign_key: "decidim_consultations_questions_id",
|
8
12
|
class_name: "Decidim::Consultations::Question",
|
@@ -3,6 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Consultations
|
5
5
|
class ResponseGroup < ApplicationRecord
|
6
|
+
include Decidim::TranslatableResource
|
7
|
+
|
8
|
+
translatable_fields :title
|
9
|
+
|
6
10
|
belongs_to :question,
|
7
11
|
foreign_key: "decidim_consultations_questions_id",
|
8
12
|
class_name: "Decidim::Consultations::Question",
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h3 class="reveal__title">
|
4
4
|
<%= t "questions.vote_modal_confirm.title", scope: "decidim" %>
|
5
5
|
</h3>
|
6
|
-
<button class="close-button" data-close aria-label="<%= t("questions.vote_modal_confirm.close_modal", scope: "decidim")
|
6
|
+
<button class="close-button" data-close aria-label="<%= t("questions.vote_modal_confirm.close_modal", scope: "decidim") %>" type="button">
|
7
7
|
<span aria-hidden="true">×</span>
|
8
8
|
</button>
|
9
9
|
</div>
|
@@ -36,7 +36,7 @@
|
|
36
36
|
<%= content_for :question_header_details do %>
|
37
37
|
<div id="question-header-details" class="row consultations-home-intro">
|
38
38
|
<div class="columns medium-5">
|
39
|
-
<%= image_tag current_question.hero_image&.url, alt: t("question.hero_image", scope: "activemodel.attributes") %>
|
39
|
+
<%= image_tag current_question.hero_image&.url, alt: t("question.hero_image", scope: "activemodel.attributes") if current_question.hero_image&.url %>
|
40
40
|
</div>
|
41
41
|
|
42
42
|
<div class="columns medium-5">
|
@@ -0,0 +1 @@
|
|
1
|
+
am:
|
@@ -0,0 +1 @@
|
|
1
|
+
bg:
|
data/config/locales/cs.yml
CHANGED
@@ -3,7 +3,7 @@ cs:
|
|
3
3
|
attributes:
|
4
4
|
consultation:
|
5
5
|
banner_image: Obrázek banneru
|
6
|
-
decidim_highlighted_scope_id:
|
6
|
+
decidim_highlighted_scope_id: Zvýrazněná oblast působnosti
|
7
7
|
description: Popis
|
8
8
|
end_voting_date: Hlasování končí
|
9
9
|
introductory_image: Úvodní obrázek
|
@@ -22,7 +22,7 @@ cs:
|
|
22
22
|
instructions: Další pokyny pro hlasování
|
23
23
|
max_votes: Maximální počet hlasů
|
24
24
|
min_votes: Minimální počet hlasů
|
25
|
-
origin_scope:
|
25
|
+
origin_scope: Oblast působnosti
|
26
26
|
origin_title: Původ
|
27
27
|
origin_url: Původní URL
|
28
28
|
participatory_scope: Rozsah účastníků
|
@@ -0,0 +1 @@
|
|
1
|
+
da:
|
@@ -0,0 +1 @@
|
|
1
|
+
eo:
|
@@ -0,0 +1 @@
|
|
1
|
+
et:
|
data/config/locales/fr.yml
CHANGED
@@ -348,12 +348,12 @@ fr:
|
|
348
348
|
verification_required: Vérifier votre compte pour voter
|
349
349
|
vote: Voter
|
350
350
|
vote_modal:
|
351
|
-
close_modal: Fermer la fenêtre
|
351
|
+
close_modal: Fermer la fenêtre de dialogue
|
352
352
|
contextual_help: Veuillez sélectionner une option.
|
353
353
|
title: 'Votation : soutien aux questions'
|
354
354
|
vote_modal_confirm:
|
355
355
|
change: Modifier
|
356
|
-
close_modal: Fermer la fenêtre
|
356
|
+
close_modal: Fermer la fenêtre de dialogue
|
357
357
|
confirm: Confirmer
|
358
358
|
contextual_help: Veuillez confirmer l'option sélectionnée.
|
359
359
|
title: 'Consultation : confirmer le soutien'
|
@@ -0,0 +1 @@
|
|
1
|
+
hr:
|
@@ -0,0 +1,185 @@
|
|
1
|
+
is:
|
2
|
+
activemodel:
|
3
|
+
attributes:
|
4
|
+
consultation:
|
5
|
+
banner_image: Banner image
|
6
|
+
decidim_highlighted_scope_id: Hápunktur sviðsins
|
7
|
+
description: Lýsing
|
8
|
+
introductory_image: Inngangs mynd
|
9
|
+
introductory_video_url: Inngangur vídeó URL
|
10
|
+
slug: URL slug
|
11
|
+
subtitle: Texti
|
12
|
+
title: Titill
|
13
|
+
question:
|
14
|
+
banner_image: Banner image
|
15
|
+
decidim_scope_id: Borgarsvæði
|
16
|
+
hashtag: Kassamerki
|
17
|
+
hero_image: Heimsmynd
|
18
|
+
i_frame_url: Vefslóð fyrir utanaðkomandi atkvæðagreiðslur
|
19
|
+
origin_scope: Umfang
|
20
|
+
origin_title: Uppruni
|
21
|
+
origin_url: Uppruni vefslóð
|
22
|
+
participatory_scope: Þátttökuskilyrði
|
23
|
+
promoter_group: Framkvæmdarhópur
|
24
|
+
question_context: Samhengi
|
25
|
+
reference: Tilvísun
|
26
|
+
scope: Borgarsvæði
|
27
|
+
slug: URL slug
|
28
|
+
subtitle: Texti
|
29
|
+
vote: Ytri atkvæðakerfi
|
30
|
+
what_is_decided: Hvað er ákveðið
|
31
|
+
errors:
|
32
|
+
vote:
|
33
|
+
decidim_consultations_response_id:
|
34
|
+
not_found: Svar fannst ekki.
|
35
|
+
decidim:
|
36
|
+
admin:
|
37
|
+
actions:
|
38
|
+
publish_results: Birta niðurstöður
|
39
|
+
unpublish_results: Afritaðu niðurstöðurnar
|
40
|
+
consultations:
|
41
|
+
create:
|
42
|
+
success: Samráð hefur verið búið til.
|
43
|
+
edit:
|
44
|
+
update: Uppfæra
|
45
|
+
form:
|
46
|
+
slug_help: 'Vefslóðir eru notaðir til að búa til slóðir sem benda til þessa samráðs. Aðeins viðurkennir stafir, tölur og bindur og verður að byrja með stafi. Dæmi: %{url}'
|
47
|
+
title: Almennar upplýsingar
|
48
|
+
index:
|
49
|
+
not_published: Ekki birt
|
50
|
+
published: Published
|
51
|
+
new:
|
52
|
+
create: Búa til
|
53
|
+
title: Nýtt samráð
|
54
|
+
update:
|
55
|
+
success: Samráð uppfærður með góðum árangri.
|
56
|
+
menu:
|
57
|
+
consultations: Samráð
|
58
|
+
consultations_submenu:
|
59
|
+
info: Upplýsingar
|
60
|
+
questions: Spurningar
|
61
|
+
questions_submenu:
|
62
|
+
components: Hluti
|
63
|
+
consultation: Samráð
|
64
|
+
info: Upplýsingar
|
65
|
+
responses: Svör
|
66
|
+
models:
|
67
|
+
consultation:
|
68
|
+
fields:
|
69
|
+
created_at: Búið til á
|
70
|
+
published: Published
|
71
|
+
title: Titill
|
72
|
+
name:
|
73
|
+
one: Samráð
|
74
|
+
other: Samráð
|
75
|
+
question:
|
76
|
+
fields:
|
77
|
+
created_at: Búið til á
|
78
|
+
published: Published
|
79
|
+
title: Titill
|
80
|
+
name:
|
81
|
+
one: Spurning
|
82
|
+
other: Spurningar
|
83
|
+
response:
|
84
|
+
fields:
|
85
|
+
created_at: Búið til á
|
86
|
+
title: Titill
|
87
|
+
name:
|
88
|
+
one: Svar
|
89
|
+
other: Svör
|
90
|
+
questions:
|
91
|
+
create:
|
92
|
+
success: Spurning búin til.
|
93
|
+
edit:
|
94
|
+
update: Uppfæra
|
95
|
+
form:
|
96
|
+
title: Almennar upplýsingar
|
97
|
+
index:
|
98
|
+
not_published: Ekki birt
|
99
|
+
published: Published
|
100
|
+
new:
|
101
|
+
create: Búa til
|
102
|
+
title: Ný spurning
|
103
|
+
responses:
|
104
|
+
create:
|
105
|
+
success: Svar búin til.
|
106
|
+
edit:
|
107
|
+
update: Uppfæra
|
108
|
+
form:
|
109
|
+
title: Almennar upplýsingar
|
110
|
+
new:
|
111
|
+
create: Búa til
|
112
|
+
title: Nýtt svar
|
113
|
+
titles:
|
114
|
+
consultations: Samráð
|
115
|
+
questions: Spurningar
|
116
|
+
responses: Svör
|
117
|
+
consultations:
|
118
|
+
consultation:
|
119
|
+
view_results: Skoða niðurstöður
|
120
|
+
consultation_card:
|
121
|
+
view_results: Skoða niðurstöður
|
122
|
+
consultations:
|
123
|
+
orders:
|
124
|
+
label: 'Raða samráð með:'
|
125
|
+
random: Handahófi
|
126
|
+
recent: Síðast
|
127
|
+
count:
|
128
|
+
title:
|
129
|
+
one: "%{count} samráð"
|
130
|
+
other: "%{count} samráð"
|
131
|
+
filters:
|
132
|
+
active: Virkur
|
133
|
+
all: Allt
|
134
|
+
finished: Lokið
|
135
|
+
search: Leita
|
136
|
+
upcoming: Næstu
|
137
|
+
filters_small_view:
|
138
|
+
close_modal: Lokaðu glugga
|
139
|
+
filter: Sía
|
140
|
+
filter_by: Sía eftir
|
141
|
+
unfold: Fella út
|
142
|
+
index:
|
143
|
+
title: Samráð
|
144
|
+
pages:
|
145
|
+
home:
|
146
|
+
highlighted_consultations:
|
147
|
+
active_consultations: Virkt samráð
|
148
|
+
question:
|
149
|
+
take_part: Taka þátt
|
150
|
+
view_results: Skoða niðurstöður
|
151
|
+
votes_out_of:
|
152
|
+
one: kjósa út úr
|
153
|
+
other: atkvæði úr
|
154
|
+
menu:
|
155
|
+
consultations: Samráð
|
156
|
+
questions:
|
157
|
+
results:
|
158
|
+
title: Niðurstöður
|
159
|
+
show:
|
160
|
+
read_more: Lestu meira
|
161
|
+
statistics:
|
162
|
+
assistants_count_title: Aðstoðarmenn
|
163
|
+
comments_count_title: Athugasemdir
|
164
|
+
meetings_count_title: Fundir
|
165
|
+
technical_info:
|
166
|
+
technical_data: Tæknilegar upplýsingar
|
167
|
+
vote_button:
|
168
|
+
already_voted: Already kusu
|
169
|
+
starting_from: Byrjar frá %{date}
|
170
|
+
vote: Kjósa
|
171
|
+
vote_modal_confirm:
|
172
|
+
change: Breyta
|
173
|
+
confirm: Staðfesta
|
174
|
+
contextual_help: Vinsamlegast staðfestu valinn valkost.
|
175
|
+
layouts:
|
176
|
+
decidim:
|
177
|
+
admin:
|
178
|
+
question:
|
179
|
+
attachments: Viðhengi
|
180
|
+
categories: Flokkar
|
181
|
+
question_components:
|
182
|
+
question_menu_item: Spurningin
|
183
|
+
unfold: Fella út
|
184
|
+
question_header:
|
185
|
+
back_to_consultation: Sjá öll samráð
|