decidim-surveys 0.23.2 → 0.24.0

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: 6aa22db7673c4df5bb5433441e1f07c60a40e4f7f3cfec9e5af332c0191d8591
4
- data.tar.gz: c4a84adb23a3a0e5a7c63881a0fdd2f6956fd9a175edc5feacb45b0c8b8830e2
3
+ metadata.gz: d2435c136374070c2915020ca8f17bf19b206a2f6c69da1c46f4684723ef8450
4
+ data.tar.gz: a1508028179835778840a572fe36d59de74a745a48586da34e8f299a27c476d5
5
5
  SHA512:
6
- metadata.gz: 05ca768ee9471e55510df58d4e478e0738c570b37f80d7c53f52016dfcb92d5fdeb54112ef10bcd66697e5c9343916d25654f424bb3aa1c1852f18be382d3d3f
7
- data.tar.gz: 06a212a73a8b955a0c86a6fb20444336436dd7e14bec1062ba25a76f304b4d1b5982af396d836d3f9a4be371d8a3f1143d462a201fa5615640df981efdab919d
6
+ metadata.gz: 2bf88ab608e77a40316ebbdd4af263bb9f4aeb9a1ad2273d1585f2a6581bb63678fa8558905c008e8fe35f80902916507991f2748403f38a89dd551bae78c607
7
+ data.tar.gz: 63495d400329e712a70799d38476fbbfcb08508c49d7bea26fe080440979e4c03f29d85ffdd2970c7ec1f53af105669ed915030251184cf90a8de68c5aa995fe
@@ -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,11 +21,16 @@ 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
33
+ allow_unregistered_help: Se está activo, non será preciso iniciar sesión para contestar a enquisa. Isto pode comportar que os datos sexan pouco fiábeis e aumentará a vulnerabilidade a ataques automatizados. Empregar con precaución!
29
34
  announcement: Anuncio
30
35
  events:
31
36
  surveys:
@@ -57,4 +62,5 @@ gl:
57
62
  surveys:
58
63
  answer:
59
64
  invalid: Houbo erros ao responder a enquisa.
65
+ spam_detected: Produciuse un problema ao contestar o formulario. É posíbel que o fixeras rápido de máis, podes tentalo de novo?
60
66
  success: A enquisa respondeu con éxito.
@@ -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ę
@@ -61,6 +65,6 @@ pl:
61
65
  new_survey_at_html: "<span>Nowa ankieta %{link}</span>"
62
66
  surveys:
63
67
  answer:
64
- invalid: Podczas wypełniania ankiety pojawił się błąd.
68
+ invalid: Podczas wypełniania ankiety wystąpił błąd.
65
69
  spam_detected: Wystąpił błąd podczas wypełniania formularza. Być może zostało to zrobione zbyt szybko, czy możesz spróbować ponownie?
66
70
  success: Twoja ankieta została wypełniona.
@@ -23,6 +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ă
28
+ scope_id: Domeniu de interes
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ă
26
32
  step:
27
33
  allow_answers: Permite răspunsuri
28
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.2"
7
+ "0.24.0"
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.2
4
+ version: 0.24.0
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-02-09 00:00:00.000000000 Z
13
+ date: 2021-03-26 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.2
21
+ version: 0.24.0
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.2
28
+ version: 0.24.0
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.2
35
+ version: 0.24.0
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.2
42
+ version: 0.24.0
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.2
50
- type: :development
49
+ version: 0.24.0
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.2
56
+ version: 0.24.0
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.2
63
+ version: 0.24.0
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.2
70
+ version: 0.24.0
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.2
77
+ version: 0.24.0
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.2
84
+ version: 0.24.0
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.2
91
+ version: 0.24.0
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.2
98
+ version: 0.24.0
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