Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-09-12 09:30:48 +02:00
commit ff9ab0cc32
19 changed files with 100 additions and 40 deletions

View file

@ -15,7 +15,7 @@ footer {
} }
.dossier-footer { .dossier-footer {
@include vertical-padding(48px); @include vertical-padding(30px);
line-height: 24px; line-height: 24px;
} }
@ -32,11 +32,10 @@ footer {
flex-grow: 1; flex-grow: 1;
min-width: 280px; min-width: 280px;
margin: 0 20px; margin: 0 20px;
margin-bottom: 20px; margin-bottom: 30px;
@media (max-width: 1000px) { @media (max-width: 550px) {
width: 100%; width: 100%;
margin-bottom: 14px;
} }
} }
@ -98,8 +97,23 @@ footer {
} }
.footer-bottom-line { .footer-bottom-line {
margin-top: 30px;
margin-bottom: -30px;
text-align: center; text-align: center;
font-size: small; font-size: small;
@media (max-width: 550px) {
text-align: left;
}
}
.footer-row {
margin-bottom: 30px;
&:last-child {
margin-bottom: 0;
}
// In this case, the bottom margin is defined directly on each individual column
&.footer-columns {
margin-bottom: 0;
}
} }

View file

@ -5,4 +5,10 @@
list-style-type: disc; list-style-type: disc;
margin-left: 16px; margin-left: 16px;
} }
// scss-lint:disable SelectorFormat
.form .select2-container .select2-selection__rendered {
padding: 12px;
}
// scss-lint:enable
} }

View file

@ -37,9 +37,13 @@ module NewGestionnaire
@potential_recipients = procedure.gestionnaires.reject { |g| g == current_gestionnaire } @potential_recipients = procedure.gestionnaires.reject { |g| g == current_gestionnaire }
end end
def envoyer_a_instructeur def send_to_instructeurs
recipient = Gestionnaire.find(params[:recipient]) recipients = Gestionnaire.find(params[:recipients])
recipients.each do |recipient|
GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later GestionnaireMailer.send_dossier(current_gestionnaire, dossier, recipient).deliver_later
end
flash.notice = "Dossier envoyé" flash.notice = "Dossier envoyé"
redirect_to(personnes_impliquees_gestionnaire_dossier_path(procedure, dossier)) redirect_to(personnes_impliquees_gestionnaire_dossier_path(procedure, dossier))
end end

View file

@ -7,10 +7,17 @@ addEventListener('turbolinks:load', () => {
width: '100%' width: '100%'
}); });
$('select.select2-limited').select2({ $('.columns-form select.select2-limited').select2({
language: 'fr', language: 'fr',
placeholder: 'Sélectionnez des colonnes', placeholder: 'Sélectionnez des colonnes',
maximumSelectionLength: '5', maximumSelectionLength: '5',
width: '300px' width: '300px'
}); });
$('.recipients-form select.select2-limited').select2({
language: 'fr',
placeholder: 'Sélectionnez des instructeurs',
maximumSelectionLength: '30',
width: '300px'
});
}); });

View file

@ -2,4 +2,4 @@
= render partial: 'header', locals: { avis: @avis, dossier: @dossier } = render partial: 'header', locals: { avis: @avis, dossier: @dossier }
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) } = render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_gestionnaire, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_gestionnaire_avis_path(@avis) }

View file

@ -4,7 +4,11 @@
%p.tab-paragraph %p.tab-paragraph
Vous êtes le seul instructeur assigné sur cette démarche Vous êtes le seul instructeur assigné sur cette démarche
- else - else
= form_for dossier, url: envoyer_a_instructeur_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form' } do |f| = form_for dossier, url: send_to_instructeurs_gestionnaire_dossier_path(dossier.procedure, dossier), method: :post, html: { class: 'form recipients-form' } do |f|
.flex.justify-start.align-baseline .flex.justify-start.align-start
= select_tag(:recipient, options_from_collection_for_select(potential_recipients, :id, :email)) = select_tag(:recipients,
options_from_collection_for_select(potential_recipients, :id, :email),
multiple: true,
class: 'select2-limited',
placeholder: '')
= f.submit "Envoyer", class: "button large send gap-left" = f.submit "Envoyer", class: "button large send gap-left"

