decidim-surveys 0.23.5 → 0.24.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45ef20e4b8fd0092ee64768a7df0c16db652b3958fbe5f75c30b5934a10ee0dd
4
- data.tar.gz: b6a5173a1c96f79db42fc5faf2cc40995d7ee1eef816a0f131b4057c458ab61e
3
+ metadata.gz: b069b52bb24f8613a1665d46dc3d217c2bc977c440f4fa47ca0dfde5a8b3b8bd
4
+ data.tar.gz: b6836a6af5e8dc540748bc129242a10b964f543055b9335a91329c4b4371147d
5
5
  SHA512:
6
- metadata.gz: d28fb470d0e68735cb333768d39ad156dd70d0b6202126fc1c4d648b0df4ca2dcc538e08cd9481b2919d0fbe19bf25c76403423cfecc9f37720ccc4925677a5e
7
- data.tar.gz: 83ce0a23575bc3b9b680893b2a84efa4999c518182aee5ea33a2b7569a4913047a5f6be9f64c838ed080b370554f2ef2d1e6e1b268336922585855479a260f97
6
+ metadata.gz: b0eacb364f2901696e1e28ca8fbdec6621488645615280cba0d7ab181ae76ced6e4f75a7413dd407f51b98035c6a4ce412878d4bdb7397601271c5a95ee52b59
7
+ data.tar.gz: e64a7983ef252b284cd217ddfa9d8ec3266d66d0e85965f61858ec8be1679fda2df4d4538d2e8623764d018e6255f0b1eb17d831c6175c04ea57f0b4e6ceb0e1
@@ -22,6 +22,10 @@ module Decidim
22
22
  Decidim::EngineRouter.admin_proxy(survey.component).show_survey_path(session_token: session_token)
23
23
  end
24
24
 
25
+ def edit_questionnaire_title
26
+ t(:title, scope: "decidim.forms.admin.questionnaires.form", questionnaire_for: translated_attribute(current_component.name))
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def i18n_flashes_scope
@@ -23,7 +23,7 @@ module Decidim
23
23
  protected
24
24
 
25
25
  def allow_answers?
26
- !current_component.published? || current_settings.allow_answers?
26
+ !current_component.published? || (current_settings.allow_answers? && survey.open?)
27
27
  end
28
28
 
29
29
  def form_path
@@ -15,6 +15,24 @@ module Decidim
15
15
  def clean_after_publish?
16
16
  component.settings.clean_after_publish?
17
17
  end
18
+
19
+ def starts_at
20
+ component.settings.starts_at
21
+ end
22
+
23
+ def ends_at
24
+ component.settings.ends_at
25
+ end
26
+
27
+ def open?
28
+ return true if starts_at.blank? && ends_at.blank?
29
+ return true if ends_at.blank? && starts_at.past?
30
+ return true if starts_at.blank? && ends_at.future?
31
+
32
+ return Time.zone.now.between?(starts_at, ends_at) if starts_at.present? && ends_at.present?
33
+
34
+ false
35
+ end
18
36
  end
19
37
  end
20
38
  end
@@ -21,8 +21,12 @@ ca:
21
21
  global:
22
22
  announcement: Avís
23
23
  clean_after_publish: Esborrar les respostes en publicar l'enquesta
24
+ ends_at: Respostes acceptades fins a
25
+ ends_at_help: Deixar en blanc per cap data específica
24
26
  scope_id: Àmbit
25
27
  scopes_enabled: Àmbits habilitats
28
+ starts_at: Respostes acceptades de
29
+ starts_at_help: Deixar en blanc per cap data específica
26
30
  step:
27
31
  allow_answers: Permetre respostes
28
32
  allow_unregistered: Permet a usuàries no registrades contestar l'enquesta
@@ -25,8 +25,12 @@ cs:
25
25
  global:
26
26
  announcement: Oznámení
27
27
  clean_after_publish: Odstranit odpovědi při publikování ankety
28
+ ends_at: Odpověď přijata do
29
+ ends_at_help: Ponechte prázdné pro žádné konkrétní datum
28
30
  scope_id: Oblast působnosti
29
31
  scopes_enabled: Oblasti působnosti povoleny
32
+ starts_at: Odpovědi přijaté od
33
+ starts_at_help: Ponechte prázdné pro žádné konkrétní datum
30
34
  step:
31
35
  allow_answers: Povolte odpovědi
32
36
  allow_unregistered: Umožnit neregistrovaným uživatelům odpovědět na průzkum
@@ -21,8 +21,12 @@ de:
21
21
  global:
22
22
  announcement: Ankündigung
