piece_justificative: style links as buttons, and improve layout

This commit is contained in:
Pierre de La Morinerie 2019-02-18 18:00:37 +01:00
parent 62ef02183c
commit ae5e8810a5
3 changed files with 35 additions and 24 deletions

View file

@ -0,0 +1,17 @@
@import "../constants";
.piece-justificative-actions {
display: flex;
}
.piece-justificative-action {
margin-right: $default-spacer;
.button {
text-transform: lowercase;
}
}
.piece-justificative-input.hidden {
display: none;
}

View file

@ -100,9 +100,9 @@
input[type=date], input[type=date],
input[type=number], input[type=number],
input[type=tel], input[type=tel],
input[type=file],
textarea, textarea,
select { select,
.piece-justificative {
display: block; display: block;
margin-bottom: 2 * $default-padding; margin-bottom: 2 * $default-padding;
@ -111,10 +111,6 @@
} }
} }
.direct-upload {
margin-bottom: 2 * $default-padding;
}
.add-row { .add-row {
margin-bottom: 2 * $default-padding; margin-bottom: 2 * $default-padding;
} }

View file

@ -1,24 +1,22 @@
- pj = champ.piece_justificative_file - pj = champ.piece_justificative_file
.piece-justificative
- if champ.type_de_champ.piece_justificative_template.attached? - if champ.type_de_champ.piece_justificative_template.attached?
%p.edit-pj-template.mb-1 %p.edit-pj-template.mb-1
Veuillez télécharger, remplir et joindre Veuillez télécharger, remplir et joindre
= link_to('le modèle suivant', url_for(champ.type_de_champ.piece_justificative_template), target: '_blank') = link_to('le modèle suivant', url_for(champ.type_de_champ.piece_justificative_template), target: '_blank')
- if !pj.attached? - if pj.attached?
= form.file_field :piece_justificative_file, .piece-justificative-actions{ id: "piece_justificative_#{champ.id}" }
id: "champs_#{champ.id}", .piece-justificative-action
direct_upload: true
- else
%div{ id: "piece_justificative_#{champ.id}" }
= render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: true } = render partial: "shared/champs/piece_justificative/pj_link", locals: { champ: champ, user_can_upload: true }
%br .piece-justificative-action
- if champ.private? - if champ.private?
= link_to 'supprimer', gestionnaire_champ_purge_champ_piece_justificative_path(procedure_id: champ.dossier.procedure_id, dossier_id: champ.dossier_id, champ_id: champ.id), remote: true, method: :delete = link_to 'Supprimer', gestionnaire_champ_purge_champ_piece_justificative_path(procedure_id: champ.dossier.procedure_id, dossier_id: champ.dossier_id, champ_id: champ.id), remote: true, method: :delete, class: 'button small danger'
- else - else
= link_to 'supprimer', champ_purge_champ_piece_justificative_path(id: champ.dossier_id, champ_id: champ.id), remote: true, method: :delete = link_to 'Supprimer', champ_purge_champ_piece_justificative_path(id: champ.dossier_id, champ_id: champ.id), remote: true, method: :delete, class: 'button small danger'
%br
Modifier :
= form.file_field :piece_justificative_file, = form.file_field :piece_justificative_file,
id: "champs_#{champ.id}", id: "champs_#{champ.id}",
class: "piece-justificative-input",
direct_upload: true direct_upload: true