summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/pms.css.scss8
-rw-r--r--app/controllers/pms_controller.rb6
-rw-r--r--app/views/pms/index.html.erb51
3 files changed, 59 insertions, 6 deletions
diff --git a/app/assets/stylesheets/pms.css.scss b/app/assets/stylesheets/pms.css.scss
index 5106093..a14299e 100644
--- a/app/assets/stylesheets/pms.css.scss
+++ b/app/assets/stylesheets/pms.css.scss
@@ -1,3 +1,11 @@
// Place all the styles related to the pms controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+p, li {
+ color: #DD9125;
+}
+td, th {
+ padding: 0px;
+ color: #DD9125;
+} \ No newline at end of file
diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb
index 1279fdf..2cb55f8 100644
--- a/app/controllers/pms_controller.rb
+++ b/app/controllers/pms_controller.rb
@@ -24,10 +24,12 @@ class PmsController < ApplicationController
def create
@pm = Pm.new(pm_params)
@pm.author = current_user
- require 'pp'
- pp pm_params['recipient_id']
+ #require 'pp'
+ #pp pm_params['recipient_id']
@pm.recipient = User.find_by_user_name(pm_params['recipient_id'])
+ @pm.author.send_message(@pm.recipient, @pm.message, 'Default')
+
respond_to do |format|
if @pm.save
format.html { redirect_to @pm, notice: 'Pm was successfully created.' }
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb
index ceb1a40..73c7a87 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -25,8 +25,8 @@
<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 %>
@@ -44,13 +44,56 @@
<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 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>