decidim-file_authorization_handler 0.28.2.0 → 0.31.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91f007f8c10ff184e7828552c2b527075bcdbf4aa220db5cb2c48ef5dbcc6cbf
4
- data.tar.gz: f0bfd5bfe3b636c4974d5f56baddb475c0a09c672c35fa07a56905016bdedf31
3
+ metadata.gz: 6f9bfe24911c0472f08d4b8801c889913bc2faab0fbda5eaf678b9af28d6216e
4
+ data.tar.gz: f433053c3edb20160f3d3a793bc4b8db22fa4b3ac48f94c6dc1234ff058fe7de
5
5
  SHA512:
6
- metadata.gz: 71f00f12a1073047d26ea7ffabc370d5df5902f8192100de698a6f8d8286a0a17e41f3f05c5a92f623b21aa0b573e2ff72457a862ec1252cc1a5e2e9106952f5
7
- data.tar.gz: de3cf55b3c36e17303cb1b48cbb8a905e66c57bedadcd5e91347997594b171d83a028475219c0bd94fa90b83003562f38fca90398f3cefad15c1431d489a8ce2
6
+ metadata.gz: fc59d1bc16eb4d823ae78f69434885199a4403f1235ca05918d3fc7b109760189c90e840f3f8c4ff4770939c220fb2ff0a56f05047820e25e10cdf268d121574
7
+ data.tar.gz: 40b6248af89c9cce82e8078dc45815538d7c7a209566b06da90fe92498f45037be1a2a60ac5f195e2deb8f6dcf76cfb7f88f4de2972f5a1637ebfecb4012ce77
data/README.md CHANGED
@@ -96,16 +96,16 @@ bin/rails decidim_file_authorization_handler:install:migrations
96
96
  bin/rails db:migrate
97
97
  ```
98
98
 
99
- Finally, add the following line to your `config/routes.rb` file:
100
-
101
- ```ruby
102
- mount Decidim::FileAuthorizationHandler::AdminEngine => '/admin'
99
+ ## Create development_app
100
+ Run:
101
+ ```bash
102
+ bin/rails decidim:generate_external_development_app
103
+ bin/rails decidim_file_authorization_handler:install:migrations
104
+ bin/rails db:migrate
103
105
  ```
104
106
 
105
107
  ## Run tests
106
108
 
107
- Node 16.9.1 is required!
108
-
109
109
  Create a dummy app in your application (if not present):
110
110
 
111
111
  ```bash
@@ -130,7 +130,7 @@ undefined method 'decidim_file_authorization_handler_admin_path'
130
130
  for module#<Module:0x00007fa2aa4e2a10>
131
131
  ```
132
132
 
133
- review if you have mounted the Engine routes into your application routes.
133
+ review if you have mounted the Engine routes into your application routes, cause is not longer necessary.
134
134
 
135
135
  ## License
136
136
 
@@ -9,9 +9,18 @@ module Decidim
9
9
  @status = Status.new(current_organization)
10
10
  end
11
11
 
12
+ def new
13
+ enforce_permission_to :create, :authorization
14
+ @status = Status.new(current_organization)
15
+ end
16
+
12
17
  def create
13
18
  enforce_permission_to :create, :authorization
14
19
  if params[:file]
20
+ unless csv_file?(params[:file])
21
+ flash[:alert] = t(".invalid_format")
22
+ return redirect_to censuses_path
23
+ end
15
24
  data = CsvData.new(params[:file].path)
16
25
  # rubocop: disable Rails/SkipsModelValidations
17
26
  CensusDatum.insert_all(current_organization, data.values, data.headers[2..])
@@ -28,6 +37,12 @@ module Decidim
28
37
  CensusDatum.clear(current_organization)
29
38
  redirect_to censuses_path, notice: t(".success")
30
39
  end
40
+
41
+ private
42
+
43
+ def csv_file?(file)
44
+ File.extname(file.original_filename).casecmp(".csv").zero? && file.content_type == "text/csv"
45
+ end
31
46
  end
32
47
  end
33
48
  end
@@ -5,17 +5,15 @@ module Decidim
5
5
  class RemoveDuplicatesJob < ApplicationJob
6
6
  queue_as :default
7
7
 
8
- # rubocop:disable Style/HashSyntax
9
8
  def perform(organization)
10
9
  duplicated_census(organization).pluck(:id_document).each do |id_document|
11
10
  CensusDatum.inside(organization)
