diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index a1c7cf7b5..1c72fedbf 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -12,6 +12,17 @@ module AdminHelper options end + def humanize_document_type(document_type) + case document_type + when "1" + t "verification.residence.new.document_type.spanish_id" + when "2" + t "verification.residence.new.document_type.passport" + when "3" + t "verification.residence.new.document_type.residence_card" + end + end + private def namespace diff --git a/app/models/user.rb b/app/models/user.rb index 326b7a7b4..fa589b126 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -22,6 +22,7 @@ class User < ActiveRecord::Base has_many :debates, -> { with_hidden }, foreign_key: :author_id has_many :proposals, -> { with_hidden }, foreign_key: :author_id has_many :comments, -> { with_hidden } + has_many :failed_census_calls validates :username, presence: true, unless: :organization? validates :username, uniqueness: true, unless: :organization? diff --git a/app/views/admin/verifications/_failed_census_call.html.erb b/app/views/admin/verifications/_failed_census_call.html.erb new file mode 100644 index 000000000..793fdb2e4 --- /dev/null +++ b/app/views/admin/verifications/_failed_census_call.html.erb @@ -0,0 +1,6 @@ +
+ <%= humanize_document_type(failed_census_call.document_type) %> + <%= failed_census_call.document_number %> + <%= l(failed_census_call.date_of_birth) %> + <%= failed_census_call.postal_code %> +
\ No newline at end of file diff --git a/app/views/admin/verifications/index.html.erb b/app/views/admin/verifications/index.html.erb index cd2e03047..ddd31d339 100644 --- a/app/views/admin/verifications/index.html.erb +++ b/app/views/admin/verifications/index.html.erb @@ -17,6 +17,9 @@ <% @users.each do |user| %>
  • <%= link_to user.name, admin_user_path(user) %> + <% if !user.residence_verified? %> + <%= render partial: 'failed_census_call', collection: user.failed_census_calls %> + <% end %>
  • <% end %>