Merge pull request #1107 from sgmap/improve-messagerie-ui
Improve messagerie readability
This commit is contained in:
commit
ae0a22408b
5 changed files with 41 additions and 3 deletions
|
@ -7,13 +7,23 @@
|
|||
max-height: 350px;
|
||||
overflow-y: scroll;
|
||||
border: 1px solid $border-grey;
|
||||
background: $light-grey;
|
||||
padding: 2 * $default-spacer;
|
||||
margin-bottom: $default-spacer;
|
||||
border-radius: 4px;
|
||||
|
||||
> li {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 2 * $default-padding;
|
||||
margin-bottom: $default-padding;
|
||||
padding: $default-padding;
|
||||
background: #FFFFFF;
|
||||
width: 80%;
|
||||
border-radius: 3px;
|
||||
|
||||
&.from-me {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
7
app/helpers/commentaire_helper.rb
Normal file
7
app/helpers/commentaire_helper.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module CommentaireHelper
|
||||
def commentaire_is_from_me_class(commentaire, email)
|
||||
if commentaire.email == email
|
||||
"from-me"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -5,7 +5,7 @@
|
|||
.messagerie.container
|
||||
%ul.messages-list
|
||||
- @dossier.commentaires.each do |commentaire|
|
||||
%li
|
||||
%li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) }
|
||||
= render partial: "new_gestionnaire/shared/commentaires/commentaire", locals: { commentaire: commentaire, messagerie_seen_at: nil }
|
||||
|
||||
= render partial: "new_gestionnaire/shared/commentaires/form", locals: { commentaire: @commentaire, form_url: commentaire_avis_path(@avis) }
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
.messagerie.container
|
||||
%ul.messages-list
|
||||
- @dossier.commentaires.each do |commentaire|
|
||||
%li
|
||||
%li{ class: commentaire_is_from_me_class(commentaire, current_gestionnaire.email) }
|
||||
= render partial: "new_gestionnaire/shared/commentaires/commentaire", locals: { commentaire: commentaire, messagerie_seen_at: @messagerie_seen_at }
|
||||
|
||||
= render partial: "new_gestionnaire/shared/commentaires/form", locals: { commentaire: @commentaire, form_url: commentaire_dossier_path(@dossier.procedure, @dossier) }
|
||||
|
|
21
spec/helpers/commentaire_helper_spec.rb
Normal file
21
spec/helpers/commentaire_helper_spec.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CommentaireHelper, type: :helper do
|
||||
describe ".commentaire_is_from_me_class" do
|
||||
let(:commentaire) { create(:commentaire, email: "michel@pref.fr") }
|
||||
|
||||
subject { commentaire_is_from_me_class(commentaire, me) }
|
||||
|
||||
context "when commentaire is from me" do
|
||||
let(:me) { "michel@pref.fr" }
|
||||
|
||||
it { is_expected.to eq("from-me") }
|
||||
end
|
||||
|
||||
context "when commentaire is not from me" do
|
||||
let(:me) { "roger@usager.fr" }
|
||||
|
||||
it { is_expected.to eq nil }
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue