diff options
Diffstat (limited to 'app/views/pms')
-rw-r--r-- | app/views/pms/_form.html.erb | 4 | ||||
-rw-r--r-- | app/views/pms/index.html.erb | 81 | ||||
-rw-r--r-- | app/views/pms/show.html.erb | 6 |
3 files changed, 78 insertions, 13 deletions
diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb index 480e308..e9a7c08 100644 --- a/app/views/pms/_form.html.erb +++ b/app/views/pms/_form.html.erb @@ -12,10 +12,6 @@ <% end %> <div class="field"> - <%= f.label :author_id %><br> - <%= f.text_field :author_id %> - </div> - <div class="field"> <%= f.label :recipient_id %><br> <%= f.text_field :recipient_id %> </div> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index cb7fe4b..73c7a87 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -13,16 +13,87 @@ </thead> <tbody> - <% @pms.each do |pm| %> + + <tr> + <td><h2>Inbox<h2></td> + </tr> + + <% message = @pms.where(recipient: current_user) %> + <% unless message.empty? then message.each do |pm| %> <tr> - <td><%= pm.author %></td> - <td><%= pm.recipient %></td> + <td><%= pm.author.user_name %></td> + <td><%= pm.recipient.user_name %></td> <td><%= pm.message %></td> <td><%= link_to 'Show', pm %></td> - <td><%= link_to 'Edit', edit_pm_path(pm) %></td> - <td><%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %></td> + <td><%# link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %></td> </tr> + <% end %> + <% else %> + <td><h3>No New Messages</h3></td> <% end %> + + <tr> + <td><h2>Outbox<h2></td> + </tr> + + <% message = @pms.where(author: current_user) %> + <% unless message.empty? then message.each do |pm| %> + <tr> + <td><%= pm.author.user_name %></td> + <td><%= pm.recipient.user_name %></td> + <td><%= pm.message %></td> + <td><%= link_to 'Show', pm %></td> + <td><%# link_to 'Edit', edit_pm_path(pm) %></td> + <td><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %></td> + </tr> + <% end %> + <% else %> + <td><h3>No New Messages</h3></td> + <% end %> + + <tr> + <td><h2>Conversations<h2></td> + </tr> + <tr> + <td><h3>Inbox<h3></td> + </tr> + <tr> + <% conversation1 = current_user.mailbox.inbox.first %> + <% if !conversation1.nil? %> + <% receipts1 = conversation1.receipts_for current_user %> + <% receipts1.each do |receipt1| %> + <% message1 = receipt1.message %> + <td><%= message1.subject %></td> + <td><%= message1.body %></td> + <% end %> + <% else %> + <td><p> No Messages </p></td> + <% end %> + </tr> + + <tr> + <td><h3>Outbox<h3></td> + </tr> + <tr> + <% conversation1 = current_user.mailbox.sentbox.first %> + <% if !conversation1.nil? %> + <tr> + <td><b>From</b></td> + <td><b>Subject</b></td> + <td><b>Body</b></td> + </tr> + <% receipts1 = conversation1.receipts_for current_user %> + <% receipts1.each do |receipt1| %> + <% message1 = receipt1.message %> + <td><%= message1.subject %></td> + <td><%= message1.body %></td> + <% end %> + <% else %> + <td><p> No Messages </p></td> + <% end %> + </tr> + </tbody> </table> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index 5ee483f..595afce 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,13 +1,11 @@ -<p id="notice"><%= notice %></p> - <p> <strong>Author:</strong> - <%= @pm.author %> + <%= @pm.author.user_name %> </p> <p> <strong>Recipient:</strong> - <%= @pm.recipient %> + <%= @pm.recipient.user_name %> </p> <p> |