decidim-only_forms 0.1.0 → 0.2.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/README.md +59 -2
- data/Rakefile +46 -36
- data/app/commands/decidim/forms/command.rb +1 -7
- data/app/commands/decidim/forms/response_questionnaire.rb +158 -0
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +49 -36
- data/app/mailers/decidim/only_forms/admin_submission_mailer.rb +77 -0
- data/app/models/decidim/surveys/survey.rb +78 -13
- data/app/overrides/add_only_forms_attributes.rb +17 -0
- data/app/overrides/replace_announcement_display.rb +12 -0
- data/app/services/decidim/only_forms/admin_email_allowlist.rb +32 -0
- data/app/services/decidim/only_forms/admin_submission_notification.rb +64 -0
- data/app/views/decidim/only_forms/admin_submission_mailer/notify.html.erb +12 -0
- data/config/initializers/doorkeeper.rb +544 -0
- data/config/locales/doorkeeper.en.yml +155 -0
- data/config/locales/en.yml +13 -3
- data/config/locales/fr.yml +11 -3
- data/config/locales/pt.yml +11 -3
- data/lib/decidim/only_forms/component.rb +28 -15
- data/lib/decidim/only_forms/engine.rb +16 -2
- data/lib/decidim/only_forms/overrides/only_form_settings_form.rb +30 -0
- data/lib/decidim/only_forms/overrides/update_only_form_settings.rb +31 -0
- data/lib/decidim/only_forms/test/factories.rb +1 -1
- data/lib/decidim/only_forms/version.rb +3 -3
- data/lib/decidim/only_forms.rb +2 -0
- data/lib/tasks/decidim/only_forms/only_forms_upgrade.rake +13 -0
- data/lib/tasks/decidim/only_forms/only_forms_webpacker.rake +58 -0
- metadata +39 -13
- data/app/commands/decidim/forms/answer_questionnaire.rb +0 -112
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
en:
|
|
2
|
+
activerecord:
|
|
3
|
+
attributes:
|
|
4
|
+
doorkeeper/application:
|
|
5
|
+
name: 'Name'
|
|
6
|
+
redirect_uri: 'Redirect URI'
|
|
7
|
+
errors:
|
|
8
|
+
models:
|
|
9
|
+
doorkeeper/application:
|
|
10
|
+
attributes:
|
|
11
|
+
redirect_uri:
|
|
12
|
+
fragment_present: 'cannot contain a fragment.'
|
|
13
|
+
invalid_uri: 'must be a valid URI.'
|
|
14
|
+
unspecified_scheme: 'must specify a scheme.'
|
|
15
|
+
relative_uri: 'must be an absolute URI.'
|
|
16
|
+
secured_uri: 'must be an HTTPS/SSL URI.'
|
|
17
|
+
forbidden_uri: 'is forbidden by the server.'
|
|
18
|
+
scopes:
|
|
19
|
+
not_match_configured: "doesn't match configured on the server."
|
|
20
|
+
|
|
21
|
+
doorkeeper:
|
|
22
|
+
applications:
|
|
23
|
+
confirmations:
|
|
24
|
+
destroy: 'Are you sure?'
|
|
25
|
+
buttons:
|
|
26
|
+
edit: 'Edit'
|
|
27
|
+
destroy: 'Destroy'
|
|
28
|
+
submit: 'Submit'
|
|
29
|
+
cancel: 'Cancel'
|
|
30
|
+
authorize: 'Authorize'
|
|
31
|
+
form:
|
|
32
|
+
error: 'Whoops! Check your form for possible errors'
|
|
33
|
+
help:
|
|
34
|
+
confidential: 'Application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential.'
|
|
35
|
+
redirect_uri: 'Use one line per URI'
|
|
36
|
+
blank_redirect_uri: "Leave it blank if you configured your provider to use Client Credentials, Resource Owner Password Credentials or any other grant type that doesn't require redirect URI."
|
|
37
|
+
scopes: 'Separate scopes with spaces. Leave blank to use the default scopes.'
|
|
38
|
+
edit:
|
|
39
|
+
title: 'Edit application'
|
|
40
|
+
index:
|
|
41
|
+
title: 'Your applications'
|
|
42
|
+
new: 'New Application'
|
|
43
|
+
name: 'Name'
|
|
44
|
+
callback_url: 'Callback URL'
|
|
45
|
+
confidential: 'Confidential?'
|
|
46
|
+
actions: 'Actions'
|
|
47
|
+
confidentiality:
|
|
48
|
+
'yes': 'Yes'
|
|
49
|
+
'no': 'No'
|
|
50
|
+
new:
|
|
51
|
+
title: 'New Application'
|
|
52
|
+
show:
|
|
53
|
+
title: 'Application: %{name}'
|
|
54
|
+
application_id: 'UID'
|
|
55
|
+
secret: 'Secret'
|
|
56
|
+
secret_hashed: 'Secret hashed'
|
|
57
|
+
scopes: 'Scopes'
|
|
58
|
+
confidential: 'Confidential'
|
|
59
|
+
callback_urls: 'Callback urls'
|
|
60
|
+
actions: 'Actions'
|
|
61
|
+
not_defined: 'Not defined'
|
|
62
|
+
|
|
63
|
+
authorizations:
|
|
64
|
+
buttons:
|
|
65
|
+
authorize: 'Authorize'
|
|
66
|
+
deny: 'Deny'
|
|
67
|
+
error:
|
|
68
|
+
title: 'An error has occurred'
|
|
69
|
+
new:
|
|
70
|
+
title: 'Authorization required'
|
|
71
|
+
prompt: 'Authorize %{client_name} to use your account?'
|
|
72
|
+
able_to: 'This application will be able to'
|
|
73
|
+
show:
|
|
74
|
+
title: 'Authorization code'
|
|
75
|
+
form_post:
|
|
76
|
+
title: 'Submit this form'
|
|
77
|
+
|
|
78
|
+
authorized_applications:
|
|
79
|
+
confirmations:
|
|
80
|
+
revoke: 'Are you sure?'
|
|
81
|
+
buttons:
|
|
82
|
+
revoke: 'Revoke'
|
|
83
|
+
index:
|
|
84
|
+
title: 'Your authorized applications'
|
|
85
|
+
application: 'Application'
|
|
86
|
+
created_at: 'Created At'
|
|
87
|
+
date_format: '%Y-%m-%d %H:%M:%S'
|
|
88
|
+
|
|
89
|
+
pre_authorization:
|
|
90
|
+
status: 'Pre-authorization'
|
|
91
|
+
|
|
92
|
+
errors:
|
|
93
|
+
messages:
|
|
94
|
+
# Common error messages
|
|
95
|
+
invalid_request:
|
|
96
|
+
unknown: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
|
|
97
|
+
missing_param: 'Missing required parameter: %{value}.'
|
|
98
|
+
request_not_authorized: 'Request need to be authorized. Required parameter for authorizing request is missing or invalid.'
|
|
99
|
+
invalid_code_challenge: 'Code challenge is required.'
|
|
100
|
+
invalid_redirect_uri: "The requested redirect uri is malformed or doesn't match client redirect URI."
|
|
101
|
+
unauthorized_client: 'The client is not authorized to perform this request using this method.'
|
|
102
|
+
access_denied: 'The resource owner or authorization server denied the request.'
|
|
103
|
+
invalid_scope: 'The requested scope is invalid, unknown, or malformed.'
|
|
104
|
+
invalid_code_challenge_method:
|
|
105
|
+
zero: 'The authorization server does not support PKCE as there are no accepted code_challenge_method values.'
|
|
106
|
+
one: 'The code_challenge_method must be %{challenge_methods}.'
|
|
107
|
+
other: 'The code_challenge_method must be one of %{challenge_methods}.'
|
|
108
|
+
server_error: 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.'
|
|
109
|
+
temporarily_unavailable: 'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server.'
|
|
110
|
+
|
|
111
|
+
# Configuration error messages
|
|
112
|
+
credential_flow_not_configured: 'Resource Owner Password Credentials flow failed due to Doorkeeper.configure.resource_owner_from_credentials being unconfigured.'
|
|
113
|
+
resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being unconfigured.'
|
|
114
|
+
admin_authenticator_not_configured: 'Access to admin panel is forbidden due to Doorkeeper.configure.admin_authenticator being unconfigured.'
|
|
115
|
+
|
|
116
|
+
# Access grant errors
|
|
117
|
+
unsupported_response_type: 'The authorization server does not support this response type.'
|
|
118
|
+
unsupported_response_mode: 'The authorization server does not support this response mode.'
|
|
119
|
+
|
|
120
|
+
# Access token errors
|
|
121
|
+
invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
|
|
122
|
+
invalid_grant: 'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.'
|
|
123
|
+
unsupported_grant_type: 'The authorization grant type is not supported by the authorization server.'
|
|
124
|
+
|
|
125
|
+
invalid_token:
|
|
126
|
+
revoked: "The access token was revoked"
|
|
127
|
+
expired: "The access token expired"
|
|
128
|
+
unknown: "The access token is invalid"
|
|
129
|
+
revoke:
|
|
130
|
+
unauthorized: "You are not authorized to revoke this token"
|
|
131
|
+
|
|
132
|
+
forbidden_token:
|
|
133
|
+
missing_scope: 'Access to this resource requires scope "%{oauth_scopes}".'
|
|
134
|
+
|
|
135
|
+
flash:
|
|
136
|
+
applications:
|
|
137
|
+
create:
|
|
138
|
+
notice: 'Application created.'
|
|
139
|
+
destroy:
|
|
140
|
+
notice: 'Application deleted.'
|
|
141
|
+
update:
|
|
142
|
+
notice: 'Application updated.'
|
|
143
|
+
authorized_applications:
|
|
144
|
+
destroy:
|
|
145
|
+
notice: 'Application revoked.'
|
|
146
|
+
|
|
147
|
+
layouts:
|
|
148
|
+
admin:
|
|
149
|
+
title: 'Doorkeeper'
|
|
150
|
+
nav:
|
|
151
|
+
oauth2_provider: 'OAuth2 Provider'
|
|
152
|
+
applications: 'Applications'
|
|
153
|
+
home: 'Home'
|
|
154
|
+
application:
|
|
155
|
+
title: 'OAuth authorization required'
|
data/config/locales/en.yml
CHANGED
|
@@ -15,13 +15,23 @@ en:
|
|
|
15
15
|
starts_at_help: Leave blank for no specific date
|
|
16
16
|
announcement: Announcement
|
|
17
17
|
step:
|
|
18
|
-
allow_multiple_answers: Allow Multiple Answers
|
|
19
18
|
allow_answers: Allow answers
|
|
20
19
|
allow_unregistered: Allow unregistered users to answer the form
|
|
21
20
|
allow_unregistered_help: If active, no login will be required in order to answer the form. This may lead to poor or unreliable data and it will be more vulnerable to automated attacks. Use with caution!
|
|
22
21
|
announcement: Announcement
|
|
23
22
|
only_forms:
|
|
24
23
|
admin:
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
exports:
|
|
25
|
+
survey_user_responses: Forms participant answers
|
|
26
|
+
form:
|
|
27
|
+
settings:
|
|
28
|
+
allow_multiple_responses: If answers are allowed, same user can answer multiple times
|
|
29
|
+
admin_email: Admin notification email
|
|
30
|
+
admin_email_help: Must be an organization admin or a space admin. Leave blank to disable.
|
|
31
|
+
admin_submission_mailer:
|
|
32
|
+
notify:
|
|
33
|
+
intro: A new submission was received for "%{questionnaire_title}" in %{participatory_space}.
|
|
34
|
+
subject: New submission for %{questionnaire_title}
|
|
35
|
+
submitted_by: Submitted by %{author}
|
|
36
|
+
unregistered: Unregistered participant
|
|
27
37
|
|
data/config/locales/fr.yml
CHANGED
|
@@ -14,14 +14,22 @@ fr:
|
|
|
14
14
|
starts_at: Réponses acceptées depuis
|
|
15
15
|
starts_at_help: Laisser vide si pas de limite de date pour débuter la réception des réponses
|
|
16
16
|
announcement: Annonces
|
|
17
|
+
admin_email: Email de notification administrateur
|
|
18
|
+
admin_email_help: Doit être un admin de l'organisation ou de l'espace. Laisser vide pour désactiver.
|
|
17
19
|
step:
|
|
18
|
-
|
|
20
|
+
allow_multiple_responses: Autoriser les utilisateurs à répondre plusieurs fois
|
|
19
21
|
allow_answers: Autoriser les réponses
|
|
20
22
|
allow_unregistered: Autoriser les réponses pour les visiteurs
|
|
21
23
|
allow_unregistered_help: Si ceci est actif, les visiteurs n'auront pas besoin de compte pour répondre.
|
|
22
24
|
announcement: Annonce
|
|
23
25
|
only_forms:
|
|
24
26
|
admin:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
exports:
|
|
28
|
+
survey_user_answers: Réponses au formulaire
|
|
29
|
+
admin_submission_mailer:
|
|
30
|
+
notify:
|
|
31
|
+
intro: Une nouvelle soumission a été reçue pour « %{questionnaire_title} » dans %{participatory_space}.
|
|
32
|
+
subject: Nouvelle soumission pour %{questionnaire_title}
|
|
33
|
+
submitted_by: Soumis par %{author}
|
|
34
|
+
unregistered: Participant non inscrit
|
|
27
35
|
|
data/config/locales/pt.yml
CHANGED
|
@@ -14,14 +14,22 @@ pt:
|
|
|
14
14
|
starts_at: Responstas ativas depois do
|
|
15
15
|
starts_at_help: Deixa vazia se não tem inicio para receber respostas
|
|
16
16
|
announcement: Anuncios
|
|
17
|
+
admin_email: Email de notificação do administrador
|
|
18
|
+
admin_email_help: Deve ser um admin da organização ou do espaço. Deixe vazio para desativar.
|
|
17
19
|
step:
|
|
18
|
-
|
|
20
|
+
allow_multiple_responses: Deixar os usarios responder mais que uma vez
|
|
19
21
|
allow_answers: Autorisar respostas
|
|
20
22
|
allow_unregistered: Autorisar respostas de visitores
|
|
21
23
|
allow_unregistered_help: Se isso esta ativos, pessoas sem contas poderam responder.
|
|
22
24
|
announcement: Anuncios
|
|
23
25
|
only_forms:
|
|
24
26
|
admin:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
exports:
|
|
28
|
+
survey_user_answers: Responsas ao formulario
|
|
29
|
+
admin_submission_mailer:
|
|
30
|
+
notify:
|
|
31
|
+
intro: Uma nova submissão foi recebida para "%{questionnaire_title}" em %{participatory_space}.
|
|
32
|
+
subject: Nova submissão para %{questionnaire_title}
|
|
33
|
+
submitted_by: Submetido por %{author}
|
|
34
|
+
unregistered: Participante não registado
|
|
27
35
|
|
|
@@ -6,36 +6,49 @@ Decidim.register_component(:only_forms) do |component|
|
|
|
6
6
|
survey_component = Decidim.find_component_manifest("surveys")
|
|
7
7
|
component.attributes = survey_component.attributes.deep_dup
|
|
8
8
|
component.name = "only_forms"
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
component.settings(:global) do |settings|
|
|
11
|
-
settings.attribute :scopes_enabled, type: :boolean, default: false
|
|
12
|
-
settings.attribute :scope_id, type: :scope
|
|
13
|
-
settings.attribute :starts_at, type: :time
|
|
14
|
-
settings.attribute :ends_at, type: :time
|
|
15
11
|
settings.attribute :announcement, type: :text, translated: true, editor: true
|
|
16
|
-
settings.attribute :clean_after_publish, type: :boolean, default: true
|
|
17
12
|
end
|
|
18
13
|
|
|
19
14
|
component.settings(:step) do |settings|
|
|
20
|
-
settings.attribute :allow_answers, type: :boolean, default: false
|
|
21
|
-
settings.attribute :allow_unregistered, type: :boolean, default: false
|
|
22
|
-
settings.attribute :allow_multiple_answers, type: :boolean, default: true
|
|
23
15
|
settings.attribute :announcement, type: :text, translated: true, editor: true
|
|
24
16
|
end
|
|
25
17
|
|
|
26
|
-
component.exports :
|
|
27
|
-
exports.collection do |
|
|
28
|
-
survey = Decidim::Surveys::Survey.
|
|
29
|
-
Decidim::Forms::
|
|
18
|
+
component.exports :survey_user_responses do |exports|
|
|
19
|
+
exports.collection do |_component, _user, survey_id|
|
|
20
|
+
survey = Decidim::Surveys::Survey.find(survey_id)
|
|
21
|
+
Decidim::Forms::QuestionnaireUserResponses.for(survey.questionnaire)
|
|
30
22
|
end
|
|
31
23
|
|
|
32
|
-
exports.formats %w(CSV JSON Excel)
|
|
24
|
+
exports.formats %w(CSV JSON Excel FormPDF)
|
|
33
25
|
|
|
34
|
-
exports.serializer Decidim::Forms::
|
|
26
|
+
exports.serializer Decidim::Forms::UserResponsesSerializer
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
component.exports :published_survey_user_responses do |exports|
|
|
30
|
+
exports.collection do |component|
|
|
31
|
+
survey = Decidim::Surveys::Survey.find_by(component:)
|
|
32
|
+
|
|
33
|
+
Decidim::Forms::Response
|
|
34
|
+
.joins(:question)
|
|
35
|
+
.where(questionnaire: survey.questionnaire)
|
|
36
|
+
.where.not(decidim_forms_questions: { question_type: %w(separator title_and_description) })
|
|
37
|
+
.where.not(decidim_forms_questions: { survey_responses_published_at: nil })
|
|
38
|
+
.includes(:question, :choices, :user)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
exports.formats []
|
|
42
|
+
exports.include_in_open_data = true
|
|
43
|
+
exports.serializer Decidim::Surveys::UserResponsesSerializer
|
|
35
44
|
end
|
|
36
45
|
|
|
37
46
|
component.register_resource(:survey) do |resource|
|
|
38
47
|
resource.model_class_name = "Decidim::Surveys::Survey"
|
|
48
|
+
resource.card = "decidim/surveys/survey"
|
|
49
|
+
resource.searchable = true
|
|
50
|
+
resource.actions = %w(respond)
|
|
39
51
|
end
|
|
52
|
+
|
|
40
53
|
component
|
|
41
54
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "rails"
|
|
4
4
|
require "decidim/core"
|
|
5
|
+
require "deface"
|
|
5
6
|
|
|
6
7
|
module Decidim
|
|
7
8
|
module OnlyForms
|
|
@@ -9,10 +10,23 @@ module Decidim
|
|
|
9
10
|
class Engine < ::Rails::Engine
|
|
10
11
|
isolate_namespace Decidim::OnlyForms
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
initializer "decidim_only_forms.admin_notification_email" do
|
|
14
|
+
config.to_prepare do
|
|
15
|
+
ActiveSupport::Notifications.subscribe("decidim.forms.response_questionnaire:after") do |event_name, data|
|
|
16
|
+
Rails.logger.debug "\n--- EVENT PAYLOAD ---"
|
|
17
|
+
Rails.logger.debug data
|
|
18
|
+
Rails.logger.debug "---------------------"
|
|
19
|
+
|
|
20
|
+
Decidim::OnlyForms::AdminSubmissionNotification.handle(event_name, data)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
14
23
|
end
|
|
15
24
|
|
|
25
|
+
# Overrides
|
|
26
|
+
config.to_prepare do
|
|
27
|
+
Decidim::Surveys::Admin::SurveySettingsForm.include(Decidim::OnlyForms::Overrides::OnlyFormSettingsForm)
|
|
28
|
+
Decidim::Surveys::Admin::UpdateSurveySettings.include(Decidim::OnlyForms::Overrides::UpdateOnlyFormSettings)
|
|
29
|
+
end
|
|
16
30
|
end
|
|
17
31
|
end
|
|
18
32
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module OnlyForms
|
|
5
|
+
module Overrides
|
|
6
|
+
module OnlyFormSettingsForm
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
attribute :allow_multiple_responses, :boolean
|
|
11
|
+
attribute :admin_email, String
|
|
12
|
+
|
|
13
|
+
validate :admin_email_must_be_space_admin
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def admin_email_must_be_space_admin
|
|
18
|
+
return if allowlist.valid_setting?
|
|
19
|
+
|
|
20
|
+
survey.errors.add(:admin_email, :invalid)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def allowlist
|
|
24
|
+
::Decidim::OnlyForms::AdminEmailAllowlist.new(settings.admin_email, participatory_space)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module OnlyForms
|
|
5
|
+
module Overrides
|
|
6
|
+
module UpdateOnlyFormSettings
|
|
7
|
+
extend ActiveSupport::Concern
|
|
8
|
+
|
|
9
|
+
included do
|
|
10
|
+
alias_method :decidim_original_update_survey_settings, :update_survey_settings
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def update_survey_settings
|
|
15
|
+
survey.update!(
|
|
16
|
+
allow_responses: form.allow_responses,
|
|
17
|
+
allow_editing_responses: form.allow_editing_responses,
|
|
18
|
+
allow_unregistered: form.allow_unregistered,
|
|
19
|
+
starts_at: form.starts_at,
|
|
20
|
+
ends_at: form.ends_at,
|
|
21
|
+
clean_after_publish: form.clean_after_publish,
|
|
22
|
+
announcement: form.announcement,
|
|
23
|
+
allow_multiple_responses: form.allow_multiple_responses,
|
|
24
|
+
admin_email: form.admin_email
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -5,7 +5,7 @@ require "decidim/core/test/factories"
|
|
|
5
5
|
FactoryBot.define do
|
|
6
6
|
factory :only_forms_component, parent: :component do
|
|
7
7
|
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :only_forms).i18n_name }
|
|
8
|
-
manifest_name :only_forms
|
|
8
|
+
manifest_name { :only_forms }
|
|
9
9
|
participatory_space { create(:participatory_process, :with_steps) }
|
|
10
10
|
end
|
|
11
11
|
|
data/lib/decidim/only_forms.rb
CHANGED
|
@@ -4,6 +4,8 @@ require "decidim/only_forms/admin"
|
|
|
4
4
|
require "decidim/only_forms/engine"
|
|
5
5
|
require "decidim/only_forms/admin_engine"
|
|
6
6
|
require "decidim/only_forms/component"
|
|
7
|
+
require "decidim/only_forms/overrides/only_form_settings_form"
|
|
8
|
+
require "decidim/only_forms/overrides/update_only_form_settings"
|
|
7
9
|
|
|
8
10
|
module Decidim
|
|
9
11
|
# This namespace holds the logic of the `OnlyForms` component. This component
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Rake::Task["decidim:choose_target_plugins"].enhance do
|
|
4
|
+
name = Decidim::OnlyForms::Engine.railtie_name
|
|
5
|
+
ENV["FROM"] = "#{ENV.fetch("FROM", nil)},#{name}" unless ENV["FROM"].to_s.include?(name)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
if Rake::Task.task_defined?("decidim:upgrade")
|
|
9
|
+
Rake::Task["decidim:upgrade"].enhance do
|
|
10
|
+
name = Decidim::OnlyForms::Engine.railtie_name
|
|
11
|
+
Rake::Task["#{name}:webpacker:install"].invoke if Rake::Task.task_defined?("#{name}:webpacker:install")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "decidim/gem_manager"
|
|
4
|
+
|
|
5
|
+
namespace :decidim_only_forms do
|
|
6
|
+
namespace :webpacker do
|
|
7
|
+
desc "Installs Only Forms webpacker files in Rails instance application"
|
|
8
|
+
task install: :environment do
|
|
9
|
+
raise "Decidim gem is not installed" if decidim_path.nil?
|
|
10
|
+
|
|
11
|
+
install_only_forms_npm
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
desc "Adds Only Forms dependencies in package.json"
|
|
15
|
+
task upgrade: :environment do
|
|
16
|
+
raise "Decidim gem is not installed" if decidim_path.nil?
|
|
17
|
+
|
|
18
|
+
install_only_forms_npm
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def install_only_forms_npm
|
|
22
|
+
return if only_forms_npm_dependencies.empty?
|
|
23
|
+
|
|
24
|
+
puts "install NPM packages. You can also do this manually with this command:"
|
|
25
|
+
puts "npm i #{only_forms_npm_dependencies.join(" ")}"
|
|
26
|
+
only_forms_system! "npm i #{only_forms_npm_dependencies.join(" ")}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def only_forms_npm_dependencies
|
|
30
|
+
@only_forms_npm_dependencies ||= if only_forms_path.nil? || !File.exist?(only_forms_path.join("package.json"))
|
|
31
|
+
[]
|
|
32
|
+
else
|
|
33
|
+
package_json = JSON.parse(File.read(only_forms_path.join("package.json")))
|
|
34
|
+
(package_json["dependencies"] || {}).map { |package, version| "#{package}@#{version}" }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def only_forms_path
|
|
39
|
+
@only_forms_path ||= Pathname.new(only_forms_gemspec.full_gem_path) if Gem.loaded_specs.has_key?(only_forms_gem_name)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def rails_app_path
|
|
43
|
+
@rails_app_path ||= Rails.root
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def only_forms_system!(command)
|
|
47
|
+
system("cd #{rails_app_path} && #{command}") || abort("\n== Command #{command} failed ==")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def only_forms_gemspec
|
|
51
|
+
@only_forms_gemspec ||= Gem.loaded_specs[only_forms_gem_name]
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def only_forms_gem_name
|
|
55
|
+
"decidim-only_forms"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-only_forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hadrien Froger
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: decidim-core
|
|
@@ -20,7 +20,7 @@ dependencies:
|
|
|
20
20
|
version: '0.26'
|
|
21
21
|
- - "<"
|
|
22
22
|
- !ruby/object:Gem::Version
|
|
23
|
-
version: '0.
|
|
23
|
+
version: '0.33'
|
|
24
24
|
type: :runtime
|
|
25
25
|
prerelease: false
|
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -30,7 +30,7 @@ dependencies:
|
|
|
30
30
|
version: '0.26'
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.
|
|
33
|
+
version: '0.33'
|
|
34
34
|
- !ruby/object:Gem::Dependency
|
|
35
35
|
name: decidim-forms
|
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
version: '0.26'
|
|
41
41
|
- - "<"
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '0.
|
|
43
|
+
version: '0.33'
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
version: '0.26'
|
|
51
51
|
- - "<"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '0.
|
|
53
|
+
version: '0.33'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: decidim-surveys
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
version: '0.26'
|
|
61
61
|
- - "<"
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '0.
|
|
63
|
+
version: '0.33'
|
|
64
64
|
type: :runtime
|
|
65
65
|
prerelease: false
|
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -70,7 +70,7 @@ dependencies:
|
|
|
70
70
|
version: '0.26'
|
|
71
71
|
- - "<"
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: '0.
|
|
73
|
+
version: '0.33'
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: decidim-templates
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -80,7 +80,7 @@ dependencies:
|
|
|
80
80
|
version: '0.26'
|
|
81
81
|
- - "<"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '0.
|
|
83
|
+
version: '0.33'
|
|
84
84
|
type: :runtime
|
|
85
85
|
prerelease: false
|
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -90,7 +90,21 @@ dependencies:
|
|
|
90
90
|
version: '0.26'
|
|
91
91
|
- - "<"
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
|
-
version: '0.
|
|
93
|
+
version: '0.33'
|
|
94
|
+
- !ruby/object:Gem::Dependency
|
|
95
|
+
name: deface
|
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - "~>"
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: '1.9'
|
|
101
|
+
type: :runtime
|
|
102
|
+
prerelease: false
|
|
103
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
- - "~>"
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: '1.9'
|
|
94
108
|
description: Component for create surveys with multiple answers'
|
|
95
109
|
email:
|
|
96
110
|
- hadrien@octree.ch
|
|
@@ -102,11 +116,19 @@ files:
|
|
|
102
116
|
- LICENSE-AGPLv3.txt
|
|
103
117
|
- README.md
|
|
104
118
|
- Rakefile
|
|
105
|
-
- app/commands/decidim/forms/answer_questionnaire.rb
|
|
106
119
|
- app/commands/decidim/forms/command.rb
|
|
120
|
+
- app/commands/decidim/forms/response_questionnaire.rb
|
|
107
121
|
- app/controllers/decidim/forms/concerns/has_questionnaire.rb
|
|
122
|
+
- app/mailers/decidim/only_forms/admin_submission_mailer.rb
|
|
108
123
|
- app/models/decidim/surveys/survey.rb
|
|
124
|
+
- app/overrides/add_only_forms_attributes.rb
|
|
125
|
+
- app/overrides/replace_announcement_display.rb
|
|
126
|
+
- app/services/decidim/only_forms/admin_email_allowlist.rb
|
|
127
|
+
- app/services/decidim/only_forms/admin_submission_notification.rb
|
|
128
|
+
- app/views/decidim/only_forms/admin_submission_mailer/notify.html.erb
|
|
109
129
|
- config/i18n-tasks.yml
|
|
130
|
+
- config/initializers/doorkeeper.rb
|
|
131
|
+
- config/locales/doorkeeper.en.yml
|
|
110
132
|
- config/locales/en.yml
|
|
111
133
|
- config/locales/fr.yml
|
|
112
134
|
- config/locales/pt.yml
|
|
@@ -115,8 +137,12 @@ files:
|
|
|
115
137
|
- lib/decidim/only_forms/admin_engine.rb
|
|
116
138
|
- lib/decidim/only_forms/component.rb
|
|
117
139
|
- lib/decidim/only_forms/engine.rb
|
|
140
|
+
- lib/decidim/only_forms/overrides/only_form_settings_form.rb
|
|
141
|
+
- lib/decidim/only_forms/overrides/update_only_form_settings.rb
|
|
118
142
|
- lib/decidim/only_forms/test/factories.rb
|
|
119
143
|
- lib/decidim/only_forms/version.rb
|
|
144
|
+
- lib/tasks/decidim/only_forms/only_forms_upgrade.rake
|
|
145
|
+
- lib/tasks/decidim/only_forms/only_forms_webpacker.rake
|
|
120
146
|
homepage: https://github.com/decidim/decidim-module-only_forms
|
|
121
147
|
licenses:
|
|
122
148
|
- AGPL-3.0
|
|
@@ -129,14 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
129
155
|
requirements:
|
|
130
156
|
- - ">="
|
|
131
157
|
- !ruby/object:Gem::Version
|
|
132
|
-
version:
|
|
158
|
+
version: 3.4.7
|
|
133
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
160
|
requirements:
|
|
135
161
|
- - ">="
|
|
136
162
|
- !ruby/object:Gem::Version
|
|
137
163
|
version: '0'
|
|
138
164
|
requirements: []
|
|
139
|
-
rubygems_version: 3.
|
|
165
|
+
rubygems_version: 3.4.19
|
|
140
166
|
signing_key:
|
|
141
167
|
specification_version: 4
|
|
142
168
|
summary: A decidim only_forms module
|