decidim-surveys 0.23.3 → 0.24.1

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: 9f88363a594d46a6262a4e45c7ee5e761ed5abf55af70c5dfb89f32bfb3a9329
4
- data.tar.gz: f2b5df330c9fbfa652c7c608d8bcef50f854d980a449d579e486125346836bfe
3
+ metadata.gz: 8a16f3f77f8afabe356760549ec8dfb4af3cf294c696bf98d14e349713d5b5cd
4
+ data.tar.gz: d7744ae8406816d813b2a9e0b2bcb92c6ce70b78e277695c15013dc7f2fdcc37
5
5
  SHA512:
6
- metadata.gz: d4b644e80543ea619f3ce688c88e030603cd84fc47cc21eb1c25b9e25effdea4561f06d1ea5d74cbb864b1bdc7e42bbf98b457ad4167207f557f3e211438d1a1
7
- data.tar.gz: b7b8e445a2a9c1f6e0728a34ebb2d3ef4f71387c47903ad56bf2714c1e21fd020d94fad528824545c9e01369e9302839d6276a4f367fda520f76082c97d201ab
6
+ metadata.gz: 5040a7d03dbff8fcf3e8f2c1fc6cb98308cfb42fda96799eccc379334c7de8b0490c53c5e92fb063ad7f96866db6a44b3c0e864882182b5604c873abb959db39
7
+ data.tar.gz: 5e79947cc8b1d89c6828512bcc494f3c728f7a1b4d95da7c45f991b6cdd66d9b3126238ee319353837cd0d58d6cd97bf580dd66fdfebddfc6140d8b91bee3027
@@ -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,6 +21,8 @@ sv:
21
21
  global:
22
22
  announcement: Meddelande
23
23
  clean_after_publish: Ta bort svar vid publicering av enkäten
24
+ scope_id: Omfång
25
+ scopes_enabled: Omfång aktiverade
24
26
  step:
25
27
  allow_answers: Tillåt svar
26
28
  allow_unregistered: Tillåt ej registrerade användare att besvara enkäten
@@ -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.3"
7
+ "0.24.1"
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.3
4
+ version: 0.24.1
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-23 00:00:00.000000000 Z
13
+ date: 2021-04-08 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.3
21
+ version: 0.24.1
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.3
28
+ version: 0.24.1
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.3
35
+ version: 0.24.1
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.3
42
+ version: 0.24.1
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.3
50
- type: :development
49
+ version: 0.24.1
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.3
56
+ version: 0.24.1
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.3
63
+ version: 0.24.1
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.3
70
+ version: 0.24.1
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.3
77
+ version: 0.24.1
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.3
84
+ version: 0.24.1
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.3
91
+ version: 0.24.1
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.3
98
+ version: 0.24.1
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