Merge branch 'dev'
This commit is contained in:
commit
d9623ed9a0
12 changed files with 135 additions and 8 deletions
|
@ -38,4 +38,11 @@
|
|||
flex-shrink: 0; // Display the button label on a single line
|
||||
}
|
||||
}
|
||||
|
||||
.warning {
|
||||
margin-bottom: 20px;
|
||||
background-color: #f9b91666;
|
||||
padding: 20px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ footer {
|
|||
.footer-columns {
|
||||
@extend %horizontal-list;
|
||||
justify-content: flex-start;
|
||||
margin: 0 -20px;
|
||||
}
|
||||
|
||||
.footer-column {
|
||||
|
@ -29,7 +30,9 @@ footer {
|
|||
font-size: 14px;
|
||||
vertical-align: top;
|
||||
flex-grow: 1;
|
||||
min-width: 320px;
|
||||
min-width: 280px;
|
||||
margin: 0 20px;
|
||||
margin-bottom: 20px;
|
||||
|
||||
@media (max-width: 1000px) {
|
||||
width: 100%;
|
||||
|
|
|
@ -7,13 +7,13 @@ module ConservationDeDonneesHelper
|
|||
|
||||
def conservation_dans_ds(procedure)
|
||||
if procedure.duree_conservation_dossiers_dans_ds.present?
|
||||
"dans demarches-simplifiees.fr #{procedure.duree_conservation_dossiers_dans_ds} mois après le début de l’instruction du dossier"
|
||||
"Dans demarches-simplifiees.fr : #{procedure.duree_conservation_dossiers_dans_ds} mois"
|
||||
end
|
||||
end
|
||||
|
||||
def conservation_hors_ds(procedure)
|
||||
if procedure.duree_conservation_dossiers_hors_ds.present?
|
||||
"hors demarches-simplifiees.fr pendant #{procedure.duree_conservation_dossiers_hors_ds} mois"
|
||||
"Par l’administration : #{procedure.duree_conservation_dossiers_hors_ds} mois"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,4 +21,29 @@ module ProcedureHelper
|
|||
action = procedure.archivee? ? :reopen : :publish
|
||||
t(action, scope: [:modal, :publish, key])
|
||||
end
|
||||
|
||||
def dossiers_deletion_warning(procedure)
|
||||
dossiers_count = procedure.dossiers.state_not_brouillon.count
|
||||
brouillons_count = procedure.dossiers.state_brouillon.count
|
||||
formatted_dossiers_count = nil
|
||||
formatted_brouillons_count = nil
|
||||
|
||||
if dossiers_count > 0
|
||||
formatted_dossiers_count = pluralize(dossiers_count, "dossier", "dossiers")
|
||||
end
|
||||
|
||||
if brouillons_count > 0
|
||||
formatted_brouillons_count = pluralize(brouillons_count, "brouillon", "brouillons")
|
||||
end
|
||||
|
||||
formatted_combination = [formatted_dossiers_count, formatted_brouillons_count]
|
||||
.compact
|
||||
.join(" et ")
|
||||
|
||||
[
|
||||
formatted_combination,
|
||||
dossiers_count + brouillons_count == 1 ? "est rattaché" : "sont rattachés",
|
||||
"à cette procédure, la suppression de cette procédure entrainera également leur suppression."
|
||||
].join(" ")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'babel-polyfill';
|
|||
|
||||
import '../shared/sentry';
|
||||
import '../shared/rails-ujs-fix';
|
||||
import '../shared/safari-11-file-xhr-workaround';
|
||||
import '../shared/autocomplete';
|
||||
|
||||
// Start Rails helpers
|
||||
|
|
|
@ -12,6 +12,7 @@ import 'babel-polyfill';
|
|||
|
||||
import '../shared/sentry';
|
||||
import '../shared/rails-ujs-fix';
|
||||
import '../shared/safari-11-file-xhr-workaround';
|
||||
import '../shared/autocomplete';
|
||||
|
||||
import '../new_design/buttons';
|
||||
|
|
26
app/javascript/shared/safari-11-file-xhr-workaround.js
Normal file
26
app/javascript/shared/safari-11-file-xhr-workaround.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
// iOS 11.3 Safari / macOS Safari 11.1 empty <input type="file"> XHR bug workaround.
|
||||
// This should work with every modern browser which supports ES5 (including IE9).
|
||||
// https://stackoverflow.com/questions/49614091/safari-11-1-ajax-xhr-form-submission-fails-when-inputtype-file-is-empty
|
||||
// https://github.com/rails/rails/issues/32440
|
||||
|
||||
document.addEventListener('ajax:before', function(e) {
|
||||
let inputs = e.target.querySelectorAll('input[type="file"]:not([disabled])');
|
||||
inputs.forEach(function(input) {
|
||||
if (input.files.length > 0) {
|
||||
return;
|
||||
}
|
||||
input.setAttribute('data-safari-temp-disabled', 'true');
|
||||
input.setAttribute('disabled', '');
|
||||
});
|
||||
});
|
||||
|
||||
// You should call this by yourself when you aborted an ajax request by stopping a event in ajax:before hook.
|
||||
document.addEventListener('ajax:beforeSend', function(e) {
|
||||
let inputs = e.target.querySelectorAll(
|
||||
'input[type="file"][data-safari-temp-disabled]'
|
||||
);
|
||||
inputs.forEach(function(input) {
|
||||
input.removeAttribute('data-safari-temp-disabled');
|
||||
input.removeAttribute('disabled');
|
||||
});
|
||||
});
|
|
@ -109,11 +109,12 @@
|
|||
.alert.alert-danger
|
||||
%p
|
||||
Attention : la suppression d’une procédure est définitive.
|
||||
|
||||
- dossiers_count = @procedure.dossiers.count
|
||||
- if dossiers_count > 0
|
||||
%p
|
||||
= pluralize(dossiers_count, "dossier est rattaché", "dossiers sont rattachés")
|
||||
à cette procédure, la suppression de cette procédure entrainera également leur suppression.
|
||||
= dossiers_deletion_warning(@procedure)
|
||||
|
||||
%p.text-right
|
||||
= link_to "J'ai compris, je supprime la procédure",
|
||||
hide_admin_procedure_path(@procedure),
|
||||
|
|
|
@ -29,6 +29,13 @@
|
|||
%p
|
||||
Horaires : #{ service.horaires.sub(/\S/, &:downcase) }
|
||||
|
||||
- politiques = politiques_conservation_de_donnees(dossier.procedure)
|
||||
- if politiques.present?
|
||||
%li.footer-column
|
||||
%h3.footer-header Conservation des données :
|
||||
- politiques.each do |politique|
|
||||
%p= politique
|
||||
|
||||
.footer-bottom-line
|
||||
= link_to "Accessibilité", accessibilite_index_path, :class => "footer-link"
|
||||
–
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
.card-title
|
||||
Pièces jointes
|
||||
|
||||
.warning
|
||||
Pour éviter toute erreur, nous vous conseillons de limiter la taille de chaque pièce jointe à 20 Mo, et de les ajouter une par une, en enregistrant votre
|
||||
= dossier.brouillon? ? "brouillon" : "dossier"
|
||||
après chaque ajout.
|
||||
|
||||
- tpjs.each do |tpj|
|
||||
.pj-input
|
||||
%label{ for: "piece_justificative_#{tpj.id}" }
|
||||
|
|
|
@ -10,21 +10,21 @@ RSpec.describe ConservationDeDonneesHelper, type: :helper do
|
|||
let(:dans_ds) { 3 }
|
||||
let(:hors_ds) { 6 }
|
||||
|
||||
it { is_expected.to eq([ "dans demarches-simplifiees.fr 3 mois après le début de l’instruction du dossier", "hors demarches-simplifiees.fr pendant 6 mois" ]) }
|
||||
it { is_expected.to eq([ "Dans demarches-simplifiees.fr : 3 mois", "Par l’administration : 6 mois" ]) }
|
||||
end
|
||||
|
||||
context "when only in-app retention time is set" do
|
||||
let(:dans_ds) { 3 }
|
||||
let(:hors_ds) { nil }
|
||||
|
||||
it { is_expected.to eq([ "dans demarches-simplifiees.fr 3 mois après le début de l’instruction du dossier" ]) }
|
||||
it { is_expected.to eq([ "Dans demarches-simplifiees.fr : 3 mois" ]) }
|
||||
end
|
||||
|
||||
context "when only out of app retention time is set" do
|
||||
let(:dans_ds) { nil }
|
||||
let(:hors_ds) { 6 }
|
||||
|
||||
it { is_expected.to eq([ "hors demarches-simplifiees.fr pendant 6 mois" ]) }
|
||||
it { is_expected.to eq([ "Par l’administration : 6 mois" ]) }
|
||||
end
|
||||
|
||||
context "when the retention time is not set" do
|
||||
|
|
51
spec/helpers/procedure_helper_spec.rb
Normal file
51
spec/helpers/procedure_helper_spec.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
RSpec.describe ProcedureHelper, type: :helper do
|
||||
let(:procedure) { create(:procedure) }
|
||||
|
||||
describe '#dossiers_deletion_warning' do
|
||||
subject { dossiers_deletion_warning(procedure) }
|
||||
|
||||
context 'with 1 submitted dossier' do
|
||||
before do
|
||||
dossier_1 = create(:dossier, :en_construction, procedure: procedure)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('1 dossier est rattaché à cette procédure, la suppression de cette procédure entrainera également leur suppression.') }
|
||||
end
|
||||
|
||||
context 'with 2 submitted dossiers' do
|
||||
before do
|
||||
dossier_1 = create(:dossier, :en_construction, procedure: procedure)
|
||||
dossier_2 = create(:dossier, :en_instruction, procedure: procedure)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('2 dossiers sont rattachés à cette procédure, la suppression de cette procédure entrainera également leur suppression.') }
|
||||
end
|
||||
|
||||
context 'with 1 brouillon dossier' do
|
||||
before do
|
||||
dossier_1 = create(:dossier, procedure: procedure)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('1 brouillon est rattaché à cette procédure, la suppression de cette procédure entrainera également leur suppression.') }
|
||||
end
|
||||
|
||||
context 'with 2 brouillons dossiers' do
|
||||
before do
|
||||
dossier_1 = create(:dossier, procedure: procedure)
|
||||
dossier_2 = create(:dossier, procedure: procedure)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('2 brouillons sont rattachés à cette procédure, la suppression de cette procédure entrainera également leur suppression.') }
|
||||
end
|
||||
|
||||
context 'with 2 submitted dossiers and 1 brouillon dossier' do
|
||||
before do
|
||||
dossier_1 = create(:dossier, :en_instruction, procedure: procedure)
|
||||
dossier_2 = create(:dossier, :en_instruction, procedure: procedure)
|
||||
dossier_3 = create(:dossier, procedure: procedure)
|
||||
end
|
||||
|
||||
it { is_expected.to eq('2 dossiers et 1 brouillon sont rattachés à cette procédure, la suppression de cette procédure entrainera également leur suppression.') }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue