decidim-consultations 0.27.5 → 0.27.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/decidim/consultations/consultation_widgets_controller.rb +12 -1
- data/app/controllers/decidim/consultations/question_widgets_controller.rb +11 -1
- data/app/permissions/decidim/consultations/permissions.rb +21 -1
- data/app/views/decidim/consultations/consultation_widgets/show.html.erb +3 -0
- data/config/locales/bg.yml +20 -0
- data/config/locales/de.yml +3 -3
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +5 -0
- data/decidim-consultations.gemspec +32 -0
- data/lib/decidim/consultations/admin_engine.rb +1 -1
- data/lib/decidim/consultations/version.rb +1 -1
- metadata +18 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70d308f959b191e49afa7cddadb93a6c1375e4690906f8078c71799d27ba0ea7
|
4
|
+
data.tar.gz: c19d420f1e83465d167ee2cbbb35cda7c3db64d3924fb9ab912ea553835fcc64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50752f7ece621a07b4b50164a29b60c6f36c6838936b2a935823dd56d98467e61f488e8e0dfb02d81ab11ff1d1e435859ef7f009c972444dbb810638d4174b9
|
7
|
+
data.tar.gz: 29287d203a004965f01674b3212e95760babf8f0bdad446202c3236f802c13911b315242e84cdad57e755cb1f8ad8800f31539bda49c5811ddc2bb99a3e19d09
|
@@ -4,13 +4,20 @@ module Decidim
|
|
4
4
|
module Consultations
|
5
5
|
class ConsultationWidgetsController < Decidim::WidgetsController
|
6
6
|
helper Decidim::SanitizeHelper
|
7
|
+
helper ConsultationsHelper
|
7
8
|
|
8
9
|
layout false
|
9
10
|
|
11
|
+
def show
|
12
|
+
enforce_permission_to :embed, :participatory_space, current_participatory_space: model if model
|
13
|
+
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
10
17
|
private
|
11
18
|
|
12
19
|
def model
|
13
|
-
@model ||= Consultation.find_by(slug: params[:consultation_slug])
|
20
|
+
@model ||= Consultation.where(organization: current_organization).published.find_by(slug: params[:consultation_slug])
|
14
21
|
end
|
15
22
|
|
16
23
|
def current_participatory_space
|
@@ -20,6 +27,10 @@ module Decidim
|
|
20
27
|
def iframe_url
|
21
28
|
@iframe_url ||= consultation_consultation_widget_url(model)
|
22
29
|
end
|
30
|
+
|
31
|
+
def permission_class_chain
|
32
|
+
::Decidim.permissions_registry.chain_for(::Decidim::Consultations::ApplicationController)
|
33
|
+
end
|
23
34
|
end
|
24
35
|
end
|
25
36
|
end
|
@@ -8,10 +8,16 @@ module Decidim
|
|
8
8
|
|
9
9
|
helper Decidim::SanitizeHelper
|
10
10
|
|
11
|
+
def show
|
12
|
+
enforce_permission_to :embed, :question, question: model if model
|
13
|
+
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
11
17
|
private
|
12
18
|
|
13
19
|
def model
|
14
|
-
@model ||= current_question
|
20
|
+
@model ||= current_question if current_question.published?
|
15
21
|
end
|
16
22
|
|
17
23
|
def current_participatory_space
|
@@ -21,6 +27,10 @@ module Decidim
|
|
21
27
|
def iframe_url
|
22
28
|
@iframe_url ||= question_question_widget_url(model)
|
23
29
|
end
|
30
|
+
|
31
|
+
def permission_class_chain
|
32
|
+
::Decidim.permissions_registry.chain_for(::Decidim::Consultations::ApplicationController)
|
33
|
+
end
|
24
34
|
end
|
25
35
|
end
|
26
36
|
end
|
@@ -5,6 +5,8 @@ module Decidim
|
|
5
5
|
class Permissions < Decidim::DefaultPermissions
|
6
6
|
def permissions
|
7
7
|
allowed_public_anonymous_action?
|
8
|
+
allowed_public_embed_consultation_action?
|
9
|
+
allowed_public_embed_question_action?
|
8
10
|
|
9
11
|
return permission_action unless user
|
10
12
|
|
@@ -22,7 +24,7 @@ module Decidim
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def consultation
|
25
|
-
@consultation ||= context.fetch(:consultation, nil)
|
27
|
+
@consultation ||= context.fetch(:current_participatory_space, nil) || context.fetch(:consultation, nil)
|
26
28
|
end
|
27
29
|
|
28
30
|
def authorized?(permission_action, resource: nil)
|
@@ -45,6 +47,24 @@ module Decidim
|
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
50
|
+
def allowed_public_embed_consultation_action?
|
51
|
+
return unless permission_action.action == :embed &&
|
52
|
+
[:consultation, :participatory_space].include?(permission_action.subject) &&
|
53
|
+
consultation
|
54
|
+
|
55
|
+
return disallow! unless consultation.published?
|
56
|
+
|
57
|
+
allow!
|
58
|
+
end
|
59
|
+
|
60
|
+
def allowed_public_embed_question_action?
|
61
|
+
return unless permission_action.action == :embed && permission_action.subject == :question && question
|
62
|
+
|
63
|
+
return disallow! unless question.published?
|
64
|
+
|
65
|
+
allow!
|
66
|
+
end
|
67
|
+
|
48
68
|
def allowed_public_action?
|
49
69
|
return unless permission_action.scope == :public
|
50
70
|
return unless permission_action.subject == :question
|
@@ -1,3 +1,6 @@
|
|
1
|
+
<p><%= translated_attribute(model.title) %></p>
|
2
|
+
<p><%= current_organization.name %></p>
|
3
|
+
|
1
4
|
<%= render partial: "decidim/consultations/consultations/consultation_details", locals: { consultation: model } %>
|
2
5
|
<%= render partial: "decidim/consultations/consultations/highlighted_questions", locals: { consultation: model } %>
|
3
6
|
<%= render partial: "decidim/consultations/consultations/regular_questions", locals: { consultation: model } %>
|
data/config/locales/bg.yml
CHANGED
@@ -1 +1,21 @@
|
|
1
|
+
---
|
1
2
|
bg:
|
3
|
+
activerecord:
|
4
|
+
errors:
|
5
|
+
models:
|
6
|
+
decidim/consultations/vote:
|
7
|
+
attributes:
|
8
|
+
question:
|
9
|
+
invalid_num_votes: Броят на гласовете е невалиден
|
10
|
+
decidim:
|
11
|
+
admin:
|
12
|
+
consultations:
|
13
|
+
deprecation_warning: Модулът за консултации ще бъде отхвърлен в близко бъдеще. Работим върху следващата криптографски защитена версия, наречена Гласувания.
|
14
|
+
question_configuration:
|
15
|
+
disable_external_voting: Моля, деактивирайте външното гласуване за разширени конфигурации
|
16
|
+
consultations:
|
17
|
+
last_activity:
|
18
|
+
new_question_at_html: "<span>Нов въпрос в(ъв) %{link}</span>"
|
19
|
+
question_votes:
|
20
|
+
create:
|
21
|
+
error: Възникна проблем с гласуването по въпроса
|
data/config/locales/de.yml
CHANGED
@@ -24,8 +24,8 @@ de:
|
|
24
24
|
max_votes: Maximale Anzahl von Stimmen
|
25
25
|
min_votes: Mindestanzahl von Stimmen
|
26
26
|
origin_scope: Umfang
|
27
|
-
origin_title:
|
28
|
-
origin_url:
|
27
|
+
origin_title: Herkunft
|
28
|
+
origin_url: Herkunfts--URL
|
29
29
|
participatory_scope: Partizipativer Bereich
|
30
30
|
promoter_group: Promoter-Gruppe
|
31
31
|
question_context: Kontext
|
@@ -267,7 +267,7 @@ de:
|
|
267
267
|
title: Konsultationen
|
268
268
|
last_activity:
|
269
269
|
new_consultation: Neue Konsultation
|
270
|
-
new_question_at_html: "<span>Neue Frage
|
270
|
+
new_question_at_html: "<span>Neue Frage auf %{link}</span>"
|
271
271
|
pages:
|
272
272
|
home:
|
273
273
|
highlighted_consultations:
|
@@ -0,0 +1 @@
|
|
1
|
+
he:
|
data/config/locales/hu.yml
CHANGED
@@ -95,6 +95,7 @@ hu:
|
|
95
95
|
create:
|
96
96
|
error: Hiba történt az új konzultáció létrehozása során.
|
97
97
|
success: Konzultáció létrehozása sikeres.
|
98
|
+
deprecation_warning: A konzultációk modul a közeljövőben elavulttá válik. Dolgozunk a következő kriptográfiailag biztonságos változaton, a Szavazásokon.
|
98
99
|
edit:
|
99
100
|
update: Frissítés
|
100
101
|
form:
|
@@ -361,6 +362,10 @@ hu:
|
|
361
362
|
actions:
|
362
363
|
comment: Megjegyzés
|
363
364
|
vote: Szavazás
|
365
|
+
question:
|
366
|
+
actions:
|
367
|
+
comment: Hozzászólás
|
368
|
+
vote: Szavazás
|
364
369
|
statistics:
|
365
370
|
consultations_count: Konzultációk
|
366
371
|
votes_count: Szavazások
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
|
+
|
5
|
+
require "decidim/consultations/version"
|
6
|
+
|
7
|
+
# Describe your gem and declare its dependencies:
|
8
|
+
Gem::Specification.new do |s|
|
9
|
+
s.version = Decidim::Consultations.version
|
10
|
+
s.authors = ["Juan Salvador Perez Garcia"]
|
11
|
+
s.email = ["jsperezg@gmail.com"]
|
12
|
+
s.license = "AGPL-3.0"
|
13
|
+
s.homepage = "https://github.com/decidim/decidim"
|
14
|
+
s.required_ruby_version = "~> 3.0.0"
|
15
|
+
|
16
|
+
s.name = "decidim-consultations"
|
17
|
+
s.summary = "Decidim consultations module"
|
18
|
+
s.description = "Extends Decidim adding a first level public consultation component"
|
19
|
+
|
20
|
+
s.files = Dir.chdir(__dir__) do
|
21
|
+
`git ls-files -z`.split("\x0").select do |f|
|
22
|
+
(File.expand_path(f) == __FILE__) ||
|
23
|
+
f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
s.add_dependency "decidim-admin", Decidim::Consultations.version
|
28
|
+
s.add_dependency "decidim-comments", Decidim::Consultations.version
|
29
|
+
s.add_dependency "decidim-core", Decidim::Consultations.version
|
30
|
+
|
31
|
+
s.add_development_dependency "decidim-dev", Decidim::Consultations.version
|
32
|
+
end
|
@@ -157,7 +157,7 @@ module Decidim
|
|
157
157
|
initializer "decidim_consultations.admin_consultation_components_menu" do
|
158
158
|
Decidim.menu :admin_consultation_components_menu do |menu|
|
159
159
|
current_participatory_space.components.each do |component|
|
160
|
-
caption =
|
160
|
+
caption = decidim_escape_translated(component.name)
|
161
161
|
if component.primary_stat.present?
|
162
162
|
caption += content_tag(:span, component.primary_stat, class: component.primary_stat.zero? ? "component-counter component-counter--off" : "component-counter")
|
163
163
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-consultations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.27.
|
4
|
+
version: 0.27.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Salvador Perez Garcia
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.27.
|
19
|
+
version: 0.27.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.27.
|
26
|
+
version: 0.27.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-comments
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.27.
|
33
|
+
version: 0.27.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.27.
|
40
|
+
version: 0.27.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim-core
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.27.
|
47
|
+
version: 0.27.6
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.27.
|
54
|
+
version: 0.27.6
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-dev
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.27.
|
61
|
+
version: 0.27.6
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.27.
|
68
|
+
version: 0.27.6
|
69
69
|
description: Extends Decidim adding a first level public consultation component
|
70
70
|
email:
|
71
71
|
- jsperezg@gmail.com
|
@@ -275,6 +275,7 @@ files:
|
|
275
275
|
- config/locales/ga-IE.yml
|
276
276
|
- config/locales/gl.yml
|
277
277
|
- config/locales/gn-PY.yml
|
278
|
+
- config/locales/he-IL.yml
|
278
279
|
- config/locales/hr-HR.yml
|
279
280
|
- config/locales/hr.yml
|
280
281
|
- config/locales/hu.yml
|
@@ -362,6 +363,7 @@ files:
|
|
362
363
|
- db/seeds/city.jpeg
|
363
364
|
- db/seeds/city2.jpeg
|
364
365
|
- db/seeds/homepage_image.jpg
|
366
|
+
- decidim-consultations.gemspec
|
365
367
|
- lib/decidim/api/consultation_question_type.rb
|
366
368
|
- lib/decidim/api/consultation_type.rb
|
367
369
|
- lib/decidim/consultations.rb
|
@@ -377,23 +379,23 @@ homepage: https://github.com/decidim/decidim
|
|
377
379
|
licenses:
|
378
380
|
- AGPL-3.0
|
379
381
|
metadata: {}
|
380
|
-
post_install_message:
|
382
|
+
post_install_message:
|
381
383
|
rdoc_options: []
|
382
384
|
require_paths:
|
383
385
|
- lib
|
384
386
|
required_ruby_version: !ruby/object:Gem::Requirement
|
385
387
|
requirements:
|
386
|
-
- - "
|
388
|
+
- - "~>"
|
387
389
|
- !ruby/object:Gem::Version
|
388
|
-
version:
|
390
|
+
version: 3.0.0
|
389
391
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
390
392
|
requirements:
|
391
393
|
- - ">="
|
392
394
|
- !ruby/object:Gem::Version
|
393
395
|
version: '0'
|
394
396
|
requirements: []
|
395
|
-
rubygems_version: 3.
|
396
|
-
signing_key:
|
397
|
+
rubygems_version: 3.2.22
|
398
|
+
signing_key:
|
397
399
|
specification_version: 4
|
398
400
|
summary: Decidim consultations module
|
399
401
|
test_files: []
|