23
23
  clean_after_publish: Antworten bei Veröffentlichung des Fragebogens löschen
24
+ ends_at: Antworten akzeptiert bis
25
+ ends_at_help: Leer lassen für kein bestimmtes Datum
24
26
  scope_id: Bereich
25
27
  scopes_enabled: Bereiche aktiviert
28
+ starts_at: Antworten akzeptiert von
29
+ starts_at_help: Leer lassen für kein bestimmtes Datum
26
30
  step:
27
31
  allow_answers: Erlaube Antworten
28
32
  allow_unregistered: Nicht registrierten Benutzern die Beantwortung des Fragebogens erlauben
@@ -22,8 +22,12 @@ en:
22
22
  global:
23
23
  announcement: Announcement
24
24
  clean_after_publish: Delete answers when publishing the survey
25
+ ends_at: Answers accepted until
26
+ ends_at_help: Leave blank for no specific date
25
27
  scope_id: Scope
26
28
  scopes_enabled: Scopes enabled
29
+ starts_at: Answers accepted from
30
+ starts_at_help: Leave blank for no specific date
27
31
  step:
28
32
  allow_answers: Allow answers
29
33
  allow_unregistered: Allow unregistered users to answer the survey
@@ -21,8 +21,12 @@ es-MX:
21
21
  global:
22
22
  announcement: Anuncio
23
23
  clean_after_publish: Borrar respuestas al publicar la encuesta
24
+ ends_at: Respuestas aceptadas hasta
25
+ ends_at_help: Dejar en blanco para ninguna fecha específica
24
26
  scope_id: Ámbito
25
27
  scopes_enabled: Ámbitos habilitados
28
+ starts_at: Respuestas aceptadas de
29
+ starts_at_help: Dejar en blanco para ninguna fecha específica
26
30
  step:
27
31
  allow_answers: Permitir respuestas
28
32
  allow_unregistered: Permitir a las usuarias no registradas responder a la encuesta
@@ -21,8 +21,12 @@ es-PY:
21
21
  global:
22
22
  announcement: Anuncio
23
23
  clean_after_publish: Borrar respuestas al publicar la encuesta
24
+ ends_at: Respuestas aceptadas hasta
25
+ ends_at_help: Dejar en blanco para ninguna fecha específica
24
26
  scope_id: Ámbito
25
27
  scopes_enabled: Ámbitos habilitados
28
+ starts_at: Respuestas aceptadas de
29
+ starts_at_help: Dejar en blanco para ninguna fecha específica
26
30
  step:
27
31
  allow_answers: Permitir respuestas
28
32
  allow_unregistered: Permitir a las usuarias no registradas responder a la encuesta
@@ -21,8 +21,12 @@ es:
21
21
  global:
22
22
  announcement: Aviso
23
23
  clean_after_publish: Borrar respuestas al publicar la encuesta
24
+ ends_at: Respuestas aceptadas hasta
25
+ ends_at_help: Dejar en blanco para ninguna fecha específica
24
26
  scope_id: Ámbito
25
27
  scopes_enabled: Ámbitos habilitados
28
+ starts_at: Respuestas aceptadas de
29
+ starts_at_help: Dejar en blanco para ninguna fecha específica
26
30
  step:
27
31
  allow_answers: Permitir respuestas
28
32
  allow_unregistered: Permitir a las usuarias no registradas responder a la encuesta
@@ -21,8 +21,12 @@ fi-pl:
21
21
  global:
22
22
  announcement: Ilmoitus
23
23
  clean_after_publish: Poista vastaukset julkaistaessa kysely
24
+ ends_at: Vastausajan loppumisajankohta
25
+ ends_at_help: Jätä tyhjäksi, jos vastausaikaa ei ole rajattu
24
26
  scope_id: Teema
25
27
  scopes_enabled: Teemat käytössä
28
+ starts_at: Vastausajan alkamisajankohta
29
+ starts_at_help: Jätä tyhjäksi, jos vastausaikaa ei ole rajattu
26
30
  step:
27
31
  allow_answers: Salli vastaukset
28
32
  allow_unregistered: Salli rekisteröitymättömien käyttäjien vastata tähän kyselyyn
@@ -21,8 +21,12 @@ fi:
21
21
  global:
22
22
  announcement: Ilmoitus
23
23
  clean_after_publish: Poista vastaukset julkaistaessa kysely
24
+ ends_at: Vastausajan loppumisajankohta
25
+ ends_at_help: Jätä tyhjäksi, jos vastausaikaa ei ole rajattu
24
26
  scope_id: Teema
25
27
  scopes_enabled: Teemat käytössä
