Merge branch 'dev' into 4537-Description-des-entrées-du-env.example

This commit is contained in:
Keirua 2019-11-20 16:07:12 +01:00 committed by GitHub
commit c2035ba797
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 94 additions and 83 deletions

View file

@ -130,6 +130,10 @@
}
}
.state-button {
display: inline-block;
}
.dropdown {
display: inline-block;
position: relative;
@ -213,10 +217,13 @@
}
}
&.selected,
&:hover:not(.inactive) {
background: $light-grey;
&:not(.inactive) {
cursor: pointer;
&:hover,
&.selected {
background: $light-grey;
}
}
&.danger {

View file

@ -150,6 +150,8 @@ $header-mobile-breakpoint: 550px;
}
button {
@extend %outline;
padding: 9px;
border: none;
background: none;

View file

@ -143,18 +143,19 @@ module Users
errors = update_dossier_and_compute_errors
if errors.present?
flash.now.alert = errors
render :brouillon
else
if save_draft?
flash.now.notice = 'Votre brouillon a bien été sauvegardé.'
render :brouillon
else
if passage_en_construction? && errors.blank?
@dossier.en_construction!
NotificationMailer.send_initiated_notification(@dossier).deliver_later
redirect_to merci_dossier_path(@dossier)
return redirect_to(merci_dossier_path(@dossier))
elsif errors.present?
flash.now.alert = errors
else
flash.now.notice = 'Votre brouillon a bien été sauvegardé.'
end
respond_to do |format|
format.html { render :brouillon }
format.json { head :ok }
end
end
@ -368,7 +369,7 @@ module Users
end
def save_draft?
dossier.brouillon? && params[:save_draft]
dossier.brouillon? && !params[:submit_draft]
end
end
end

View file

@ -1,5 +1,5 @@
%span.dropdown.print-menu-opener
%button.button.dropdown-button.icon-only
%button.button.dropdown-button.icon-only{ title: 'imprimer' }
%span.icon.printer
%ul.print-menu.dropdown-content
%li
@ -20,5 +20,5 @@
= render partial: "instructeurs/procedures/dossier_actions", locals: { procedure: dossier.procedure, dossier: dossier, dossier_is_followed: current_instructeur&.follow?(dossier) }
%span.state-button
.state-button
= render partial: "state_button", locals: { dossier: dossier }

View file

@ -1,4 +1,4 @@
%span.dropdown
.dropdown
-# Dropdown button title
%button.button.primary.dropdown-button{ class: button_or_label_class(dossier) }
= dossier_display_state dossier

View file

@ -1,4 +1,4 @@
%span.dropdown.invite-user-action
.dropdown.invite-user-action
%button.button.dropdown-button
%span.icon.person
- if dossier.invites.count > 0

View file

@ -1,4 +1,4 @@
%span.dropdown.header-menu-opener
.dropdown.header-menu-opener
%button.button.dropdown-button.header-menu-button
= image_tag "icons/account-circle.svg", title: "Mon compte"
%ul.header-menu.dropdown-content
@ -8,30 +8,30 @@
- if administration_signed_in?
%li
= link_to manager_root_path, class: "menu-item menu-link" do
= image_tag "icons/super-admin.svg"
= image_tag "icons/super-admin.svg", alt: ''
Passer en super-admin
- if multiple_devise_profile_connect?
- if user_signed_in? && nav_bar_profile != :user
%li
= link_to dossiers_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
= image_tag "icons/switch-profile.svg", alt: ''
Passer en usager
- if instructeur_signed_in? && nav_bar_profile != :instructeur
%li
= link_to instructeur_procedures_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
= image_tag "icons/switch-profile.svg", alt: ''
Passer en instructeur
- if administrateur_signed_in? && nav_bar_profile != :administrateur
%li
= link_to admin_procedures_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
= image_tag "icons/switch-profile.svg", alt: ''
Passer en administrateur
%li
= link_to profil_path, class: "menu-item menu-link" do
= image_tag "icons/switch-profile.svg"
= image_tag "icons/switch-profile.svg", alt: ''
Voir mon profil
%li
= link_to destroy_user_session_path, method: :delete, class: "menu-item menu-link" do
= image_tag "icons/sign-out.svg"
= image_tag "icons/sign-out.svg", alt: ''
Se déconnecter

View file

@ -38,7 +38,7 @@
= form_tag instructeur_recherche_path, method: :get, class: "form" do
= text_field_tag "q", "#{@search_terms if @search_terms.present?}", placeholder: "Rechercher un dossier"
%button{ title: "Rechercher" }
= image_tag "icons/search-blue.svg"
= image_tag "icons/search-blue.svg", alt: ''
- if nav_bar_profile == :user && user_signed_in? && current_user.dossiers.count > 2
%li
@ -46,7 +46,7 @@
= form_tag recherche_dossiers_path, method: :post, class: "form" do
= text_field_tag :dossier_id, "", placeholder: "Numéro de dossier"
%button{ title: "Rechercher" }
= image_tag "icons/search-blue.svg"
= image_tag "icons/search-blue.svg", alt: ''
- if instructeur_signed_in? || user_signed_in?
%li
@ -60,7 +60,6 @@
= link_to "Connexion", new_user_session_path, class: "button secondary"
%li
.header-help
- if dossier.present? && nav_bar_profile == :user
= render partial: 'shared/help/help_dropdown_dossier', locals: { dossier: dossier }

View file

@ -16,7 +16,7 @@
%th.libelle{ class: repetition ? 'padded' : '' }
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
%div{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
- case c.type_champ
- when TypeDeChamp.type_champs.fetch(:carte)
= render partial: "shared/champs/carte/show", locals: { champ: c }

View file

@ -2,13 +2,13 @@
= render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier }
- if apercu
- form_options = { url: '', method: :get, html: { class: 'form', multipart: true } }
- form_options = { url: '', method: :get }
- elsif dossier.brouillon?
- form_options = { url: brouillon_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
- form_options = { url: brouillon_dossier_url(dossier), method: :patch }
- else
- form_options = { url: modifier_dossier_url(dossier), method: :patch, html: { class: 'form', multipart: true } }
- form_options = { url: modifier_dossier_url(dossier), method: :patch }
= form_for dossier, form_options do |f|
= form_for dossier, form_options.merge({ html: { id: 'dossier-edit-form', class: 'form', multipart: true } }) do |f|
.prologue
%p.mandatory-explanation
@ -43,13 +43,14 @@
- if dossier.brouillon?
= f.button 'Enregistrer le brouillon',
formnovalidate: true,
name: :save_draft,
value: true,
class: 'button send secondary',
data: { 'disable-with': "Envoi en cours…" }
- if dossier.can_transition_to_en_construction?
= f.button 'Déposer le dossier',
name: :submit_draft,
value: true,
class: 'button send primary',
disabled: !current_user.owns?(dossier),
data: { 'disable-with': "Envoi en cours…" }

View file

@ -7,7 +7,7 @@
%div
= f.file_field :piece_jointe, id: 'piece_jointe', direct_upload: true
%label{ for: :piece_jointe }
.notice
%span.notice
(taille max : 20 Mo)
%div

View file

@ -1,7 +1,7 @@
- if commentaire.sent_by_system?
= image_tag('icons/mail.svg', class: 'person-icon')
= image_tag('icons/mail.svg', class: 'person-icon', alt: '')
- elsif commentaire.sent_by?(connected_user)
= image_tag('icons/account-circle.svg', class: 'person-icon')
= image_tag('icons/account-circle.svg', class: 'person-icon', alt: '')
- else
= image_tag('icons/blue-person.svg', class: 'person-icon')
= image_tag('icons/blue-person.svg', class: 'person-icon', alt: '')

View file

@ -1,5 +1,5 @@
.dropdown.help-dropdown
.button.primary.dropdown-button Aide
%button.button.primary.dropdown-button Aide
.dropdown-content.fade-in-down
%ul.dropdown-items
- title = dossier.brouillon? ? "Besoin daide pour remplir votre dossier ?" : "Une question sur votre dossier ?"

View file

@ -1,5 +1,5 @@
.dropdown.help-dropdown
.button.primary.dropdown-button Aide
%button.button.primary.dropdown-button Aide
.dropdown-content.fade-in-down
%ul.dropdown-items
= render partial: 'shared/help/dropdown_items/faq_item'

View file

@ -4,7 +4,7 @@
- has_actions = has_delete_action || has_new_dossier_action
- if has_actions
%span.dropdown.user-dossier-actions
.dropdown.user-dossier-actions
%button.button.dropdown-button
Actions
.dropdown-content.fade-in-down

View file

@ -3,8 +3,9 @@
- content_for :footer do
= render partial: "users/procedure_footer", locals: { procedure: @dossier.procedure, dossier: @dossier }
.dossier-header.sub-header
#dossier-draft
.dossier-header.sub-header
.container
= render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false }
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false }

View file

@ -13,7 +13,7 @@
.auth-options
%div
= f.check_box :remember_me, as: :boolean
= f.check_box :remember_me
= f.label :remember_me, "Se souvenir de moi", class: 'remember-me'
.text-right

View file

@ -100,38 +100,38 @@ describe Users::DossiersController, type: :controller do
let(:user) { create(:user) }
let(:asked_dossier) { create(:dossier) }
let(:ensure_authorized) { :forbid_invite_submission! }
let(:draft) { false }
let(:submit) { true }
before do
@controller.params = @controller.params.merge(dossier_id: asked_dossier.id, save_draft: draft)
@controller.params = @controller.params.merge(dossier_id: asked_dossier.id, submit_draft: submit)
allow(@controller).to receive(:current_user).and_return(user)
allow(@controller).to receive(:redirect_to)
end
context 'when a user save their own draft' do
let(:asked_dossier) { create(:dossier, user: user) }
let(:draft) { true }
let(:submit) { false }
it_behaves_like 'does not redirect nor flash'
end
context 'when a user submit their own dossier' do
let(:asked_dossier) { create(:dossier, user: user) }
let(:draft) { false }
let(:submit) { true }
it_behaves_like 'does not redirect nor flash'
end
context 'when an invite save the draft for a dossier where they where invited' do
before { create(:invite, dossier: asked_dossier, user: user) }
let(:draft) { true }
let(:submit) { false }
it_behaves_like 'does not redirect nor flash'
end
context 'when an invite submit a dossier where they where invited' do
before { create(:invite, dossier: asked_dossier, user: user) }
let(:draft) { false }
let(:submit) { true }
it_behaves_like 'redirects and flashes'
end
@ -394,7 +394,7 @@ describe Users::DossiersController, type: :controller do
}
}
end
let(:payload) { submit_payload }
let(:payload) { submit_payload.merge(submit_draft: true) }
subject do
Timecop.freeze(now) do
@ -480,7 +480,7 @@ describe Users::DossiersController, type: :controller do
it { expect(flash.alert).to eq(['Le champ l doit être rempli.']) }
context 'and the user saves a draft' do
let(:payload) { submit_payload.merge(save_draft: true) }
let(:payload) { submit_payload.except(:submit_draft) }
it { expect(response).to render_template(:brouillon) }
it { expect(flash.notice).to eq('Votre brouillon a bien été sauvegardé.') }
@ -510,7 +510,7 @@ describe Users::DossiersController, type: :controller do
let!(:invite) { create(:invite, dossier: dossier, user: user) }
context 'and the invite saves a draft' do
let(:payload) { submit_payload.merge(save_draft: true) }
let(:payload) { submit_payload.except(:submit_draft) }
before do
first_champ.type_de_champ.update(mandatory: true, libelle: 'l')