View file

@ -2,4 +2,4 @@
= render partial: "header", locals: { dossier: @dossier } = render partial: "header", locals: { dossier: @dossier }
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_gestionnaire.email, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) } = render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_gestionnaire, messagerie_seen_at: @messagerie_seen_at , new_commentaire: @commentaire, form_url: commentaire_gestionnaire_dossier_path(@dossier.procedure, @dossier) }

View file

@ -84,7 +84,7 @@
%ul.messages-list %ul.messages-list
- @dossier.commentaires.each do |commentaire| - @dossier.commentaires.each do |commentaire|
%li %li
= render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, user_email: current_gestionnaire.email, messagerie_seen_at: nil } = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, connected_user: current_gestionnaire, messagerie_seen_at: nil }
%script{ type: "text/javascript" } %script{ type: "text/javascript" }
window.print(); window.print();

View file

@ -81,7 +81,7 @@
%span.button.dropdown %span.button.dropdown
Personnaliser Personnaliser
.dropdown-content.fade-in-down .dropdown-content.fade-in-down
= form_tag update_displayed_fields_gestionnaire_procedure_path(@procedure), method: :patch, class: 'dropdown-form' do = form_tag update_displayed_fields_gestionnaire_procedure_path(@procedure), method: :patch, class: 'dropdown-form columns-form' do
= select_tag :values, = select_tag :values,
options_for_select(@procedure.fields_for_select, options_for_select(@procedure.fields_for_select,
selected: @displayed_fields_values), selected: @displayed_fields_values),

View file

@ -1,9 +1,8 @@
%footer.dossier-footer %footer.dossier-footer
.container .container
%ul.footer-columns
- service = dossier.procedure.service - service = dossier.procedure.service
- if service.present? - if service.present?
%ul.footer-row.footer-columns
%li.footer-column %li.footer-column
%h3.footer-header Cette démarche est gérée par : %h3.footer-header Cette démarche est gérée par :
%p %p
@ -36,7 +35,7 @@
- politiques.each do |politique| - politiques.each do |politique|
%p= politique %p= politique
.footer-bottom-line .footer-row.footer-bottom-line
= link_to "Accessibilité", accessibilite_index_path, :class => "footer-link" = link_to "Accessibilité", accessibilite_index_path, :class => "footer-link"
= link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" = link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer"

View file

@ -7,4 +7,4 @@
%p.messagerie-explanation %p.messagerie-explanation
La messagerie vous permet de contacter linstructeur en charge de votre dossier. La messagerie vous permet de contacter linstructeur en charge de votre dossier.
= render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, user_email: current_user.email, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier) } = render partial: "shared/dossiers/messagerie", locals: { dossier: @dossier, connected_user: current_user, messagerie_seen_at: nil, new_commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier) }

View file

@ -1,7 +1,7 @@
.messagerie.container .messagerie.container
%ul.messages-list %ul.messages-list
- dossier.commentaires.each do |commentaire| - dossier.commentaires.each do |commentaire|
%li.message{ class: commentaire_is_from_me_class(commentaire, user_email) } %li.message{ class: commentaire_is_from_me_class(commentaire, connected_user.email) }
= render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, user_email: user_email, messagerie_seen_at: messagerie_seen_at } = render partial: "shared/dossiers/messages/message", locals: { commentaire: commentaire, connected_user: connected_user, messagerie_seen_at: messagerie_seen_at }
= render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url } = render partial: "shared/dossiers/messages/form", locals: { commentaire: new_commentaire, form_url: form_url }

View file

@ -1,9 +1,9 @@
= render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, user_email: user_email } = render partial: 'shared/dossiers/messages/message_icon', locals: { commentaire: commentaire, connected_user: connected_user }
.width-100 .width-100
%h2 %h2
%span.mail %span.mail
= render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, user_email: user_email } = render partial: 'shared/dossiers/messages/message_issuer', locals: { commentaire: commentaire, connected_user: connected_user }
- if commentaire_is_from_guest(commentaire) - if commentaire_is_from_guest(commentaire)
%span.guest Invité %span.guest Invité
%span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) } %span.date{ class: highlight_if_unseen_class(messagerie_seen_at, commentaire.created_at) }

