Remove non-existant columns from manager dashboards
This commit is contained in:
parent
953ebfe45a
commit
c763679b54
7 changed files with 48 additions and 12 deletions
|
@ -14,7 +14,6 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
updated_at: Field::DateTime,
|
updated_at: Field::DateTime,
|
||||||
procedures: Field::HasMany.with_options(limit: 20),
|
procedures: Field::HasMany.with_options(limit: 20),
|
||||||
registration_state: Field::String.with_options(searchable: false),
|
registration_state: Field::String.with_options(searchable: false),
|
||||||
current_sign_in_at: Field::DateTime,
|
|
||||||
features: FeaturesField,
|
features: FeaturesField,
|
||||||
email: Field::Email.with_options(searchable: false)
|
email: Field::Email.with_options(searchable: false)
|
||||||
}.freeze
|
}.freeze
|
||||||
|
@ -39,7 +38,6 @@ class AdministrateurDashboard < Administrate::BaseDashboard
|
||||||
:created_at,
|
:created_at,
|
||||||
:updated_at,
|
:updated_at,
|
||||||
:registration_state,
|
:registration_state,
|
||||||
:current_sign_in_at,
|
|
||||||
:features,
|
:features,
|
||||||
:procedures
|
:procedures
|
||||||
].freeze
|
].freeze
|
||||||
|
|
|
@ -12,7 +12,6 @@ class InstructeurDashboard < Administrate::BaseDashboard
|
||||||
user: Field::HasOne.with_options(searchable: true, searchable_field: 'email'),
|
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,
|
|
||||||
dossiers: Field::HasMany,
|
dossiers: Field::HasMany,
|
||||||
procedures: Field::HasMany,
|
procedures: Field::HasMany,
|
||||||
features: FeaturesField
|
features: FeaturesField
|
||||||
|
@ -35,7 +34,6 @@ class InstructeurDashboard < Administrate::BaseDashboard
|
||||||
:dossiers,
|
:dossiers,
|
||||||
:id,
|
:id,
|
||||||
:user,
|
:user,
|
||||||
:current_sign_in_at,
|
|
||||||
:created_at,
|
:created_at,
|
||||||
:features
|
:features
|
||||||
].freeze
|
].freeze
|
||||||
|
|
|
@ -92,4 +92,8 @@ class Administrateur < ApplicationRecord
|
||||||
|
|
||||||
destroy
|
destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# required to display feature flags field in manager
|
||||||
|
def features
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -191,6 +191,10 @@ class Instructeur < ApplicationRecord
|
||||||
user.administrateur.nil? && procedures.all? { |p| p.defaut_groupe_instructeur.instructeurs.count > 1 }
|
user.administrateur.nil? && procedures.all? { |p| p.defaut_groupe_instructeur.instructeurs.count > 1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# required to display feature flags field in manager
|
||||||
|
def features
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
def annotations_hash(demande, annotations_privees, avis, messagerie)
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
describe Manager::AdministrateursController, type: :controller do
|
describe Manager::AdministrateursController, type: :controller do
|
||||||
let(:administration) { create(:administration) }
|
let(:administration) { create(:administration) }
|
||||||
|
let(:administrateur) { create(:administrateur) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
sign_in administration
|
sign_in administration
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#show' do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
before do
|
||||||
|
get :show, params: { id: administrateur.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response.body).to include(administrateur.email) }
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET #new' do
|
describe 'GET #new' do
|
||||||
render_views
|
render_views
|
||||||
it 'displays form to create a new admin' do
|
it 'displays form to create a new admin' do
|
||||||
|
@ -41,23 +52,20 @@ describe Manager::AdministrateursController, type: :controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#delete' do
|
describe '#delete' do
|
||||||
let!(:admin) { create(:administrateur) }
|
subject { delete :delete, params: { id: administrateur.id } }
|
||||||
|
|
||||||
subject { delete :delete, params: { id: admin.id } }
|
|
||||||
|
|
||||||
it 'deletes the admin' do
|
it 'deletes the admin' do
|
||||||
subject
|
subject
|
||||||
|
|
||||||
expect(Administrateur.find_by(id: admin.id)).to be_nil
|
expect(Administrateur.find_by(id: administrateur.id)).to be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
render_views
|
render_views
|
||||||
let(:admin) { create(:administrateur) }
|
|
||||||
|
|
||||||
it 'searches admin by email' do
|
it 'searches admin by email' do
|
||||||
get :index, params: { search: admin.email }
|
get :index, params: { search: administrateur.email }
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
describe Manager::InstructeursController, type: :controller do
|
describe Manager::InstructeursController, type: :controller do
|
||||||
let(:administration) { create(:administration) }
|
let(:administration) { create(:administration) }
|
||||||
|
let(:instructeur) { create(:instructeur) }
|
||||||
|
|
||||||
|
describe '#show' do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(administration)
|
||||||
|
get :show, params: { id: instructeur.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response.body).to include(instructeur.email) }
|
||||||
|
end
|
||||||
|
|
||||||
describe '#delete' do
|
describe '#delete' do
|
||||||
let!(:instructeur) { create(:instructeur) }
|
|
||||||
|
|
||||||
before { sign_in administration }
|
before { sign_in administration }
|
||||||
|
|
||||||
subject { delete :delete, params: { id: instructeur.id } }
|
subject { delete :delete, params: { id: instructeur.id } }
|
||||||
|
|
|
@ -1,6 +1,20 @@
|
||||||
describe Manager::UsersController, type: :controller do
|
describe Manager::UsersController, type: :controller do
|
||||||
let(:administration) { create(:administration) }
|
let(:administration) { create(:administration) }
|
||||||
|
|
||||||
|
describe '#show' do
|
||||||
|
render_views
|
||||||
|
|
||||||
|
let(:administration) { create(:administration) }
|
||||||
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
sign_in(administration)
|
||||||
|
get :show, params: { id: user.id }
|
||||||
|
end
|
||||||
|
|
||||||
|
it { expect(response.body).to include(user.email) }
|
||||||
|
end
|
||||||
|
|
||||||
describe '#update' do
|
describe '#update' do
|
||||||
let!(:user) { create(:user, email: 'ancien.email@domaine.fr') }
|
let!(:user) { create(:user, email: 'ancien.email@domaine.fr') }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue