diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/pms/_form.html.erb | 12 | ||||
-rw-r--r-- | app/views/pms/index.html.erb | 65 | ||||
-rw-r--r-- | app/views/pms/index.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/pms/show.html.erb | 13 | ||||
-rw-r--r-- | app/views/pms/show.json.jbuilder | 2 | ||||
-rw-r--r-- | app/views/tournaments/show.html.erb | 1 |
6 files changed, 33 insertions, 62 deletions
diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb index e9a7c08..a885e27 100644 --- a/app/views/pms/_form.html.erb +++ b/app/views/pms/_form.html.erb @@ -15,10 +15,22 @@ <%= f.label :recipient_id %><br> <%= f.text_field :recipient_id %> </div> + <div class="field"> + <%= f.label :subject %><br> + <%= f.text_field :subject %> + </div> <div class="field"> <%= f.label :message %><br> <%= f.text_area :message %> </div> + <div class="field"> + <%= f.label :subject %><br> + <%= f.text_area :subject %> + </div> + <div class="field"> + <%= f.label :conversation_id %><br> + <%= f.text_field :conversation_id %> + </div> <div class="actions"> <%= f.submit %> </div> diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index 1175cb2..b5f4884 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -1,66 +1,15 @@ -<h1>Listing pms</h1> +<h1>Conversations</h1> <table> - <thead> - <tr> - <th>Author</th> - <th>Recipient</th> - <th>Message</th> - <th></th> - <th></th> - <th></th> - </tr> - </thead> - <tbody> - - <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.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 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> <% conversations = current_user.mailbox.inbox %> - <% if !conversations.nil? %> + <% if !conversations.empty? %> + <%# require 'pp' %> + <%= conversations.class %> <tr> <td><b>From</b></td> <td><b>Subject</b></td> @@ -74,7 +23,7 @@ <td><%= conversation.last_sender.user_name %></td> <td><%= message.subject %></td> <td><%= message.body %></td> - <td><%# link_to 'Show', pm %></td> + <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td> </tr> <% end %> <% end %> @@ -89,7 +38,7 @@ </tr> <tr> <% conversations = current_user.mailbox.sentbox %> - <% if !conversations.nil? %> + <% if !conversations.empty? %> <tr> <td><b>To</b></td> <td><b>Subject</b></td> @@ -103,7 +52,7 @@ <td>Doesn't work</td> <td><%= message.subject %></td> <td><%= message.body %></td> - <td><%# link_to 'Show', conversation %></td> + <td><%# link_to 'Show', @pms.where(conversation: conversation) %></td> </tr> <% end %> <% end %> diff --git a/app/views/pms/index.json.jbuilder b/app/views/pms/index.json.jbuilder index fcfca84..3dc1abb 100644 --- a/app/views/pms/index.json.jbuilder +++ b/app/views/pms/index.json.jbuilder @@ -1,4 +1,4 @@ json.array!(@pms) do |pm| - json.extract! pm, :id, :author_id, :recipient_id, :message + json.extract! pm, :id, :author_id, :recipient_id, :message, :subject, :conversation_id json.url pm_url(pm, format: :json) end diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index cfaf00d..6f81d1b 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,6 +1,6 @@ <p> <strong>Author:</strong> - <%= @conversation.last_sender.user_name %> + <%# @conversation.last_sender.user_name %> </p> <p> @@ -13,5 +13,14 @@ <%# @pm.message %> </p> -<%# link_to 'Edit', edit_pm_path(@pm) %> | +<p> + <strong>Subject:</strong> + <%= @pm.subject %> +</p> + +<p> + <strong>Conversation:</strong> + <%= @pm.conversation %> +</p> + <%= link_to 'Back', pms_path %> diff --git a/app/views/pms/show.json.jbuilder b/app/views/pms/show.json.jbuilder index 94252e9..4e69026 100644 --- a/app/views/pms/show.json.jbuilder +++ b/app/views/pms/show.json.jbuilder @@ -1 +1 @@ -json.extract! @pm, :id, :author_id, :recipient_id, :message, :created_at, :updated_at +json.extract! @pm, :id, :author_id, :recipient_id, :message, :subject, :conversation_id, :created_at, :updated_at diff --git a/app/views/tournaments/show.html.erb b/app/views/tournaments/show.html.erb index a5eb46c..f79b975 100644 --- a/app/views/tournaments/show.html.erb +++ b/app/views/tournaments/show.html.erb @@ -113,3 +113,4 @@ <%end %> </div> +</div> |