28
+ starts_at: Vastausajan alkamisajankohta
29
+ starts_at_help: Jätä tyhjäksi, jos vastausaikaa ei ole rajattu
26
30
  step:
27
31
  allow_answers: Salli vastaukset
28
32
  allow_unregistered: Salli rekisteröitymättömien käyttäjien vastata tähän kyselyyn
@@ -21,8 +21,12 @@ fr-CA:
21
21
  global:
22
22
  announcement: Annonce
23
23
  clean_after_publish: Supprimer les réponses lors de la publication du sondage
24
+ ends_at: Réponses acceptées jusqu'au
25
+ ends_at_help: Laisser vide si aucune date spécifique
24
26
  scope_id: Secteur
25
27
  scopes_enabled: Secteurs activés
28
+ starts_at: Réponses acceptées du
29
+ starts_at_help: Laisser vide si aucune date spécifique
26
30
  step:
27
31
  allow_answers: Autoriser les réponses
28
32
  allow_unregistered: Autoriser les utilisateurs non inscrits à répondre à l'enquête
@@ -21,8 +21,12 @@ fr:
21
21
  global:
22
22
  announcement: Annonce
23
23
  clean_after_publish: 'Supprimer les réponses lors de la publication de l''enquête - ATTENTION : décocher après avoir fini vos tests et avoir publié l''enquête'
24
+ ends_at: Réponses acceptées jusqu'au
25
+ ends_at_help: Laisser vide si aucune date spécifique
24
26
  scope_id: Secteur
25
27
  scopes_enabled: Secteurs activés
28
+ starts_at: Réponses acceptées du
29
+ starts_at_help: Laisser vide si aucune date spécifique
26
30
  step:
27
31
  allow_answers: Autoriser les réponses
28
32
  allow_unregistered: Autoriser les utilisateurs non inscrits à répondre à l'enquête
@@ -21,8 +21,12 @@ gl:
21
21
  global:
22
22
  announcement: Anuncio
23
23
  clean_after_publish: Eliminar as respostas ao publicar a enquisa
24
+ ends_at: Respostas aceptadas até
25
+ ends_at_help: Deixar baleiro de non especificar unha data
24
26
  scope_id: Ámbito
25
27
  scopes_enabled: Ámbitos habilitados
28
+ starts_at: Respostas aceptadas de
29
+ starts_at_help: Deixar baleiro de non especificar unha data
26
30
  step:
27
31
  allow_answers: Permitir respostas
28
32
  allow_unregistered: Permitir aos usuarios non rexistrados responder a enquisa
@@ -21,6 +21,10 @@ it:
21
21
  global:
22
22
  announcement: Annuncio
23
23
  clean_after_publish: Eliminare le risposte quando si pubblica il sondaggio
24
+ ends_at: Risposte accettate fino al
25
+ ends_at_help: Lascia vuoto se nessuna data è specificata
26
+ starts_at: Risposte accettate da
27
+ starts_at_help: Lascia vuoto se nessuna data è specificata
24
28
  step:
25
29
  allow_answers: Consenti risposte
26
30
  allow_unregistered: Consenti agli utenti non registrati di rispondere al sondaggio
@@ -21,8 +21,12 @@ nl:
21
21
  global:
22
22
  announcement: Aankondiging
23
23
  clean_after_publish: Verwijder antwoorden bij publicatie van de enquête
24
+ ends_at: Antwoorden geaccepteerd tot
25
+ ends_at_help: Laat leeg voor geen specifieke datum
24
26
  scope_id: Scope
25
27
  scopes_enabled: Scopes ingeschakeld
28
+ starts_at: Antwoorden geaccepteerd vanaf
29
+ starts_at_help: Laat leeg voor geen specifieke datum
26
30
  step:
27
31
  allow_answers: Antwoorden toestaan
28
32
  allow_unregistered: Sta niet-geregistreerde gebruikers toe om de enquête te beantwoorden
@@ -25,8 +25,12 @@ pl:
25
25
  global:
26
26
  announcement: Ogłoszenie
27
27
  clean_after_publish: Usuń odpowiedzi podczas publikowania ankiety
28
+ ends_at: Odpowiedzi akceptowane do
29
+ ends_at_help: Pozostaw puste jeśli nie określono daty
28
30
  scope_id: Zakres
29
31
  scopes_enabled: Zakresy włączone
32
+ starts_at: Odpowiedzi akceptowane od
33
+ starts_at_help: Pozostaw puste jeśli nie określono daty
30
34
  step:
31
35
  allow_answers: Pozwól na wypełnianie
32
36
  allow_unregistered: Pozwól niezarejestrowanym użytkownikom wypełnić ankietę
