|
| 1 | +<h1 class="text-2xl mb-6">Messages</h1> |
| 2 | + |
| 3 | +<div class="flow-root"> |
| 4 | + <ul role="list" class="-mb-8"> |
| 5 | + <% @messages.each_with_index do |message, i| %> |
| 6 | + <li> |
| 7 | + <div class="relative pb-8"> |
| 8 | + <% if i < @messages.length - 1 %> |
| 9 | + <span class="absolute top-5 left-5 -ml-px h-full w-0.5 bg-gray-200" aria-hidden="true"></span> |
| 10 | + <% end %> |
| 11 | + |
| 12 | + <div class="relative flex items-start space-x-3"> |
| 13 | + <div class="relative"> |
| 14 | + <img class="h-10 w-10 rounded-full bg-gray-400 flex items-center justify-center ring-8 ring-white" src="https://images.unsplash.com/photo-1520785643438-5bf77931f493?ixlib=rb-=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=8&w=256&h=256&q=80" alt=""> |
| 15 | + |
| 16 | + <span class="absolute -bottom-0.5 -right-1 bg-white rounded-tl px-0.5 py-px"> |
| 17 | + <!-- Heroicon name: solid/chat-alt --> |
| 18 | + <svg class="h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"> |
| 19 | + <path fill-rule="evenodd" d="M18 5v8a2 2 0 01-2 2h-5l-5 4v-4H4a2 2 0 01-2-2V5a2 2 0 012-2h12a2 2 0 012 2zM7 8H5v2h2V8zm2 0h2v2H9V8zm6 0h-2v2h2V8z" clip-rule="evenodd" /> |
| 20 | + </svg> |
| 21 | + </span> |
| 22 | + </div> |
| 23 | + <div class="min-w-0 flex-1"> |
| 24 | + <div> |
| 25 | + <div class="text-sm"> |
| 26 | + <a href="#" class="font-medium text-gray-900"><%= message.from_user.email %></a> |
| 27 | + </div> |
| 28 | + <p class="mt-0.5 text-sm text-gray-500">Sent <%= time_ago_in_words(message.created_at) %> ago</p> |
| 29 | + </div> |
| 30 | + <div class="mt-2 text-sm text-gray-700"> |
| 31 | + <p><%= message.content %></p> |
| 32 | + </div> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | + </div> |
| 36 | + </li> |
| 37 | + <% end %> |
| 38 | + </ul> |
| 39 | +</div> |
| 40 | + |
| 41 | +<form action="/messages" method="post" class="mt-6"> |
| 42 | + <input type="hidden" name="authenticity_token" value="<%= form_authenticity_token %>"> |
| 43 | + <input type="hidden" name="message[reservation_id]" value="<%= @reservation.id %>"> |
| 44 | + <div> |
| 45 | + <label for="comment" class="block text-sm font-medium text-gray-700">Add your message</label> |
| 46 | + <div class="mt-1"> |
| 47 | + <textarea rows="4" name="message[content]" id="comment" class="shadow-sm focus:ring-indigo-500 focus:border-indigo-500 block w-full sm:text-sm border-gray-300 rounded-md"></textarea> |
| 48 | + </div> |
| 49 | + </div> |
| 50 | + <div> |
| 51 | + <button type="submit" >Send</button> |
| 52 | + </div> |
| 53 | +</form> |
0 commit comments