View file

@ -1,5 +1,5 @@
- case commentaire.email - case commentaire.email
- when user_email - when connected_user.email
= image_tag('icons/account-circle.svg', class: 'person-icon') = image_tag('icons/account-circle.svg', class: 'person-icon')
- when OLD_CONTACT_EMAIL - when OLD_CONTACT_EMAIL
- when CONTACT_EMAIL - when CONTACT_EMAIL

View file

@ -1,5 +1,5 @@
- case commentaire.email - case commentaire.email
- when user_email - when connected_user.email
Vous Vous
- when OLD_CONTACT_EMAIL - when OLD_CONTACT_EMAIL
- when CONTACT_EMAIL - when CONTACT_EMAIL

View file

@ -322,7 +322,7 @@ Rails.application.routes.draw do
post 'passer-en-instruction' => 'dossiers#passer_en_instruction' post 'passer-en-instruction' => 'dossiers#passer_en_instruction'
post 'repasser-en-construction' => 'dossiers#repasser_en_construction' post 'repasser-en-construction' => 'dossiers#repasser_en_construction'
post 'terminer' post 'terminer'
post 'envoyer-a-instructeur' => 'dossiers#envoyer_a_instructeur' post 'send-to-instructeurs' => 'dossiers#send_to_instructeurs'
scope :carte do scope :carte do
get 'position' get 'position'
end end

View file

@ -31,7 +31,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
end end
end end
describe '#envoyer_a_instructeur' do describe '#send_to_instructeurs' do
let(:recipient) { create(:gestionnaire) } let(:recipient) { create(:gestionnaire) }
let(:gestionnaires) { [gestionnaire, recipient] } let(:gestionnaires) { [gestionnaire, recipient] }
let(:mail) { double("mail") } let(:mail) { double("mail") }
@ -45,9 +45,9 @@ describe NewGestionnaire::DossiersController, type: :controller do
.and_return(mail) .and_return(mail)
post( post(
:envoyer_a_instructeur, :send_to_instructeurs,
params: { params: {
recipient: recipient, recipients: [recipient],
procedure_id: procedure.id, procedure_id: procedure.id,
dossier_id: dossier.id dossier_id: dossier.id
} }

View file

@ -134,6 +134,32 @@ feature 'The gestionnaire part' do
expect(page).to have_text(gestionnaire2.email) expect(page).to have_text(gestionnaire2.email)
end end
scenario 'A gestionnaire can send a dossier to several instructeurs', js: true do
instructeur_2 = FactoryBot.create(:gestionnaire)
instructeur_3 = FactoryBot.create(:gestionnaire)
procedure.gestionnaires << [instructeur_2, instructeur_3]
send_dossier = double()
expect(GestionnaireMailer).to receive(:send_dossier).and_return(send_dossier).twice
expect(send_dossier).to receive(:deliver_later).twice
log_in(gestionnaire.email, password)
click_on procedure.libelle
click_on dossier.user.email
click_on 'Personnes impliquées'
first('.select2-container', minimum: 1).click
find('li.select2-results__option[role="treeitem"]', text: instructeur_2.email).click
first('.select2-container', minimum: 1).click
find('li.select2-results__option[role="treeitem"]', text: instructeur_3.email).click
click_on 'Envoyer'
expect(page).to have_text("Dossier envoyé")
end
def log_in(email, password) def log_in(email, password)
visit '/' visit '/'
click_on 'Connexion' click_on 'Connexion'

View file

@ -1,7 +1,7 @@
describe 'shared/dossiers/messages/message.html.haml', type: :view do describe 'shared/dossiers/messages/message.html.haml', type: :view do
before { view.extend DossierHelper } before { view.extend DossierHelper }
subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, user_email: dossier.user.email } subject { render 'shared/dossiers/messages/message.html.haml', commentaire: commentaire, messagerie_seen_at: seen_at, connected_user: dossier.user }
let(:dossier) { create(:dossier) } let(:dossier) { create(:dossier) }
let(:commentaire) { create(:commentaire, dossier: dossier) } let(:commentaire) { create(:commentaire, dossier: dossier) }