Merge pull request #717 from sgmap/improve_messagerie
Improve messagerie
This commit is contained in:
commit
1965fba900
7 changed files with 34 additions and 2 deletions
1
app/assets/images/icons/attachment.svg
Normal file
1
app/assets/images/icons/attachment.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><title>Shape</title><path d="M18.34 7.287L7.038 17.73a3.358 3.358 0 0 1-2.292.877c-.867 0-1.68-.312-2.291-.877a2.867 2.867 0 0 1-.948-2.118c0-.801.337-1.554.948-2.119L14.94 1.954c.785-.725 2.159-.724 2.944 0 .812.751.812 1.972 0 2.722L6.675 15.036c-.33.306-.912.307-1.243 0a.779.779 0 0 1-.258-.574c0-.217.092-.422.258-.575l8.08-7.468a.669.669 0 0 0 .221-.492.67.67 0 0 0-.221-.494.816.816 0 0 0-1.065.001l-8.08 7.469c-.451.416-.699.969-.699 1.559s.248 1.143.698 1.56c.9.83 2.473.832 3.375 0L18.95 5.66C19.627 5.035 20 4.202 20 3.315c0-.886-.373-1.72-1.05-2.345A3.718 3.718 0 0 0 16.412 0c-.959 0-1.86.344-2.538.97L1.389 12.51C.493 13.336 0 14.44 0 15.612c0 1.173.493 2.276 1.39 3.103C2.283 19.544 3.475 20 4.745 20s2.463-.456 3.359-1.284l11.3-10.444a.667.667 0 0 0 .222-.492c0-.187-.08-.361-.222-.493a.818.818 0 0 0-1.065 0z" fill-rule="nonzero" fill="#4393F3"/></svg>
|
After Width: | Height: | Size: 952 B |
8
app/assets/javascripts/new_design/messagerie.js
Normal file
8
app/assets/javascripts/new_design/messagerie.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
TPS.scrollMessagerie = function () {
|
||||||
|
var $ul = $(".messagerie ul").first();
|
||||||
|
if($ul.length) {
|
||||||
|
$ul.scrollTop($ul.prop('scrollHeight'));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener("turbolinks:load", TPS.scrollMessagerie);
|
|
@ -48,4 +48,8 @@ i {
|
||||||
&.bubble {
|
&.bubble {
|
||||||
background-image: image-url("icons/bubble.svg");
|
background-image: image-url("icons/bubble.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.attachment {
|
||||||
|
background-image: image-url("icons/attachment.svg");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,14 @@
|
||||||
@import "constants";
|
@import "constants";
|
||||||
|
|
||||||
.messagerie {
|
.messagerie {
|
||||||
|
ul {
|
||||||
|
max-height: 350px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
border: 1px solid $border-grey;
|
||||||
|
padding: 2 * $default-spacer;
|
||||||
|
margin-bottom: $default-spacer;
|
||||||
|
}
|
||||||
|
|
||||||
li {
|
li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
@ -30,4 +38,8 @@
|
||||||
.date {
|
.date {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attachment-link {
|
||||||
|
margin-top: $default-spacer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ module NewGestionnaire
|
||||||
|
|
||||||
def create_commentaire
|
def create_commentaire
|
||||||
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
|
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
|
||||||
|
flash.notice = "Message envoyé"
|
||||||
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
|
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,15 @@
|
||||||
= render partial: 'commentaire_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire }
|
= render partial: 'commentaire_issuer', locals: { commentaire: commentaire, current_gestionnaire: current_gestionnaire }
|
||||||
- if ![current_gestionnaire.email, @dossier.user.email, 'contact@tps.apientreprise.fr'].include?(commentaire.email)
|
- if ![current_gestionnaire.email, @dossier.user.email, 'contact@tps.apientreprise.fr'].include?(commentaire.email)
|
||||||
%span.guest Invité
|
%span.guest Invité
|
||||||
%span.date= I18n.l(commentaire.created_at.localtime, format: '%d/%m/%y')
|
%span.date= I18n.l(commentaire.created_at.localtime, format: '%H:%M le %d/%m/%Y')
|
||||||
%p= sanitize(commentaire.body)
|
%p= sanitize(commentaire.body)
|
||||||
|
- if file = commentaire.piece_justificative
|
||||||
|
.attachment-link
|
||||||
|
= link_to file.content_url, class: "button", target: "_blank", title: "Télécharger" do
|
||||||
|
%i.attachment
|
||||||
|
= file.original_filename
|
||||||
|
|
||||||
= form_for(Commentaire.new, url: commentaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' }) do |f|
|
= form_for(Commentaire.new, url: commentaire_dossier_path(@dossier.procedure, @dossier), html: { class: 'form' }) do |f|
|
||||||
= f.text_area :body, rows: 5, placeholder: 'Répondre ici', required: true
|
= f.text_area :body, rows: 5, placeholder: 'Répondre ici', required: true
|
||||||
.send-wrapper
|
.send-wrapper
|
||||||
= f.submit 'Envoyer', class: 'button send'
|
= f.submit 'Envoyer', class: 'button send', data: { disable_with: "Envoi..." }
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
%i.edit
|
%i.edit
|
||||||
%i.in-progress
|
%i.in-progress
|
||||||
%i.bubble
|
%i.bubble
|
||||||
|
%i.attachment
|
||||||
|
|
||||||
%h1 Formulaires
|
%h1 Formulaires
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue