manager: fix Instructeur and Administrateur email

Use the email attribute on the User (rather than the deprecated email
column on Instructeur or Administrateur).

Fix #4565
This commit is contained in:
Pierre de La Morinerie 2019-11-25 13:01:22 +01:00
parent 77abd65bab
commit c2c332244e
2 changed files with 7 additions and 9 deletions

View file

@ -9,7 +9,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
# on pages throughout the dashboard. # on pages throughout the dashboard.
ATTRIBUTE_TYPES = { ATTRIBUTE_TYPES = {
id: Field::Number, id: Field::Number,
email: Field::String, user: Field::HasOne.with_options(searchable: true, searchable_field: 'email'),
created_at: Field::DateTime, created_at: Field::DateTime,
updated_at: Field::DateTime, updated_at: Field::DateTime,
procedures: Field::HasMany.with_options(limit: 20), procedures: Field::HasMany.with_options(limit: 20),
@ -24,7 +24,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
# By default, it's limited to four items to reduce clutter on index pages. # By default, it's limited to four items to reduce clutter on index pages.
# Feel free to add, remove, or rearrange items. # Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [ COLLECTION_ATTRIBUTES = [
:email, :user,
:created_at, :created_at,
:procedures, :procedures,
:registration_state :registration_state
@ -34,7 +34,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
# an array of attributes that will be displayed on the model's show page. # an array of attributes that will be displayed on the model's show page.
SHOW_PAGE_ATTRIBUTES = [ SHOW_PAGE_ATTRIBUTES = [
:id, :id,
:email, :user,
:created_at, :created_at,
:updated_at, :updated_at,
:registration_state, :registration_state,
@ -46,9 +46,7 @@ class AdministrateurDashboard < Administrate::BaseDashboard
# FORM_ATTRIBUTES # FORM_ATTRIBUTES
# an array of attributes that will be displayed # an array of attributes that will be displayed
# on the model's form (`new` and `edit`) pages. # on the model's form (`new` and `edit`) pages.
FORM_ATTRIBUTES = [ FORM_ATTRIBUTES = [].freeze
:email
].freeze
# Overwrite this method to customize how procedures are displayed # Overwrite this method to customize how procedures are displayed
# across all pages of the admin dashboard. # across all pages of the admin dashboard.

View file

@ -9,7 +9,7 @@ class InstructeurDashboard < Administrate::BaseDashboard
# on pages throughout the dashboard. # on pages throughout the dashboard.
ATTRIBUTE_TYPES = { ATTRIBUTE_TYPES = {
id: Field::Number, id: Field::Number,
email: Field::String, user: Field::HasOne.with_options(searchable: true, searchable_field: 'email'),
created_at: Field::DateTime, created_at: Field::DateTime,
updated_at: Field::DateTime, updated_at: Field::DateTime,
current_sign_in_at: Field::DateTime, current_sign_in_at: Field::DateTime,
@ -24,7 +24,7 @@ class InstructeurDashboard < Administrate::BaseDashboard
# By default, it's limited to four items to reduce clutter on index pages. # By default, it's limited to four items to reduce clutter on index pages.
# Feel free to add, remove, or rearrange items. # Feel free to add, remove, or rearrange items.
COLLECTION_ATTRIBUTES = [ COLLECTION_ATTRIBUTES = [
:email, :user,
:created_at :created_at
].freeze ].freeze
@ -34,7 +34,7 @@ class InstructeurDashboard < Administrate::BaseDashboard
:procedures, :procedures,
:dossiers, :dossiers,
:id, :id,
:email, :user,
:current_sign_in_at, :current_sign_in_at,
:created_at, :created_at,
:features :features