Skip to content

Commit 366849a

Browse files
committed
Improve display of conversation list
1 parent 6658695 commit 366849a

File tree

5 files changed

+26
-19
lines changed

5 files changed

+26
-19
lines changed

app/views/better_together/conversations/_conversation.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<li id="<%= dom_id(conversation) %>" class="<%= dom_class(conversation) %> list-group-item rounded-0 <%= 'active' if conversation == @conversation %>">
66
<%= link_to conversation_path(conversation), class: "stretched-link text-decoration-none d-flex justify-content-between" do %>
7-
<div class="mb-1 conversation-participants justify-content-between">
7+
<div class="mb-1 conversation-participants d-flex flex-wrap justify-content-start">
88
<%= render partial: 'better_together/people/mention', collection: conversation.participants, as: :person %>
99
</div>
1010

app/views/better_together/conversations/_conversation_with_last_message.html.erb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
<%# locals: (conversation:, last_message: conversation.messages.last) %>
44

5-
<li id="<%= dom_id(conversation) %>" class="<%= dom_class(conversation) %> list-group-item <%= 'active' if conversation == @conversation %>">
6-
<%= link_to conversation_path(conversation), class: "stretched-link text-decoration-none d-flex justify-content-between" do %>
7-
<div class="mb-1 conversation-participants justify-content-between">
8-
<%= render partial: 'better_together/people/mention', collection: conversation.participants.where.not(id: current_person.id), as: :person %>
9-
</div>
10-
11-
<strong><%= conversation.title %></strong>
5+
<li id="<%= dom_id(conversation) %>" class="<%= dom_class(conversation) %> position-relative py-3 d-flex flex-column row-gap-2 list-group-item list-group-action <%= 'active' if conversation == @conversation %>">
6+
<div class="flex-row">
7+
<%= link_to conversation_path(conversation), class: "me-4 align-self-end text-decoration-none stretched-link d-flex flex-column text-center" do %>
8+
<strong><%= conversation.title %></strong>
129

13-
<div class="last-message">
14-
<%= render(partial: 'better_together/messages/message_simple', locals: { message: last_message }) || render(partial: 'better_together/conversations/empty') %>
10+
<small class="text-muted"><%= l(conversation.updated_at, format: :short) %></small>
11+
<% end %>
12+
<div class="conversation-participants d-flex align-items-top justify-content-evenly overflow-auto">
13+
<%= render partial: 'better_together/people/mention', collection: conversation.participants, as: :person, locals: { flex_layout: 'flex-column', flex_align_items: 'center' } %>
1514
</div>
16-
<% end %>
15+
</div>
16+
17+
<div class="last-message bg-info-subtle p-2 rounded-2">
18+
<%= last_message ? render(partial: 'better_together/messages/message_simple', locals: { message: last_message }) : render(partial: 'better_together/conversations/empty') %>
19+
</div>
1720
</li>

app/views/better_together/conversations/_sidebar.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<% end %>
99
</div>
1010
<ul id="conversations_list" class="list-group list-group-flush flex-row flex-md-column">
11-
<%= render @conversations %> <!-- This renders each conversation using the _conversation.html.erb partial -->
11+
<%= render(partial: 'better_together/conversations/conversation_with_last_message', collection: @conversations, as: :conversation) || render(partial: 'better_together/conversations/empty') %>
1212
</ul>
1313
</div>

app/views/better_together/messages/_message_simple.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<%# locals: (message:, me: message.sender == current_person) %>
44

5-
<div class="<%= dom_class(message, :simple) %> message-container my-3 d-flex justify-content-between">
6-
<div class="message-header d-flex">
5+
<div class="<%= dom_class(message, :simple) %> message-container my-3 d-flex flex-column justify-content-between">
6+
<div class="message-header d-flex col-gap-2 justify-content-between">
77
<strong class="me-2"><%= message.sender.name %></strong>
88
<small class="text-muted"><%= l(message.created_at, format: :short) %></small>
99
</div>
Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11

22
<%# locals: (person:, flex_layout: 'flex-row', flex_align_items: 'left')%>
33

4-
<div class="position-relative mention me-4 d-flex justify-content-between <%= flex_layout %> <%= "align-items-#{flex_align_items}" %> <%= dom_class(person, :mention) %> <%= 'me' if person == current_person %>" id="<%= dom_id(person, :mention) %>">
4+
<div class="position-relative mention py-2 me-2 d-flex justify-content-center row-gap-1 <%= flex_layout %> <%= "align-items-#{flex_align_items}" %> <%= dom_class(person, :mention) %> <%= 'me' if person == current_person %>" id="<%= dom_id(person, :mention) %>">
55
<%# Display avatar and name inline %>
6-
<%= profile_image_tag(person, class: 'mention', size: 50) %>
7-
<a class="text-decoration-none identity-name stretched-link" href="<% policy(person).show? ? person_path(person) : '#' %>">
8-
<%= person.name %>
9-
</a>
6+
<div class="h-50">
7+
<%= profile_image_tag(person, class: 'mention', size: 50) %>
8+
</div>
9+
<div class="h-50 align-self-top">
10+
<a class="text-decoration-none identity-name stretched-link" href="<%= policy(person).show? ? person_path(person) : 'test' %>">
11+
<%= person.name %>
12+
</a>
13+
</div>
1014
</div>

0 commit comments

Comments
 (0)