--- /dev/null
+<% content_for :heading_class, "pb-0" %>
+
+<% content_for :heading do %>
+ <h1><%= t("users.show.my messages") %></h1>
+ <ul class="nav nav-tabs">
+ <% { ".my_inbox" => inbox_messages_path, ".my_outbox" => outbox_messages_path }.each do |i18n_key, path| %>
+ <li class="nav-item">
+ <% if path == active_link_path %>
+ <a class="nav-link active"><%= t(i18n_key) %></a>
+ <% else %>
+ <%= link_to t(i18n_key), path, :class => "nav-link" %>
+ <% end %>
+ </li>
+ <% end %>
+ </ul>
+<% end %>
--- /dev/null
+<table class="table table-sm align-middle">
+ <thead>
+ <tr>
+ <% columns.each do |column| %>
+ <th><%= t ".#{column}" %></th>
+ <% end %>
+ <th class="d-flex justify-content-end"><%= t ".actions" %></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%= render :partial => inner_partial, :collection => messages %>
+ </tbody>
+</table>
<%= javascript_include_tag "messages" %>
<% end %>
-<% content_for :heading_class, "pb-0" %>
+<%= render :partial => "heading", :locals => { :active_link_path => inbox_messages_path } %>
-<% content_for :heading do %>
- <h1><%= t("users.show.my messages") %></h1>
- <ul class="nav nav-tabs">
- <li class="nav-item">
- <a class="nav-link active"><%= t ".my_inbox" %></a>
- </li>
- <li class="nav-item">
- <%= link_to t(".my_outbox"), outbox_messages_path, :class => "nav-link" %>
- </li>
- </ul>
-<% end %>
-
- <h4><%= render :partial => "message_count" %></h4>
+<h4><%= render :partial => "message_count" %></h4>
<% if current_user.messages.size > 0 %>
- <table class="table table-sm align-middle">
- <thead>
- <tr>
- <th><%= t ".from" %></th>
- <th><%= t ".subject" %></th>
- <th><%= t ".date" %></th>
- </tr>
- </thead>
- <tbody>
- <%= render :partial => "message_summary", :collection => current_user.messages %>
- </tbody>
- </table>
+ <%= render :partial => "messages_table", :locals => { :columns => %w[from subject date], :messages => current_user.messages, :inner_partial => "message_summary" } %>
<% else %>
<div><%= t(".no_messages_yet_html", :people_mapping_nearby_link => link_to(t(".people_mapping_nearby"), user_path(current_user))) %></div>
<% end %>
<%= javascript_include_tag "messages" %>
<% end %>
-<% content_for :heading_class, "pb-0" %>
-
-<% content_for :heading do %>
- <h1><%= t("users.show.my messages") %></h1>
-
- <ul class="nav nav-tabs">
- <li class="nav-item">
- <%= link_to t(".my_inbox"), inbox_messages_path, :class => "nav-link" %>
- </li>
- <li class="nav-item">
- <a class="nav-link active"><%= t ".my_outbox" %></a>
- </li>
- </ul>
-<% end %>
+<%= render :partial => "heading", :locals => { :active_link_path => outbox_messages_path } %>
<h4><%= t ".messages", :count => current_user.sent_messages.size %></h4>
<% if current_user.sent_messages.size > 0 %>
- <table class="table table-sm align-middle">
- <thead>
- <tr>
- <th><%= t ".to" %></th>
- <th><%= t ".subject" %></th>
- <th><%= t ".date" %></th>
- </tr>
- </thead>
- <tbody>
- <%= render :partial => "sent_message_summary", :collection => current_user.sent_messages %>
- </tbody>
- </table>
+ <%= render :partial => "messages_table", :locals => { :columns => %w[to subject date], :messages => current_user.sent_messages, :inner_partial => "sent_message_summary" } %>
<% else %>
<div class="messages"><%= t(".no_sent_messages_html", :people_mapping_nearby_link => link_to(t(".people_mapping_nearby"), user_path(current_user))) %></div>
<% end %>
<%= link_to t(".reply_button"), message_reply_path(@message), :class => "btn btn-primary" %>
<%= link_to t(".unread_button"), message_mark_path(@message, :mark => "unread"), :method => "post", :class => "btn btn-primary" %>
<%= link_to t(".destroy_button"), message_path(@message), :method => "delete", :class => "btn btn-danger" %>
- <%= link_to t(".back"), inbox_messages_path, :class => "btn btn-link" %>
<% else %>
<%= link_to t(".destroy_button"), message_path(@message), :method => "delete", :class => "btn btn-danger" %>
- <%= link_to t(".back"), outbox_messages_path, :class => "btn btn-link" %>
<% end %>
+ <%= link_to t(".back"), :back, :class => "btn btn-link" %>
</div>
old_messages:
one: "%{count} old message"
other: "%{count} old messages"
+ no_messages_yet_html: "You have no messages yet. Why not get in touch with some of the %{people_mapping_nearby_link}?"
+ people_mapping_nearby: "people mapping nearby"
+ messages_table:
from: "From"
+ to: "To"
subject: "Subject"
date: "Date"
- no_messages_yet_html: "You have no messages yet. Why not get in touch with some of the %{people_mapping_nearby_link}?"
- people_mapping_nearby: "people mapping nearby"
+ actions: "Actions"
message_summary:
unread_button: "Mark as unread"
read_button: "Mark as read"
title: "Outbox"
my_inbox: "My Inbox"
my_outbox: "My Outbox"
+ actions: "Actions"
messages:
one: "You have %{count} sent message"
other: "You have %{count} sent messages"
- to: "To"
- subject: "Subject"
- date: "Date"
no_sent_messages_html: "You have no sent messages yet. Why not get in touch with some of the %{people_mapping_nearby_link}?"
people_mapping_nearby: "people mapping nearby"
reply:
wrong_user: "You are logged in as `%{user}' but the message you have asked to read was not sent by or to that user. Please login as the correct user in order to read it."
sent_message_summary:
destroy_button: "Delete"
+ heading:
+ my_inbox: "My Inbox"
+ my_outbox: "My Outbox"
mark:
as_read: "Message marked as read"
as_unread: "Message marked as unread"