@@ -23,8 +23,12 @@ ro:
23
23
  global:
24
24
  announcement: Anunţ
25
25
  clean_after_publish: Ștergeți răspunsurile la publicarea sondajului
26
+ ends_at: Răspunsuri acceptate până la
27
+ ends_at_help: Lăsați necompletat pentru nicio dată specifică
26
28
  scope_id: Domeniu de interes
27
29
  scopes_enabled: Domenii de interes activate
30
+ starts_at: Răspunsuri acceptate de la
31
+ starts_at_help: Lăsați necompletat pentru nicio dată specifică
28
32
  step:
29
33
  allow_answers: Permite răspunsuri
30
34
  allow_unregistered: Permite utilizatorilor neînregistrați să răspundă la chestionar
@@ -21,8 +21,12 @@ tr:
21
21
  global:
22
22
  announcement: Duyuru
23
23
  clean_after_publish: Anketi yayınlarken cevapları sil
24
+ ends_at: Şu tarihe kadar kabul edilen cevaplar
25
+ ends_at_help: Belirli bir tarih için boş bırakın
24
26
  scope_id: Kapsam
25
27
  scopes_enabled: Kapsamlar etkinleştirildi
28
+ starts_at: Cevaplar kabul edildi
29
+ starts_at_help: Belirli bir tarih için boş bırakın
26
30
  step:
27
31
  allow_answers: Cevaplara izin ver
28
32
  allow_unregistered: Kayıtlı olmayan kullanıcıların anketi yanıtlamasına izin verin
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Surveys
5
+ class SurveyType < Decidim::Api::Types::BaseObject
6
+ description "A survey"
7
+
8
+ field :id, GraphQL::Types::ID, "The internal ID for this survey", null: false
9
+ field :created_at, Decidim::Core::DateTimeType, "The time this survey was created", null: true
10
+ field :updated_at, Decidim::Core::DateTimeType, "The time this survey was updated", null: true
11
+ field :questionnaire, Decidim::Forms::QuestionnaireType, "The questionnaire for this survey", null: true
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Surveys
5
+ class SurveysType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+
8
+ graphql_name "Surveys"
9
+ description "A surveys component of a participatory space."
10
+
11
+ field :surveys, Decidim::Surveys::SurveyType.connection_type, null: true, connection: true
12
+
13
+ def surveys
14
+ Survey.where(component: object).includes(:component)
15
+ end
16
+
17
+ field :survey, Decidim::Surveys::SurveyType, null: true do
18
+ argument :id, GraphQL::Types::ID, required: true
19
+ end
20
+
21
+ def survey(**args)
22
+ Survey.where(component: object).find_by(id: args[:id])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/surveys/admin"
4
+ require "decidim/surveys/api"
4
5
  require "decidim/surveys/engine"
5
6
  require "decidim/surveys/admin_engine"
6
7
  require "decidim/surveys/component"
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Surveys
5
+ autoload :SurveyType, "decidim/api/survey_type"
6
+ autoload :SurveysType, "decidim/api/surveys_type"
7
+ end
8
+ end
@@ -57,6 +57,8 @@ Decidim.register_component(:surveys) do |component|
57
57
  component.settings(:global) do |settings|
58
58
  settings.attribute :scopes_enabled, type: :boolean, default: false
59
59
  settings.attribute :scope_id, type: :scope
60
+ settings.attribute :starts_at, type: :time
61
+ settings.attribute :ends_at, type: :time
60
62
  settings.attribute :announcement, type: :text, translated: true, editor: true
61
63
  settings.attribute :clean_after_publish, type: :boolean, default: true
62
64
  end
@@ -103,10 +105,10 @@ Decidim.register_component(:surveys) do |component|
103
105
  questionnaire = Decidim::Forms::Questionnaire.new(
104
106
  title: Decidim::Faker::Localized.paragraph,
105
107
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
106
- Decidim::Faker::Localized.paragraph(3)
108
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
107
109
  end,
108
110
  tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
109
- Decidim::Faker::Localized.paragraph(2)
111
+ Decidim::Faker::Localized.paragraph(sentence_count: 2)
110
112
  end
111
113
  )
112
114
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-surveys version.
5
5
  module Surveys
6
6
  def self.version
7
- "0.23.5"
7
+ "0.24.2"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-surveys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.5
4
+ version: 0.24.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-08 00:00:00.000000000 Z
13
+ date: 2021-05-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,84 +18,84 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.23.5
21
+ version: 0.24.2
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.23.5
28
+ version: 0.24.2
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-forms
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.23.5
35
+ version: 0.24.2
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.23.5
42
+ version: 0.24.2
43
43
  - !ruby/object:Gem::Dependency
