[fix #2612] Admin: add missing steps to admin UI
This commit is contained in:
parent
8ca7eb1c54
commit
a197285742
6 changed files with 43 additions and 6 deletions
|
@ -58,6 +58,10 @@ h5 span {
|
|||
.progress-bar-warning {
|
||||
background-color: #E4594F;
|
||||
}
|
||||
|
||||
.missing-steps {
|
||||
color: #FFA500;
|
||||
}
|
||||
}
|
||||
|
||||
.procedure-list-element:hover {
|
||||
|
|
|
@ -190,6 +190,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
.lien-demarche {
|
||||
p.alert {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.button-navbar-action:hover {
|
||||
color: $light-blue;
|
||||
}
|
||||
|
|
|
@ -362,6 +362,20 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def missing_steps
|
||||
result = []
|
||||
|
||||
if service.nil?
|
||||
result << :service
|
||||
end
|
||||
|
||||
if gestionnaires.empty?
|
||||
result << :instructeurs
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def claim_path_ownership!(path)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
.alert.alert-info
|
||||
Cette démarche a été publiée, certains éléments ne peuvent plus être modifiés.
|
||||
|
||||
%div
|
||||
.lien-demarche
|
||||
%h3 Lien démarche
|
||||
%div{ style: 'margin-top: 30px;' }
|
||||
- if @procedure.archivee?
|
||||
|
@ -72,5 +72,15 @@
|
|||
= link_to("un service", services_path(procedure_id: @procedure))
|
||||
\.
|
||||
- else
|
||||
.alert.alert-info
|
||||
- if @procedure.missing_steps.include?(:service)
|
||||
%p.alert.alert-danger
|
||||
Vous devez renseigner les coordonnées de votre Service administratif avant de pouvoir publier votre démarche.
|
||||
= link_to 'Cliquez ici.', (current_administrateur.services.present? ? url_for(services_path(procedure_id: @procedure.id)) : url_for(new_service_path(procedure_id: @procedure.id)))
|
||||
|
||||
- if @procedure.missing_steps.include?(:instructeurs)
|
||||
%p.alert.alert-danger
|
||||
Vous devez affecter des instructeurs avant de pouvoir publier votre démarche.
|
||||
= link_to 'Cliquez ici.', admin_procedure_instructeurs_path(@procedure)
|
||||
|
||||
%p.alert.alert-info
|
||||
Cette démarche n’a pas encore de lien, et n’est donc pas accessible par le public.
|
||||
|
|
|
@ -20,11 +20,15 @@
|
|||
|
||||
%a#onglet-services{ href: current_administrateur.services.present? ? url_for(services_path(procedure_id: @procedure.id)) : url_for(new_service_path(procedure_id: @procedure.id)) }
|
||||
.procedure-list-element
|
||||
Services
|
||||
Service
|
||||
- if @procedure.missing_steps.include?(:service)
|
||||
%p.missing-steps (à compléter)
|
||||
|
||||
%a#onglet-instructeurs{ href: url_for(admin_procedure_instructeurs_path(@procedure)) }
|
||||
.procedure-list-element{ class: ('active' if active == 'Instructeurs') }
|
||||
Instructeurs
|
||||
- if @procedure.missing_steps.include?(:instructeurs)
|
||||
%p.missing-steps (à compléter)
|
||||
|
||||
- if !@procedure.locked?
|
||||
%a#onglet-champs{ href: url_for(admin_procedure_types_de_champ_path(@procedure)) }
|
||||
|
|
|
@ -343,8 +343,7 @@ describe Procedure do
|
|||
let!(:piece_justificative_1) { create(:type_de_piece_justificative, procedure: procedure, order_place: 1) }
|
||||
let(:received_mail) { create(:received_mail) }
|
||||
let(:from_library) { false }
|
||||
let!(:administrateur) { procedure.administrateur }
|
||||
let!(:gestionnaire) { create(:gestionnaire, email: administrateur.email) }
|
||||
let(:administrateur) { procedure.administrateur }
|
||||
|
||||
before do
|
||||
@logo = File.open('spec/fixtures/files/white.png')
|
||||
|
@ -362,7 +361,7 @@ describe Procedure do
|
|||
subject { @procedure }
|
||||
|
||||
it { expect(subject.parent_procedure).to eq(procedure) }
|
||||
it { expect(subject.gestionnaires).to eq([gestionnaire]) }
|
||||
it { expect(subject.gestionnaires.pluck(:email)).to eq([administrateur.email]) }
|
||||
|
||||
it 'should duplicate specific objects with different id' do
|
||||
expect(subject.id).not_to eq(procedure.id)
|
||||
|
|
Loading…
Reference in a new issue