12
- .where(id_document: id_document)
11
+ .where(id_document:)
13
12
  .order(id: :desc)
14
13
  .all[1..]
15
14
  .each(&:delete)
16
15
  end
17
16
  end
18
- # rubocop:enable Style/HashSyntax
19
17
 
20
18
  private
21
19
 
@@ -27,7 +27,7 @@ module Decidim
27
27
  return "" if id_document.blank?
28
28
 
29
29
  Digest::SHA256.hexdigest(
30
- "#{id_document}-#{Rails.application.secrets.secret_key_base}"
30
+ "#{id_document}-#{Rails.application.secret_key_base}"
31
31
  )
32
32
  end
33
33
 
@@ -16,7 +16,7 @@ class FileAuthorizationHandler < Decidim::AuthorizationHandler
16
16
  # Customized constructor to support decidim-initiatives.
17
17
  def initialize(params)
18
18
  params[:id_document] = params.delete(:document_number) unless params.has_key?(:id_document)
19
- super(params)
19
+ super
20
20
  end
21
21
 
22
22
  def metadata
@@ -43,13 +43,13 @@ class FileAuthorizationHandler < Decidim::AuthorizationHandler
43
43
  end
44
44
 
45
45
  def authorized?
46
- return true if census_for_user
46
+ true if census_for_user
47
47
  end
48
48
 
49
49
  def unique_id
50
50
  return nil unless organization
51
51
 
52
- Digest::SHA256.hexdigest("#{census_for_user&.id_document}-#{organization.id}-#{Rails.application.secrets.secret_key_base}")
52
+ Digest::SHA256.hexdigest("#{census_for_user&.id_document}-#{organization.id}-#{Rails.application.secret_key_base}")
53
53
  end
54
54
 
55
55
  def census_for_user
@@ -0,0 +1,26 @@
1
+ <% add_decidim_page_title(t("admin.new.title", scope: "decidim.file_authorization_handler")) %>
2
+ <div class="item_show__header">
3
+ <h2 class="item_show__header-title">
4
+ <%= t("admin.new.title", scope: "decidim.file_authorization_handler") %>
5
+ </h2>
6
+ </div>
7
+ <div class="card-section">
8
+ <div class="row column">
9
+ <%= render partial: "upload_info" %>
10
+ </div>
11
+
12
+ <div class="row column">
13
+ <%= form_tag censuses_path, multipart: true, class: "form" do %>
14
+ <div class="font-semibold">
15
+ <%= label_tag :name, t("admin.new.file", scope: "decidim.file_authorization_handler") %>
16
+ <%= file_field_tag :file, accept: ".csv" %>
17
+ </div>
18
+
19
+ <div class="item__edit-sticky">
20
+ <div class="item__edit-sticky-container">
21
+ <%= submit_tag t("admin.new.submit", scope: "decidim.file_authorization_handler"), class: "button button__sm button__secondary" %>
22
+ </div>
23
+ </div>
24
+ <% end %>
25
+ </div>
26
+ </div>
@@ -1,44 +1,26 @@
1
1
  <% add_decidim_page_title(t("admin.show.title", scope: "decidim.file_authorization_handler")) %>
2
2
 
3
3
  <div class="card">
4
+ <div class="item_show__header item_show__header--with-action-options">
5
+ <h1 class="item_show__header-title">
6
+ <%= t("admin.show.title", scope: "decidim.file_authorization_handler") %>
7
+ <%= link_to t("admin.show.import_csv", scope: "decidim.file_authorization_handler"), new_censuses_path, class: "button button__sm button__transparent-secondary" %>
8
+ <% if @status.count > 0 %>
9
+ <%= link_to t("admin.destroy.title", scope: "decidim.file_authorization_handler"),
10
+ censuses_path,
11
+ method: :delete,
12
+ class: "button button__sm button__secondary alert hollow tiny button--title destroy",
13
+ data: { confirm: t("admin.destroy.confirm", scope: "decidim.file_authorization_handler") } %>
14
+ <% end %>
15
+ </h1>
16
+ </div>
4
17
  <div class="card-section p-4">
