decidim-forms 0.20.1 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/types/decidim/forms/answer_option_type.rb +14 -0
- data/app/types/decidim/forms/question_type.rb +23 -0
- data/app/types/decidim/forms/questionnaire_type.rb +22 -0
- data/config/locales/el.yml +1 -0
- data/lib/decidim/api/questionnaire_entity_interface.rb +18 -0
- data/lib/decidim/forms.rb +1 -0
- data/lib/decidim/forms/api.rb +7 -0
- data/lib/decidim/forms/test/factories.rb +5 -0
- data/lib/decidim/forms/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334b51b756960630b366ba46f5a50ecdb927bc65f55c08da3419911312a861f0
|
4
|
+
data.tar.gz: 5e63218e62c6f71cefcf28c6344f04b559ef0f2f4cef0124d4cadc95eaffd7ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06f69f7b6c6ad38af0da016e76f4b7af11f2a626badb37bfc29ac8c258432e8ed6367ba8ac4e4db39b02bbcfc7dd913672ec789db99650fc52410bf7ccb400d4
|
7
|
+
data.tar.gz: ee7a451f8bda9e7c28ed27844a79af3e588d29fa635509d410b2b04efd2d5207eba5ec9d9018e0b8c3258520d88ef85982da809bab219a920a0de0486704e551
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Forms
|
5
|
+
AnswerOptionType = GraphQL::ObjectType.define do
|
6
|
+
name "AnswerOption"
|
7
|
+
description "An answer option for a multi-choice question in a questionnaire"
|
8
|
+
|
9
|
+
field :id, !types.ID, "ID of this answer option"
|
10
|
+
field :body, !Decidim::Core::TranslatedFieldType, "The text answer response option."
|
11
|
+
field :freeText, !types.Boolean, "Whether if this answer accepts any free text from the user.", property: :free_text
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Forms
|
5
|
+
QuestionType = GraphQL::ObjectType.define do
|
6
|
+
name "Question"
|
7
|
+
description "A question in a questionnaire"
|
8
|
+
|
9
|
+
interfaces [
|
10
|
+
-> { Decidim::Core::TimestampsInterface }
|
11
|
+
]
|
12
|
+
|
13
|
+
field :id, !types.ID, "ID of this question"
|
14
|
+
field :body, !Decidim::Core::TranslatedFieldType, "What is being asked in this question."
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this question."
|
16
|
+
field :mandatory, !types.Boolean, "Whether if this question is mandatory."
|
17
|
+
field :position, types.Int, "Order position of the question in the questionnaire"
|
18
|
+
field :maxChoices, types.Int, "On questions with answer options, maximum number of choices the user has", property: :max_choices
|
19
|
+
field :questionType, types.String, "Type of question.", property: :question_type
|
20
|
+
field :answerOptions, !types[AnswerOptionType], "List of answer options in multi-choice questions.", property: :answer_options
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Forms
|
5
|
+
QuestionnaireType = GraphQL::ObjectType.define do
|
6
|
+
name "Questionnaire"
|
7
|
+
description "A questionnaire"
|
8
|
+
|
9
|
+
interfaces [
|
10
|
+
-> { Decidim::Core::TimestampsInterface }
|
11
|
+
]
|
12
|
+
|
13
|
+
field :id, !types.ID, "ID of this questionnaire"
|
14
|
+
field :title, !Decidim::Core::TranslatedFieldType, "The title of this questionnaire."
|
15
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description of this questionnaire."
|
16
|
+
field :tos, Decidim::Core::TranslatedFieldType, "The Terms of Service for this questionnaire."
|
17
|
+
field :forType, types.String, "Type of entity using this questionnaire.", property: :questionnaire_for_type
|
18
|
+
field :forEntity, QuestionnaireEntityInterface, "Entity using this questionnaire.", property: :questionnaire_for
|
19
|
+
field :questions, !types[QuestionType], "Questions in this questionnaire."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
el:
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Forms
|
5
|
+
# This interface should be implemented by any Type that can be linked to a questionnaire
|
6
|
+
# The only requirement is to have an ID and the Type name be the class.name + Type
|
7
|
+
QuestionnaireEntityInterface = GraphQL::InterfaceType.define do
|
8
|
+
name "QuestionnaireEntityInterface"
|
9
|
+
description "An interface that can be used in objects with questionnaires"
|
10
|
+
|
11
|
+
field :id, !types.ID, "ID of this entity"
|
12
|
+
|
13
|
+
resolve_type ->(obj, _ctx) {
|
14
|
+
"#{obj.class.name}Type".constantize
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/decidim/forms.rb
CHANGED
@@ -31,6 +31,11 @@ FactoryBot.define do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
body { generate_localized_title }
|
34
|
+
description do
|
35
|
+
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
36
|
+
generate_localized_title
|
37
|
+
end
|
38
|
+
end
|
34
39
|
mandatory { false }
|
35
40
|
position { 0 }
|
36
41
|
question_type { Decidim::Forms::Question::TYPES.first }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-
|
14
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: decidim-core
|
@@ -19,42 +19,42 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.21.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.21.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: decidim-admin
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - '='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
36
|
+
version: 0.21.0
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - '='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 0.
|
43
|
+
version: 0.21.0
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: decidim-dev
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 0.
|
50
|
+
version: 0.21.0
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 0.
|
57
|
+
version: 0.21.0
|
58
58
|
description: A forms gem for decidim.
|
59
59
|
email:
|
60
60
|
- josepjaume@gmail.com
|
@@ -102,6 +102,9 @@ files:
|
|
102
102
|
- app/models/decidim/forms/question.rb
|
103
103
|
- app/models/decidim/forms/questionnaire.rb
|
104
104
|
- app/queries/decidim/forms/questionnaire_user_answers.rb
|
105
|
+
- app/types/decidim/forms/answer_option_type.rb
|
106
|
+
- app/types/decidim/forms/question_type.rb
|
107
|
+
- app/types/decidim/forms/questionnaire_type.rb
|
105
108
|
- app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb
|
106
109
|
- app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb
|
107
110
|
- app/views/decidim/forms/admin/questionnaires/_form.html.erb
|
@@ -116,6 +119,7 @@ files:
|
|
116
119
|
- config/locales/cs.yml
|
117
120
|
- config/locales/de.yml
|
118
121
|
- config/locales/el-GR.yml
|
122
|
+
- config/locales/el.yml
|
119
123
|
- config/locales/en.yml
|
120
124
|
- config/locales/eo-UY.yml
|
121
125
|
- config/locales/es-MX.yml
|
@@ -147,9 +151,11 @@ files:
|
|
147
151
|
- db/migrate/20180405015147_create_decidim_forms_answer_choices.rb
|
148
152
|
- db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb
|
149
153
|
- db/migrate/20190930094710_add_ip_hash_to_decidim_form_answers.rb
|
154
|
+
- lib/decidim/api/questionnaire_entity_interface.rb
|
150
155
|
- lib/decidim/forms.rb
|
151
156
|
- lib/decidim/forms/admin.rb
|
152
157
|
- lib/decidim/forms/admin_engine.rb
|
158
|
+
- lib/decidim/forms/api.rb
|
153
159
|
- lib/decidim/forms/data_portability_user_answers_serializer.rb
|
154
160
|
- lib/decidim/forms/engine.rb
|
155
161
|
- lib/decidim/forms/test.rb
|