44
- name: decidim-admin
44
+ name: decidim-templates
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.23.5
50
- type: :development
49
+ version: 0.24.2
50
+ type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.23.5
56
+ version: 0.24.2
57
57
  - !ruby/object:Gem::Dependency
58
- name: decidim-dev
58
+ name: decidim-admin
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.23.5
63
+ version: 0.24.2
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.23.5
70
+ version: 0.24.2
71
71
  - !ruby/object:Gem::Dependency
72
- name: decidim-participatory_processes
72
+ name: decidim-dev
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 0.23.5
77
+ version: 0.24.2
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - '='
83
83
  - !ruby/object:Gem::Version
84
- version: 0.23.5
84
+ version: 0.24.2
85
85
  - !ruby/object:Gem::Dependency
86
- name: decidim-templates
86
+ name: decidim-participatory_processes
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 0.23.5
91
+ version: 0.24.2
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 0.23.5
98
+ version: 0.24.2
99
99
  description: A surveys component for decidim's participatory spaces.
100
100
  email:
101
101
  - josepjaume@gmail.com
@@ -127,8 +127,6 @@ files:
127
127
  - app/queries/decidim/surveys/metrics/survey_participants_metric_measure.rb
128
128
  - app/serializers/decidim/surveys/data_importer.rb
129
129
  - app/serializers/decidim/surveys/data_serializer.rb
130
- - app/types/decidim/surveys/survey_type.rb
131
- - app/types/decidim/surveys/surveys_type.rb
132
130
  - app/views/decidim/surveys/surveys/no_permission.html.erb
133
131
  - config/locales/am-ET.yml
134
132
  - config/locales/ar-SA.yml
@@ -220,9 +218,12 @@ files:
220
218
  - db/migrate/20200610090725_remove_survey_answers.rb
221
219
  - db/migrate/20200610090845_remove_survey_questions.rb
222
220
  - db/migrate/20200610105927_remove_survey_columns.rb
221
+ - lib/decidim/api/survey_type.rb
222
+ - lib/decidim/api/surveys_type.rb
223
223
  - lib/decidim/surveys.rb
224
224
  - lib/decidim/surveys/admin.rb
225
225
  - lib/decidim/surveys/admin_engine.rb
226
+ - lib/decidim/surveys/api.rb
226
227
  - lib/decidim/surveys/component.rb
227
228
  - lib/decidim/surveys/engine.rb
228
229
  - lib/decidim/surveys/test/factories.rb
@@ -240,14 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
240
241
  requirements:
241
242
  - - ">="
242
243
  - !ruby/object:Gem::Version
243
- version: '2.6'
244
+ version: '2.7'
244
245
  required_rubygems_version: !ruby/object:Gem::Requirement
245
246
  requirements:
246
247
  - - ">="
247
248
  - !ruby/object:Gem::Version
248
249
  version: '0'
249
250
  requirements: []
250
- rubygems_version: 3.0.3
251
+ rubygems_version: 3.1.2
251
252
  signing_key:
252
253
  specification_version: 4
253
254
  summary: Decidim surveys module
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Surveys
5
- SurveyType = GraphQL::ObjectType.define do
6
- name "Survey"
7
- description "A survey"
8
-
9
- field :id, !types.ID, "The internal ID for this survey"
10
- field :createdAt, Decidim::Core::DateTimeType, "The time this survey was created", property: :created_at
11
- field :updatedAt, Decidim::Core::DateTimeType, "The time this survey was updated", property: :updated_at
12
- field :questionnaire, Decidim::Forms::QuestionnaireType, "The questionnaire for this survey"
13
- end
14
- end
15
- end
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Surveys
5
- SurveysType = GraphQL::ObjectType.define do
6
- interfaces [-> { Decidim::Core::ComponentInterface }]
7
-
8
- name "Surveys"
9
- description "A surveys component of a participatory space."
10
-
11
- connection :surveys, SurveyType.connection_type do
12
- resolve ->(component, _args, _ctx) {
13
- SurveysTypeHelper.base_scope(component).includes(:component)
14
- }
15
- end
16
-
17
- field(:survey, SurveyType) do
18
- argument :id, !types.ID
19
-
20
- resolve ->(component, args, _ctx) {
21
- SurveysTypeHelper.base_scope(component).find_by(id: args[:id])
22
- }
23
- end
24
- end
25
-
26
- module SurveysTypeHelper
27
- def self.base_scope(component)
28
- Survey.where(component: component)
29
- end
30
- end
31
- end
32
- end