diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/application/_navbar.html.erb | 3 | ||||
-rw-r--r-- | app/views/messages/index.html.erb | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/app/views/application/_navbar.html.erb b/app/views/application/_navbar.html.erb index c0e2761..be2d9f2 100644 --- a/app/views/application/_navbar.html.erb +++ b/app/views/application/_navbar.html.erb @@ -15,5 +15,8 @@ <li class="mr-6 inline"> <%= link_to "Bazaar", bazaar_path %> </li> + <li class="mr-6 inline"> + <%= link_to "Messages", messages_path %> + </li> <% end %> </ul> diff --git a/app/views/messages/index.html.erb b/app/views/messages/index.html.erb new file mode 100644 index 0000000..9c47439 --- /dev/null +++ b/app/views/messages/index.html.erb @@ -0,0 +1,20 @@ +<h1 class="text-3xl mb-4">Messages</h1> + +<% @messages.each do |message| %> + <div class="border-2 border-gray-500 rounded p-2 my-2"> + <div class="text-sm"><%= distance_of_time_in_words_to_now(message.created_at) %> ago</div> + <div class="italic"> + From: <strong><%= message.sender&.name || "System" %></strong> + </div> + <div class="text-lg font-bold"><%= message.subject || "No subject" %></div> + <div> + <%= message.body %> + </div> + <div class="text-sm mt-2"><%= link_to "Delete", message_path(message), method: :delete, + data: { confirm: "Are you sure you want to delete this message?" } %></div> + </div> +<% end %> + +<% if @messages.none? %> + <p class="my-2">You don't have any messages.</p> +<% end %> |