summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:25:21 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-28 00:25:21 -0400
commitfcc89e5f2621f1fb0593c1fef4a6d15b9cf4fc70 (patch)
treeee0f404868fd10d1f5a94c54f3b4a83286c6b813
parentd43213dfcf1f1d73d76ae2d2aa59cee3597c06da (diff)
parente5f603c8c463e09fee5931d7e00e94e14b819347 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
-rw-r--r--app/views/pms/index.html.erb69
-rw-r--r--app/views/pms/show.html.erb1
-rw-r--r--app/views/tournaments/_form.html.erb1
3 files changed, 61 insertions, 10 deletions
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index 056b371..fec6db2 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -23,6 +23,9 @@
<% if conversation.is_unread?(current_user) && receipts.last.message.sender != current_user %>
<% message = receipts.last.message %>
<tr>
+ <% if conversation.subject == "Pay Attention!" %>
+ <% conversation.mark_as_read(current_user) %>
+ <% end %>
<td>
<% people = conversation.participants %>
<% people.each do |person| %>
@@ -65,17 +68,63 @@
<% if conversation.is_read?(current_user) || receipts.last.message.sender == current_user %>
<% message = receipts.last.message %>
<tr>
- <td>
- <% people = conversation.participants %>
- <% people.each do |person| %>
- <% unless person == current_user %>
- <%= truncate(person.user_name, length: 20) %>
+ <% if conversation.subject != "Pay Attention!" %>
+ <td>
+ <% people = conversation.participants %>
+ <% people.each do |person| %>
+ <% unless person == current_user %>
+ <%= truncate(person.user_name, length: 20) %>
+ <% end %>
<% end %>
- <% end %>
- </td>
- <td><%= truncate(conversation.subject, length: 30) %></td>
- <td><%= truncate(message.body, length: 42) %></td>
- <td><%= link_to 'View', @pms.find_by(conversation: conversation) %></td>
+ </td>
+ <td><%= truncate(conversation.subject, length: 30) %></td>
+ <td><%= truncate(message.body, length: 42) %></td>
+ <td><%= link_to 'View', @pms.find_by(conversation: conversation) %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ <% end %>
+ </tr>
+ <% #else %>
+
+ <% #end %>
+ </tbody>
+</table>
+
+<br>
+<h3>Alerts</h3>
+<% conversations = current_user.mailbox.conversations %>
+
+<table>
+ <col width="150">
+ <col width="250">
+ <col width="300">
+ <tbody>
+ <%# if conversations.reject { |c| c.is_read?(current_user) || (c.receipts_for current_user).last.message.sender == current_user }.empty? %>
+ <tr>
+ <tr>
+ <td><b>With</b></td>
+ <td><b>Subject</b></td>
+ <td><b>Body</b></td>
+ </tr>
+ <% conversations.each do |conversation| %>
+ <% receipts = conversation.receipts_for current_user %>
+ <% if conversation.is_read?(current_user) || receipts.last.message.sender == current_user %>
+ <% message = receipts.last.message %>
+ <tr>
+ <% if conversation.subject == "Pay Attention!" %>
+ <td>
+ <% people = conversation.participants %>
+ <% people.each do |person| %>
+ <% unless person == current_user %>
+ <%= truncate(person.user_name, length: 20) %>
+ <% end %>
+ <% end %>
+ </td>
+ <td><%= truncate(conversation.subject, length: 30) %></td>
+ <td><%= truncate(message.body, length: 42) %></td>
+ <td><%= link_to 'View', @pms.find_by(conversation: conversation) %></td>
+ <% end %>
</tr>
<% end %>
<% end %>
diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb
index ca8d9bf..2c93102 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -31,6 +31,7 @@
<p> ________________________________________________ </p>
<p>
+ <% @pm.message = "" %>
<%= form_for(@pm) do |f| %>
<div class="field">
<%= f.text_area :message %>
diff --git a/app/views/tournaments/_form.html.erb b/app/views/tournaments/_form.html.erb
index 2a871ea..a5eba7a 100644
--- a/app/views/tournaments/_form.html.erb
+++ b/app/views/tournaments/_form.html.erb
@@ -17,6 +17,7 @@
</fieldset>
<% else %>
<%= form_for(@tournament, url: tournaments_path, method: "post") do |f| %>
+ <%= f.hidden_field(:game_id) %>
<p>
<%= f.label :name %>
<%= f.text_field :name %>