-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78c54d1
commit 9149b0c
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
app/views/decidim/messaging/conversations/_conversation.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<% nickname ||= false %> | ||
<% conversation_path = nickname ? decidim.profile_conversation_path(conversation, nickname:) : decidim.conversation_path(conversation) %> | ||
|
||
<%= link_to conversation_path, id: "conversation-#{conversation.id}", class: "conversation__item" do %> | ||
<div class="conversation__item-avatar"> | ||
<% if conversation.interlocutors(current_user).count == 1 %> | ||
<%= cell "decidim/author", present(conversation.interlocutors(current_user).first), layout: :avatar, skip_profile_link: true %> | ||
<% else %> | ||
<%= icon "group-line", class: "w-4 h-4 text-gray fill-current" %> | ||
<% end %> | ||
</div> | ||
|
||
<div class="conversation__item-snippet"> | ||
<div class="conversation__item-snippet-title" data-interlocutors-list> | ||
<h2 class="h5 text-secondary"> | ||
<% if conversation.interlocutors(current_user).last.public? %> | ||
<%= conversation.interlocutors(current_user).last.name %> | ||
<% else %> | ||
<%= I18n.t("unnamed_user", scope: "decidim.privacy.private_account") %> | ||
<% end %> | ||
</h2> | ||
|
||
<% if conversation.interlocutors(current_user).count > 1 %> | ||
<div class="flex -space-x-2"> | ||
<% conversation.interlocutors(current_user).each do |interlocutor| %> | ||
<span class="rounded-full border border-white inline-block w-6 h-6"> | ||
<%= cell "decidim/author", present(interlocutor), layout: :avatar, skip_profile_link: true %> | ||
</span> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
</div> | ||
|
||
<p class="conversation__item-snippet-message"><%= truncate conversation.last_message.body, length: 150 %></p> | ||
|
||
<div class="conversation__item-snippet-time"> | ||
<%= t("decidim.user_conversations.index.time_ago", time: time_ago_in_words(Time.zone.parse(conversation.last_message.created_at.to_s))) %> | ||
</div> | ||
</div> | ||
|
||
<div class="conversation__item-unread"> | ||
<% if conversation.unread_count(current_user).positive? %> | ||
<span><%= conversation.unread_count(current_user) %></span> | ||
<% end %> | ||
</div> | ||
<% end %> |
23 changes: 23 additions & 0 deletions
23
app/views/decidim/messaging/conversations/_messages.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% messages.each do |message| %> | ||
<div class="conversation__message<%= " flex-row-reverse ml-auto" if sender_is_user?(sender) %>"> | ||
<div class="w-8 h-8 flex-none border border-white"> | ||
<%= cell "decidim/author", present(sender), layout: :avatar %> | ||
</div> | ||
|
||
<div class="conversation__message-text"> | ||
<span class="conversation__message-sender<%= " ml-auto" if sender_is_user?(sender) %>"> | ||
<%= if sender.public? | ||
sender.name | ||
else | ||
I18n.t("unnamed_user", scope: "decidim.privacy.private_account") | ||
end %> | ||
</span> | ||
<div> | ||
<%= simple_format(message.body_with_links) %> | ||
</div> | ||
<span class="conversation__message-time" title="<%= messages.last.created_at.strftime("%d-%m-%Y %H:%M:%S%z") %>"> | ||
<%= messages.last.friendly_created_at %> | ||
</span> | ||
</div> | ||
</div> | ||
<% end %> |