decidim-consultations 0.20.1 → 0.21.0
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.
- checksums.yaml +4 -4
- data/app/controllers/concerns/decidim/consultations/admin/filterable.rb +27 -0
- data/app/controllers/decidim/consultations/admin/consultations_controller.rb +2 -1
- data/app/models/decidim/consultation.rb +5 -0
- data/app/types/decidim/consultations/consultation_question_type.rb +57 -0
- data/app/types/decidim/consultations/consultation_type.rb +32 -0
- data/app/views/decidim/consultations/admin/consultations/index.html.erb +3 -2
- data/config/locales/el.yml +1 -0
- data/lib/decidim/consultations/participatory_space.rb +2 -0
- data/lib/decidim/consultations/version.rb +1 -1
- metadata +14 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49594bb7fc09735417652233890356d9c46211a7b4ddb6db30810ff2c6642e29
|
4
|
+
data.tar.gz: 26af188d66c4fd24dac2073734df4e44bb3e5973c61da151e6357bfd79cdb6d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8ebe2d9701e95856f6a8f719d40e45604e7ddff55b295c1049f2b0407543161a69f61e1265fe81a9f5b9ae1f2479143630eff70baa393e5e827bbfe9596283
|
7
|
+
data.tar.gz: 6cac02425807edd81733577ebd9b53c341552f4156c7b54132248ba7fb55bb40e18b04e7f0aa5abfbbb55936184d7fdeb86ed3b7a3c2c36239f2b3aa75bf1a78
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Consultations
|
7
|
+
module Admin
|
8
|
+
module Filterable
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
included do
|
12
|
+
include Decidim::Admin::Filterable
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def base_query
|
17
|
+
collection
|
18
|
+
end
|
19
|
+
|
20
|
+
def filters
|
21
|
+
[:published_at_null]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -5,12 +5,13 @@ module Decidim
|
|
5
5
|
module Admin
|
6
6
|
# Controller in charge of managing consultation related requests
|
7
7
|
class ConsultationsController < Decidim::Consultations::Admin::ApplicationController
|
8
|
+
include Decidim::Consultations::Admin::Filterable
|
8
9
|
helper_method :current_consultation, :current_participatory_space
|
9
10
|
|
10
11
|
# GET /admin/consultations
|
11
12
|
def index
|
12
13
|
enforce_permission_to :read, :consultation
|
13
|
-
@consultations =
|
14
|
+
@consultations = filtered_collection
|
14
15
|
end
|
15
16
|
|
16
17
|
# GET /admin/consultations/new
|
@@ -96,5 +96,10 @@ module Decidim
|
|
96
96
|
def closed?
|
97
97
|
!active?
|
98
98
|
end
|
99
|
+
|
100
|
+
# Allow ransacker to search for a key in a hstore column (`title`.`en`)
|
101
|
+
ransacker :title do |parent|
|
102
|
+
Arel::Nodes::InfixOperation.new("->>", parent.table[:title], Arel::Nodes.build_quoted(I18n.locale.to_s))
|
103
|
+
end
|
99
104
|
end
|
100
105
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Consultations
|
5
|
+
# This type represents a consultation.
|
6
|
+
ConsultationQuestionType = GraphQL::ObjectType.define do
|
7
|
+
interfaces [
|
8
|
+
-> { Decidim::Core::ScopableInterface },
|
9
|
+
-> { Decidim::Core::AttachableInterface },
|
10
|
+
-> { Decidim::Comments::CommentableInterface }
|
11
|
+
]
|
12
|
+
|
13
|
+
name "ConsultationQuestion"
|
14
|
+
description "A consultation question"
|
15
|
+
|
16
|
+
field :id, !types.ID, "Internal ID of the question"
|
17
|
+
field :title, Decidim::Core::TranslatedFieldType, "Title of the question"
|
18
|
+
field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this question"
|
19
|
+
field :slug, !types.String, "Slug of the question"
|
20
|
+
field :createdAt, !Decidim::Core::DateTimeType, "The time this question was created", property: :created_at
|
21
|
+
field :updatedAt, !Decidim::Core::DateTimeType, "The time this question was updated", property: :updated_at
|
22
|
+
field :publishedAt, !Decidim::Core::DateTimeType, "The time this question was published", property: :published_at
|
23
|
+
|
24
|
+
field :components, types[Decidim::Core::ComponentInterface] do
|
25
|
+
description "Lists the components this space contains."
|
26
|
+
|
27
|
+
resolve ->(participatory_space, _args, _ctx) {
|
28
|
+
Decidim::Component.where(
|
29
|
+
participatory_space: participatory_space
|
30
|
+
).published
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
field :bannerImage, types.String, "The banner image for this question", property: :banner_image
|
35
|
+
field :heroImage, types.String, "The hero image for this question", property: :hero_image
|
36
|
+
|
37
|
+
field :whatIsDecided, Decidim::Core::TranslatedFieldType, "What is decided in this question", property: :what_is_decided
|
38
|
+
field :promoterGroup, Decidim::Core::TranslatedFieldType, "The promoter group of this question", property: :promoter_group
|
39
|
+
field :participatoryScope, Decidim::Core::TranslatedFieldType, "The participatory scope of this question", property: :participatory_scope
|
40
|
+
field :questionContext, Decidim::Core::TranslatedFieldType, "The context for this question", property: :question_context
|
41
|
+
field :reference, types.String, "The reference for this question", property: :reference
|
42
|
+
field :hashtag, types.String, "The hashtag of this question", property: :hashtag
|
43
|
+
field :votesCount, types.Int, "The number of votes in this question", property: :votes_count
|
44
|
+
field :originScope, Decidim::Core::TranslatedFieldType, "The origin scope of this question", property: :origin_scope
|
45
|
+
field :originTitle, Decidim::Core::TranslatedFieldType, "The origin title of this question", property: :origin_title
|
46
|
+
field :originUrl, types.String, "The origin URL for this question", property: :origin_url
|
47
|
+
field :iFrameUrl, types.String, "The iframe URL for this question", property: :i_frame_url
|
48
|
+
field :externalVoting, types.Boolean, "If the question has external voting", property: :external_voting
|
49
|
+
field :responsesCount, types.Int, "The number of responses for this question", property: :responses_count
|
50
|
+
field :order, types.Int, "The order in which the question should be represented", property: :order
|
51
|
+
field :maxVotes, types.Int, "The maximum number of votes in this question", property: :max_votes
|
52
|
+
field :minVotes, types.Int, "The minimum number of votes in this question", property: :min_votes
|
53
|
+
field :responseGroupsCount, types.Int, "The number of group responses for this question", property: :response_groups_count
|
54
|
+
field :instructions, Decidim::Core::TranslatedFieldType, "Instructions for this question", property: :instructions
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Consultations
|
5
|
+
# This type represents a consultation.
|
6
|
+
ConsultationType = GraphQL::ObjectType.define do
|
7
|
+
interfaces [
|
8
|
+
-> { Decidim::Core::ParticipatorySpaceInterface }
|
9
|
+
]
|
10
|
+
|
11
|
+
name "Consultation"
|
12
|
+
description "A consultation"
|
13
|
+
|
14
|
+
field :subtitle, Decidim::Core::TranslatedFieldType, "The subtitle of this consultation"
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this consultation"
|
16
|
+
field :slug, !types.String, "Slug of this consultation"
|
17
|
+
field :createdAt, !Decidim::Core::DateTimeType, "The time this consultation was created", property: :created_at
|
18
|
+
field :updatedAt, !Decidim::Core::DateTimeType, "The time this consultation was updated", property: :updated_at
|
19
|
+
field :publishedAt, !Decidim::Core::DateTimeType, "The time this consultation was published", property: :published_at
|
20
|
+
|
21
|
+
field :introductoryVideoUrl, types.String, "The introductory video url for this consultation", property: :introductory_video_url
|
22
|
+
field :introductoryImage, types.String, "The introductory image for this consultation", property: :introductory_image
|
23
|
+
field :bannerImage, types.String, "The banner image for this consultation", property: :banner_image
|
24
|
+
field :highlightedScope, Decidim::Core::ScopeApiType, "This is the highlighted scope of this consultation", property: :highlighted_scope
|
25
|
+
field :startVotingDate, Decidim::Core::DateType, "Start date of the voting for this consultation", property: :start_voting_date
|
26
|
+
field :endVotingDate, Decidim::Core::DateType, "End date of the voting for this consultation", property: :end_voting_date
|
27
|
+
field :resultsPublishedAt, Decidim::Core::DateType, "Date when the results have been published", property: :results_published_at
|
28
|
+
|
29
|
+
field :questions, types[Decidim::Consultations::ConsultationQuestionType], ""
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div class="card" id="consultations">
|
1
|
+
<div class="card with-overflow" id="consultations">
|
2
2
|
<div class="card-divider">
|
3
3
|
<h2 class="card-title">
|
4
4
|
<%= t "decidim.admin.titles.consultations" %>
|
@@ -6,13 +6,14 @@
|
|
6
6
|
["new", "consultation"], class: "button tiny button--title" if allowed_to? :create, :consultation %>
|
7
7
|
</h2>
|
8
8
|
</div>
|
9
|
+
<%= admin_filter_selector %>
|
9
10
|
<div class="card-section">
|
10
11
|
<div class="table-scroll">
|
11
12
|
<table class="table-list">
|
12
13
|
<thead>
|
13
14
|
<tr>
|
14
15
|
<th><%= t("models.consultation.fields.title", scope: "decidim.admin") %></th>
|
15
|
-
<th><%= t("models.consultation.fields.created_at", scope: "decidim.admin") %></th>
|
16
|
+
<th><%= sort_link(query, :created_at, t("models.consultation.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
16
17
|
<th class="table-list__actions">
|
17
18
|
<%= t("models.consultation.fields.published", scope: "decidim.admin") %>
|
18
19
|
</th>
|
@@ -0,0 +1 @@
|
|
1
|
+
el:
|
@@ -10,6 +10,8 @@ Decidim.register_participatory_space(:consultations) do |participatory_space|
|
|
10
10
|
Decidim::Consultation.where(organization: organization)
|
11
11
|
end
|
12
12
|
|
13
|
+
participatory_space.query_type = "Decidim::Consultations::ConsultationType"
|
14
|
+
|
13
15
|
participatory_space.context(:public) do |context|
|
14
16
|
context.engine = Decidim::Consultations::Engine
|
15
17
|
context.layout = "layouts/decidim/question"
|
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.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Salvador Perez Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-08 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.
|
19
|
+
version: 0.21.0
|
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.
|
26
|
+
version: 0.21.0
|
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.
|
33
|
+
version: 0.21.0
|
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.
|
40
|
+
version: 0.21.0
|
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.
|
47
|
+
version: 0.21.0
|
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.
|
54
|
+
version: 0.21.0
|
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.
|
61
|
+
version: 0.21.0
|
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.
|
68
|
+
version: 0.21.0
|
69
69
|
description: Extends Decidim adding a first level public consultation component
|
70
70
|
email:
|
71
71
|
- jsperezg@gmail.com
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- app/constraints/decidim/consultations/current_component.rb
|
132
132
|
- app/constraints/decidim/consultations/current_question.rb
|
133
133
|
- app/controllers/concerns/decidim/consultations/admin/consultation_admin.rb
|
134
|
+
- app/controllers/concerns/decidim/consultations/admin/filterable.rb
|
134
135
|
- app/controllers/concerns/decidim/consultations/admin/question_admin.rb
|
135
136
|
- app/controllers/concerns/decidim/consultations/needs_consultation.rb
|
136
137
|
- app/controllers/concerns/decidim/consultations/needs_question.rb
|
@@ -184,6 +185,8 @@ files:
|
|
184
185
|
- app/queries/decidim/consultations/organization_consultations.rb
|
185
186
|
- app/queries/decidim/consultations/organization_questions.rb
|
186
187
|
- app/services/decidim/consultations/consultation_search.rb
|
188
|
+
- app/types/decidim/consultations/consultation_question_type.rb
|
189
|
+
- app/types/decidim/consultations/consultation_type.rb
|
187
190
|
- app/views/decidim/consultations/_consultation.html.erb
|
188
191
|
- app/views/decidim/consultations/admin/consultations/_form.html.erb
|
189
192
|
- app/views/decidim/consultations/admin/consultations/edit.html.erb
|
@@ -250,6 +253,7 @@ files:
|
|
250
253
|
- config/locales/cs.yml
|
251
254
|
- config/locales/de.yml
|
252
255
|
- config/locales/el-GR.yml
|
256
|
+
- config/locales/el.yml
|
253
257
|
- config/locales/en.yml
|
254
258
|
- config/locales/eo-UY.yml
|
255
259
|
- config/locales/es-MX.yml
|