Skip to content

Commit 005bf38

Browse files
Create and register ephemeral workflow for census (Excel)
1 parent 0eea5f7 commit 005bf38

5 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
# An ephemeral AuthorizationHandler that uses information uploaded
4+
# from a CSV file to authorize against the age of the user
5+
class EphemeralCensusAuthorizationHandler < CensusAuthorizationHandler
6+
def to_partial_path
7+
"census_authorization/form"
8+
end
9+
end

decidim-census/config/locales/ca.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ ca:
2121
age: 'Edat mínima'
2222
max_age: 'Edat máxima'
2323
subcensus: 'Subcens'
24+
ephemeral_census_authorization_handler:
25+
explanation: Autoritza la teva sessió contra el Padró Municipal
26+
fields:
27+
age: Edat mínima
28+
birthdate: Data de naixement
29+
max_age: Edat máxima
30+
subcensus: Subcens
31+
name: Padró municipal per a accés temporal
32+
type: Excel
2433
census:
2534
errors:
2635
messages:

decidim-census/config/locales/en.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ en:
2121
age: 'Minimum age'
2222
age: 'Maximum age'
2323
subcensus: 'Subcensus'
24+
ephemeral_census_authorization_handler:
25+
explanation: Authorize your session against the Municipality Census
26+
fields:
27+
age: Minimum age
28+
birthdate: Birthdate
29+
max_age: Maximum age
30+
subcensus: Subcensus
31+
name: Municipality Census for temporary access
32+
type: Excel
2433
census:
2534
errors:
2635
messages:

decidim-census/config/locales/es.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ es:
2121
age: 'Edad mínima'
2222
max_age: 'Edad máxima'
2323
subcensus: 'Subcenso'
24+
ephemeral_census_authorization_handler:
25+
explanation: Autoriza tu sesión contra el Padrón Municipal
26+
fields:
27+
age: Edad mínima
28+
birthdate: Fecha de nacimiento
29+
max_age: Edad máxima
30+
subcensus: Subcenso
31+
name: Padrón Municipal para acceso temporal
32+
type: Excel
2433
census:
2534
errors:
2635
messages:

decidim-census/lib/decidim/census/engine.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ class Engine < ::Rails::Engine
2222
options.attribute :max_age, type: :string, required: false
2323
end
2424
end
25+
26+
Decidim::Verifications.register_workflow(:ephemeral_census_authorization_handler) do |auth|
27+
auth.ephemeral = true
28+
auth.form = "EphemeralCensusAuthorizationHandler"
29+
auth.action_authorizer = "Decidim::AgeActionAuthorization::Authorizer"
30+
auth.options do |options|
31+
options.attribute :age, type: :string, required: false
32+
options.attribute :max_age, type: :string, required: false
33+
end
34+
end
2535
end
2636
end
2737
end

0 commit comments

Comments
 (0)