5
- <div class="item_show__header">
6
- <h1 class="item_show__header-title">
7
- <%= t("admin.show.title", scope: "decidim.file_authorization_handler") %>
8
- <% if @status.count > 0 %>
9
- <%= link_to t('decidim.file_authorization_handler.admin.destroy.title'),
10
- censuses_path,
11
- method: :delete,
12
- class: 'button button__sm button__secondary alert hollow tiny button--title destroy',
13
- data: { confirm: t('decidim.file_authorization_handler.admin.destroy.confirm') } %>
14
- <% end %>
15
- </h1>
16
- </div>
17
18
  <% if @status.count > 0 %>
18
- <p><%= t('decidim.file_authorization_handler.admin.show.data', count: @status.count,
19
+ <p><%= t("admin.show.data", scope: "decidim.file_authorization_handler", count: @status.count,
19
20
  due_date: l(@status.last_import_at, format: :long)) %>
20
21
  </p>
21
22
  <% else %>
22
- <p><%= t('admin.show.empty', scope: 'decidim.file_authorization_handler') %></p>
23
+ <p><%= t("admin.show.empty", scope: "decidim.file_authorization_handler") %></p>
23
24
  <% end %>
24
25
  </div>
25
-
26
- <div id="wrapper-action-view">
27
- <div class="card-section p-4">
28
- <div class="item_show__header">
29
-
30
- <h1 class="item_show__header-title">
31
- <%= t("admin.new.title", scope: "decidim.file_authorization_handler") %><div class="card-section p-4">
32
- </h1>
33
- </div>
34
-
35
- <%= render "upload_info" %>
36
-
37
- <%= form_tag censuses_path, multipart: true, class: 'form' do %>
38
- <%= label_tag :name, t('admin.new.file', scope: 'decidim.file_authorization_handler') %>
39
- <%= file_field_tag :file %>
40
- <%= submit_tag t('admin.new.submit', scope: 'decidim.file_authorization_handler'), class: 'button button__sm button__secondary hollow tiny button--title' %>
41
- <% end %>
42
- </div>
43
- </div>
44
26
  </div>
@@ -0,0 +1,182 @@
1
+ # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
+
3
+ # The "main" locale.
4
+ base_locale: en
5
+ ## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
6
+ locales: [ca, en, es, eu]
7
+ ## Reporting locale, default: en. Available: en, ru.
8
+ # internal_locale: en
9
+
10
+ # Read and write translations.
11
+ data:
12
+ ## Translations are read from the file system. Supported format: YAML, JSON.
13
+ ## Provide a custom adapter:
14
+ # adapter: I18n::Tasks::Data::FileSystem
15
+
16
+ # Locale files or `Dir.glob` patterns where translations are read from:
17
+ read:
18
+ ## Default:
19
+ # - config/locales/%{locale}.yml
20
+ ## More files:
21
+ # - config/locales/**/*.%{locale}.yml
22
+
23
+ # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
24
+ # `i18n-tasks normalize -p` will force move the keys according to these rules
25
+ write:
26
+ ## For example, write devise and simple form keys to their respective files:
27
+ # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
28
+ ## Catch-all default:
29
+ - locales/%{locale}.yml
30
+
31
+ # External locale data (e.g. gems).
32
+ # This data is not considered unused and is never written to.
33
+ external:
34
+ ## Example (replace %#= with %=):
35
+ # - "<%#= %x[bundle info vagrant --path].chomp %>/templates/locales/%{locale}.yml"
36
+
37
+ ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, isolating_router, or a custom class.
38
+ # router: conservative_router
39
+
40
+ yaml:
41
+ write:
42
+ # do not wrap lines at 80 characters
43
+ line_width: -1
44
+
45
+ ## Pretty-print JSON:
46
+ # json:
47
+ # write:
48
+ # indent: ' '
49
+ # space: ' '
50
+ # object_nl: "\n"
51
+ # array_nl: "\n"
52
+
53
+ # Find translate calls
54
+ search:
55
+ ## Paths or `Find.find` patterns to search in:
56
+ paths:
57
+ # - app/
58
+
59
+ ## Root directories for relative keys resolution.
60
+ # relative_roots:
61
+ # - app/controllers
62
+ # - app/helpers
63
+ # - app/mailers
64
+ # - app/presenters
65
+ # - app/views
66
+
67
+ ## Directories where method names which should not be part of a relative key resolution.
68
+ # By default, if a relative translation is used inside a method, the name of the method will be considered part of the resolved key.
69
+ # Directories listed here will not consider the name of the method part of the resolved key
70
+ #
71
+ # relative_exclude_method_name_paths:
72
+ # -
73
+
74
+ ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
75
+ ## *.jpg *.jpeg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less
76
+ ## *.yml *.json *.zip *.tar.gz *.swf *.flv *.mp3 *.wav *.flac *.webm *.mp4 *.ogg *.opus *.webp *.map *.xlsx
77
+ # exclude:
78
+ # - source/images
79
+ # - source/static
80
+ # - source/stylesheets
81
+
82
+ ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
83
+ ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
84
+ # only: ["*.rb", "*.html.slim"]
85
+
86
+ ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
87
+ # strict: true
88
+
89
+ ## Allows adding ast_matchers for finding translations using the AST-scanners
90
+ ## The available matchers are:
91
+ ## - RailsModelMatcher
92
+ ## Matches ActiveRecord translations like
93
+ ## User.human_attribute_name(:email) and User.model_name.human
94
+ ## - DefaultI18nSubjectMatcher
95
+ ## Matches ActionMailer's default_i18n_subject method
96
+ ##
97
+ ## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
98
+ # ast_matchers:
99
+ # - 'I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher'
100
+ # - 'I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher'
101
+
102
+ ## Multiple scanners can be used. Their results are merged.
103
+ ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
104
+ ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
105
+
106
+ ## Translation Services
107
+ # translation:
108
+ # # Google Translate
109
+ # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
110
+ # google_translate_api_key: "AbC-dEf5"
111
+ # # DeepL Pro Translate
112
+ # # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
113
+ # deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
114
+ # # deepl_host: "https://api.deepl.com"
115
+ # # deepl_version: "v2"
116
+ # # deepl_glossary_ids:
117
+ # # - f28106eb-0e06-489e-82c6-8215d6f95089
118
+ # # - 2c6415be-1852-4f54-9e1b-d800463496b4
119
+ # # add additional options to the DeepL.translate call: https://www.deepl.com/docs-api/translate-text/translate-text/
120
+ # deepl_options:
121
+ # formality: prefer_less
122
+ # # OpenAI
123
+ # openai_api_key: "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
124
+ # # openai_model: "gpt-4o-mini" # see https://platform.openai.com/docs/models
125
+ # # may contain `%{from}` and `%{to}`, which will be replaced by source and target locale codes, respectively (using `Kernel.format`)
126
+ # # openai_system_prompt: >-
127
+ # # You are a professional translator that translates content from the %{from} locale
128
+ # # to the %{to} locale in an i18n locale array.
129
+ # #
130
+ # # The array has a structured format and contains multiple strings. Your task is to translate
131
+ # # each of these strings and create a new array with the translated strings.
132
+ # #
133
+ # # HTML markups (enclosed in < and > characters) must not be changed under any circumstance.
134
+ # # Variables (starting with %%{ and ending with }) must not be changed under any circumstance.
135
+ # #
136
+ # # Keep in mind the context of all the strings for a more accurate translation.
137
+
138
+ ## Do not consider these keys missing:
139
+ ignore_missing:
140
+ # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
141
+ # - '{devise,simple_form}.*'
142
+ - '{activemodel,census_authorization}.*'
143
+
144
+ ## Consider these keys used:
145
+ ignore_unused:
146
+ # - 'activerecord.attributes.*'
147
+ # - '{devise,kaminari,will_paginate}.*'
148
+ # - 'simple_form.{yes,no}'
149
+ # - 'simple_form.{placeholders,hints,labels}.*'
150
+ # - 'simple_form.{error_notification,required}.:'
151
+ - '{activemodel,census_authorization}.*'
152
+ - 'decidim.authorization_handlers.file_authorization_handler.*'
153
+ - 'decidim.file_authorization_handler.*'
154
+ - 'decidim.verifications.authorizations.first_login.actions.file_authorization_handler'
155
+
156
+ ## Exclude these keys from the `i18n-tasks eq-base' report:
157
+ # ignore_eq_base:
158
+ # all:
159
+ # - common.ok
160
+ # fr,es:
161
+ # - common.brand
162
+
163
+ ## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
164
+ # ignore_inconsistent_interpolations:
165
+ # - 'activerecord.attributes.*'
166
+
167
+ ## Ignore these keys completely:
168
+ # ignore:
169
+ # - kaminari.*
170
+
171
+ ## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
172
+ ## e.g. in case of a relative key defined in a helper method.
173
+ ## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
174
+ #
175
+ # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
176
+ # only: %w(*.html.haml *.html.slim),
177
+ # patterns: [['= title\b', '.page_title']] %>
178
+ #
179
+ # The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
180
+ #
181
+ # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
182
+ # patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
@@ -1,9 +1,10 @@
1
+ ---
1
2
  ca:
2
3
  activemodel:
3
4
  attributes:
4
5
  file_authorization_handler:
5
- id_document: Document d'identitat (DNI, NIF, Passaport o Targeta de Residència)
6
6
  birthdate: Data de naixement
7
+ id_document: Document d'identitat (DNI, NIF, Passaport o Targeta de Residència)
7
8
  census_authorization:
8
9
  form:
9
10
  date_select:
@@ -13,37 +14,39 @@ ca:
13
14
  decidim:
14
15
  authorization_handlers:
15
16
  file_authorization_handler:
16
- name: Cens Organització
17
17
  explanation: Autoritza el teu compte d'usuari contra el cens de la Organització
18
- type: CSV
19
18
  fields:
20
19
  birthdate: Data de naixement
20
+ name: Cens Organització
21
+ type: CSV
21
22
  file_authorization_handler:
22
- upload_info:
23
- format: "Ha de ser un fitxer generat en excel i exportat en CSV amb dues columnes:"
24
- errors:
25
- messages:
26
- not_censed: No hem pogut trobar el teu document d'identitat amb aquesta data de naixement al padró municipal. Si les dades són correctes i el problema persisteix, siusplau, posa't en contacte amb un administrador.
27
- younger_than_minimum_age: Hauries de ser major de %{age} anys
28
23
  admin:
29
- destroy:
30
- title: Esborrar totes les dades del cens
31
- confirm: Aquesta acció no es pot desfer. Estàs segur/a que voleu continuar?
32
24
  censuses:
33
25
  create:
26
+ invalid_format: Format de fitxer no vàlid. Només s'admeten fitxers CSV.
34
27
  success: S'han importat amb èxit %{count} elements (%{errors} errors)
35
28
  destroy:
36
29
  success: S'han esborrat totes les dades censals
30
+ destroy:
31
+ confirm: Aquesta acció no es pot desfer. Estàs segur/a que vols continuar?
32
+ title: Esborra totes les dades del cens
37
33
  menu:
38
34
  census: Pujar cens
39
- show:
40
- title: Dades del cens carregat
41
- data: Hi ha un total de %{count} registres carregats. La última càrrega va ser el dia %{due_date}
42
- empty: Encara no hi ha dades censals carregades. Utilitza el següent formulari per importar-lo utilitzant un fitxer CSV.
43
35
  new:
44
- title: Pujar un nou cens
45
36
  file: Arxiu excel .csv amb les dades del cens
46
37
  submit: Carrega
38
+ title: Puja un nou cens
39
+ show:
40
+ data: Hi ha un total de %{count} registres carregats. La última càrrega va ser el dia %{due_date}
41
+ empty: Encara no hi ha dades censals carregades. Utilitza el següent formulari per importar-lo utilitzant un fitxer CSV.
42
+ import_csv: Importa CSV
43
+ title: Dades del cens carregat
44
+ errors:
45
+ messages:
46
+ not_censed: No hem pogut trobar el teu document d'identitat amb aquesta data de naixement al padró municipal. Si les dades són correctes i el problema persisteix, siusplau, posa't en contacte amb un administrador.
47
+ younger_than_minimum_age: Hauries de ser major de %{age} anys
48
+ upload_info:
49
+ format: 'Ha de ser un fitxer generat en excel i exportat en CSV amb dues columnes:'
47
50
  verifications:
48
51
  authorizations:
49
52
  first_login:
@@ -1,9 +1,10 @@
1
+ ---
1
2
  en:
2
3
  activemodel:
3
4
  attributes:
4
5
  file_authorization_handler:
5
- id_document: Identification document (DNI, NIF, Password or Residence Card)
6
6
  birthdate: Date of birth
7
+ id_document: Identification document (DNI, NIF, Password or Residence Card)
7
8
  census_authorization:
8
9
  form:
9
10
  date_select:
@@ -13,37 +14,39 @@ en:
13
14
  decidim:
14
15
  authorization_handlers:
15
16
  file_authorization_handler:
16
- name: Organization's Census
17
17
  explanation: Authorize your user account against Organization's Census
18
- type: CSV
19
18
  fields:
20
19
  birthdate: Birthdate
20
+ name: Organization's Census
21
+ type: CSV
21
22
  file_authorization_handler:
22
- upload_info:
23
- format: 'Must be a file generated by excel and exported with CSV format with two columns:'
24
- errors:
25
- messages:
26
- not_censed: We could not find your document ID matching with this birthdate in our Census. If the data entered is correct and the problem persists, please, contact an administrator.
27
- younger_than_minimum_age: You should be older than %{age} years
28
23
  admin:
29
- destroy:
30
- title: Delete all census data
31
- confirm: Delete all the census can not be undone. Are you sure you want to continue?
32
24
  censuses:
33
25
  create:
26
+ invalid_format: Invalid file format. Only CSV files are accepted.
34
27
  success: Successfully imported %{count} items (%{errors} errors)
35
28
  destroy:
36
29
  success: All census data have been deleted
30
+ destroy:
31
+ confirm: Delete all the census can not be undone. Are you sure you want to continue?
32
+ title: Delete all census data
37
33
  menu:
38
34
  census: Upload census
39
- show:
40
- title: Current census data
41
- data: There are %{count} records loaded in total. Last upload date was on %{due_date}
42
- empty: There are no census data. Use the form below to import it using a CSV file.
43
35
  new:
44
- title: Upload a new census
45
36
  file: Excel .csv file with census data
46
37
  submit: Upload file
38
+ title: Upload a new census
39
+ show:
40
+ data: There are %{count} records loaded in total. Last upload date was on %{due_date}
41
+ empty: There are no census data. Use the form below to import it using a CSV file.
42
+ import_csv: Import CSV
43
+ title: Current census data
44
+ errors:
45
+ messages:
46
+ not_censed: We could not find your document ID matching with this birthdate in our Census. If the data entered is correct and the problem persists, please, contact an administrator.
47
+ younger_than_minimum_age: You should be older than %{age} years
48
+ upload_info:
49
+ format: 'Must be a file generated by excel and exported with CSV format with two columns:'
47
50
  verifications:
48
51
  authorizations:
49
52
  first_login:
@@ -1,9 +1,10 @@
1
+ ---
1
2
  es:
2
3
  activemodel:
3
4
  attributes:
4
5
  file_authorization_handler:
5
- id_document: Documento de identidad (DNI, NIF, Pasaporte o Targeta de Residencia)
6
6
  birthdate: Fecha de nacimiento
7
+ id_document: Documento de identidad (DNI, NIF, Pasaporte o Targeta de Residencia)
7
8
  census_authorization:
8
9
  form:
9
10
  date_select:
@@ -13,37 +14,39 @@ es:
13
14
  decidim:
14
15
  authorization_handlers:
15
16
  file_authorization_handler:
16
- name: Censo de la Organización
17
17
  explanation: Autoriza tu cuenta de usuario contra el Censo de la Organización
18
- type: CSV
19
18
  fields:
20
19
  birthdate: Fecha de nacimiento
20
+ name: Censo de la Organización
21
+ type: CSV
21
22
  file_authorization_handler:
22
- upload_file:
23
- format: 'Debe ser un fichero generado por excel y exportado en formato CSV con dos columnas:'
24
- errors:
25
- messages:
26
- not_censed: No hemos podido encontrar tu documento de identidad con esta fecha de nacimiento en el padrón municipal. Si tus datos son correctos y el problema persiste, por favor, ponte en contacto con un administrador
27
- younger_than_minimum_age: Deberías ser mayor de %{age} años
28
23
  admin:
29
- destroy:
30
- title: Borrar todos los datos de censo
31
- confirm: Borrar el censo no se puede deshacer. ¿Estás seguro/a que deseas continuar?
32
24
  censuses:
33
25
  create:
26
+ invalid_format: Formato de archivo no válido. Solo se admiten ficheros CSV.
34
27
  success: Se han importado con éxito %{count} elementos (%{errors} errores)
35
28
  destroy:
36
29
  success: Se han borrado todos los datos censales
30
+ destroy:
31
+ confirm: Borrar el censo no se puede deshacer. ¿Estás seguro/a que deseas continuar?
32
+ title: Borrar todos los datos de censo
37
33
  menu:
38
34
  census: Subir censo
39
- show:
40
- title: Datos de censo actuales
41
- data: Hay un total de %{count} registros cargados. La última carga fue el día %{due_date}
42
- empty: No hay datos censales. Usa el formulario a continuación para importar usando un fichero CSV.
43
35
  new:
44
- title: Subir un nuevo censo
45
36
  file: Archivo excel .csv con los datos del censo
46
37
  submit: Subir archivo
38
+ title: Subir un nuevo censo
39
+ show:
40
+ data: Hay un total de %{count} registros cargados. La última carga fue el día %{due_date}
41
+ empty: No hay datos censales. Usa el formulario a continuación para importar usando un fichero CSV.
42
+ import_csv: Importa CSV
43
+ title: Datos de censo actuales
44
+ errors:
45
+ messages:
46
+ not_censed: No hemos podido encontrar tu documento de identidad con esta fecha de nacimiento en el padrón municipal. Si tus datos son correctos y el problema persiste, por favor, ponte en contacto con un administrador
47
+ younger_than_minimum_age: Deberías ser mayor de %{age} años
48
+ upload_info:
49
+ format: 'Debe ser un fichero generado por excel y exportado en formato CSV con dos columnas:'
47
50
  verifications:
48
51
  authorizations:
49
52
  first_login:
@@ -0,0 +1,54 @@
1
+ ---
2
+ eu:
3
+ activemodel:
4
+ attributes:
5
+ file_authorization_handler:
6
+ birthdate: Jaioteguna
7
+ id_document: Nortasun-agiria (NAN, IFZ, Pasaportea edo Egoitza Txartela)
8
+ census_authorization:
9
+ form:
10
+ date_select:
11
+ day: Eguna
12
+ month: Hilabetea
13
+ year: Urtea
14
+ decidim:
15
+ authorization_handlers:
16
+ file_authorization_handler:
17
+ explanation: Zure erabiltzaile-kontua Erakundearen Erroldaren bidez baimendu
18
+ fields:
19
+ birthdate: Jaioteguna
20
+ name: Erakundearen Errolda
21
+ type: CSV
22
+ file_authorization_handler:
23
+ admin:
24
+ censuses:
25
+ create:
26
+ invalid_format: Fitxategiaren formatua ez da baliagarria. CSV fitxategiak bakarrik onartzen dira.
27
+ success: "%{count} elementu arrakastaz inportatu dira (%{errors} errore)"
28
+ destroy:
29
+ success: Erroldako datu guztiak ezabatu dira
30
+ destroy:
31
+ confirm: Errolda ezabatzea ezin da desegin. Ziur zaude jarraitu nahi duzula?
32
+ title: Erroldako datu guztiak ezabatu
33
+ menu:
34
+ census: Errolda igo
35
+ new:
36
+ file: Erroldaren datuak dituen excel .csv fitxategia
37
+ submit: Fitxategia igo
38
+ title: Errolda berria igo
39
+ show:
40
+ data: Guztira %{count} erregistro kargatuta daude. Azken karga %{due_date} egunean izan zen.
41
+ empty: Ez dago errolda-daturik. Erabili beheko inprimakia CSV fitxategi bat erabiliz inportatzeko.
42
+ import_csv: Inportatu CSV
43
+ title: Uneko errolda-datuak
44
+ errors:
45
+ messages:
46
+ not_censed: Ezin izan dugu zure nortasun-agiria eta jaioteguna udal erroldan aurkitu. Zure datuak zuzenak badira eta arazoak jarraitzen badu, jar zaitez administratzailearekin harremanetan.
47
+ younger_than_minimum_age: "%{age} urte baino gehiago izan beharko zenuke"
48
+ upload_info:
49
+ format: 'Excel bidez sortutako eta CSV formatuan esportatutako fitxategia izan behar du, bi zutaberekin:'
50
+ verifications:
51
+ authorizations:
52
+ first_login:
53
+ actions:
54
+ file_authorization_handler: Egiaztatu zure burua erakundearen erroldaren bidez
@@ -5,8 +5,17 @@ module Decidim
5
5
  class AdminEngine < ::Rails::Engine
6
6
  isolate_namespace Decidim::FileAuthorizationHandler::Admin
7
7
 
8
+ paths["db/migrate"] = nil
9
+ paths["lib/tasks"] = nil
10
+
8
11
  routes do
9
- resource :censuses, only: [:show, :create, :destroy]
12
+ resource :censuses, only: [:show, :new, :create, :destroy]
13
+ end
14
+
15
+ initializer "decidim_file_authorization_handler.admin_mount_routes" do
16
+ Decidim::Core::Engine.routes do
17
+ mount Decidim::FileAuthorizationHandler::AdminEngine, at: "/admin/file_authorization_handler", as: "decidim_file_authorization_handler_admin"
18
+ end
10
19
  end
11
20
 
12
21
  initializer "decidim_file_authorization.add_admin_menu" do
@@ -6,12 +6,6 @@ module Decidim
6
6
  class Engine < ::Rails::Engine
7
7
  isolate_namespace Decidim::FileAuthorizationHandler
8
8
 
9
- initializer "decidim_census.add_irregular_inflection" do |_app|
10
- ActiveSupport::Inflector.inflections(:en) do |inflect|
11
- inflect.irregular "census", "census"
12
- end
13
- end
14
-
15
9
  initializer "decidim_census.add_authorization_handlers" do |_app|
16
10
  Decidim::Verifications.register_workflow(:file_authorization_handler) do |workflow|
17
11
  workflow.form = "FileAuthorizationHandler"
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Decidim
4
4
  module FileAuthorizationHandler
5
- DECIDIM_VERSION = "0.28.2"
5
+ DECIDIM_VERSION = "0.31.6"
6
6
 
7
7
  # Uses the latest matching Decidim version for
8
8
  # - major, minor and patch
9
9
  # - the optional extra number is related to this module's patches
10
- VERSION = "#{DECIDIM_VERSION}.0".freeze
10
+ VERSION = "#{DECIDIM_VERSION}.2".freeze
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-file_authorization_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.28.2.0
4
+ version: 0.31.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Gómez
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-02-24 00:00:00.000000000 Z
13
+ date: 2026-08-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim
@@ -18,56 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: 0.28.2
21
+ version: 0.31.6
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.28.2
28
+ version: 0.31.6
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-admin
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 0.28.2
35
+ version: 0.31.6
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.28.2
43
- - !ruby/object:Gem::Dependency
44
- name: rails
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '5.2'
50
- type: :runtime
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '5.2'
42
+ version: 0.31.6
57
43
  - !ruby/object:Gem::Dependency
58
44
  name: decidim-dev
59
45
  requirement: !ruby/object:Gem::Requirement
60
46
  requirements:
61
47
  - - "~>"
62
48
  - !ruby/object:Gem::Version
63
- version: 0.28.2
49
+ version: 0.31.6
64
50
  type: :development
65
51
  prerelease: false
66
52
  version_requirements: !ruby/object:Gem::Requirement
67
53
  requirements:
68
54
  - - "~>"
69
55
  - !ruby/object:Gem::Version
70
- version: 0.28.2
56
+ version: 0.31.6
71
57
  description: Census uploads via csv files
72
58
  email:
73
59
  - hola@marsbased.com
@@ -88,11 +74,14 @@ files:
88
74
  - app/permissions/decidim/file_authorization_handler/admin/permissions.rb
89
75
  - app/services/file_authorization_handler.rb
90
76
  - app/views/decidim/file_authorization_handler/admin/censuses/_upload_info.html.erb
77
+ - app/views/decidim/file_authorization_handler/admin/censuses/new.html.erb
91
78
  - app/views/decidim/file_authorization_handler/admin/censuses/show.html.erb
92
79
  - app/views/layouts/file_authorization_handler/application.html.erb
80
+ - config/i18n-tasks.yml
93
81
  - config/locales/ca.yml
94
82
  - config/locales/en.yml
95
83
  - config/locales/es.yml
84
+ - config/locales/eu.yml
96
85
  - db/migrate/20171110120821_create_decidim_file_authorization_handler_census_datum.rb
97
86
  - db/migrate/20221207143742_add_extras_to_census_datum.rb
98
87
  - lib/decidim/file_authorization_handler.rb
@@ -111,16 +100,16 @@ require_paths:
111
100
  - lib
112
101
  required_ruby_version: !ruby/object:Gem::Requirement
113
102
  requirements:
114
- - - ">"
103
+ - - ">="
115
104
  - !ruby/object:Gem::Version
116
- version: '3.0'
105
+ version: 3.3.4
117
106
  required_rubygems_version: !ruby/object:Gem::Requirement
118
107
  requirements:
119
108
  - - ">="
120
109
  - !ruby/object:Gem::Version
121
110
  version: '0'
122
111
  requirements: []
123
- rubygems_version: 3.3.26
112
+ rubygems_version: 3.5.11
124
113
  signing_key:
125
114
  specification_version: 4
126
115
  summary: CSV document + birth date verifier