summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authornfoy <nfoy@purdue.edu>2014-04-24 19:07:40 -0400
committernfoy <nfoy@purdue.edu>2014-04-24 19:07:40 -0400
commit67d95e5b92e3d19765c7ccaf5460737ffe2173f4 (patch)
tree5e4dd2606fd33bea4c9c3c5fbaa0ab25f72bb38e /app
parentdf982eca7ab85f2782799ee49dd0d78a1c6b18d4 (diff)
run ./generate.sh
Diffstat (limited to 'app')
-rw-r--r--app/controllers/pms_controller.rb2
-rw-r--r--app/models/pm.rb1
-rw-r--r--app/views/pms/_form.html.erb8
-rw-r--r--app/views/pms/index.html.erb4
-rw-r--r--app/views/pms/index.json.jbuilder2
-rw-r--r--app/views/pms/show.html.erb10
-rw-r--r--app/views/pms/show.json.jbuilder2
7 files changed, 26 insertions, 3 deletions
diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb
index b62a6ef..11f51c8 100644
--- a/app/controllers/pms_controller.rb
+++ b/app/controllers/pms_controller.rb
@@ -69,6 +69,6 @@ class PmsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def pm_params
- params.require(:pm).permit(:author_id, :recipient_id, :message)
+ params.require(:pm).permit(:author_id, :recipient_id, :message, :subject, :conversation_id)
end
end
diff --git a/app/models/pm.rb b/app/models/pm.rb
index 9fce2b3..0e60f3e 100644
--- a/app/models/pm.rb
+++ b/app/models/pm.rb
@@ -1,4 +1,5 @@
class Pm < ActiveRecord::Base
belongs_to :author
belongs_to :recipient
+ belongs_to :conversation
end
diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb
index 480e308..80781a5 100644
--- a/app/views/pms/_form.html.erb
+++ b/app/views/pms/_form.html.erb
@@ -23,6 +23,14 @@
<%= 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 cb7fe4b..b5169f5 100644
--- a/app/views/pms/index.html.erb
+++ b/app/views/pms/index.html.erb
@@ -6,6 +6,8 @@
<th>Author</th>
<th>Recipient</th>
<th>Message</th>
+ <th>Subject</th>
+ <th>Conversation</th>
<th></th>
<th></th>
<th></th>
@@ -18,6 +20,8 @@
<td><%= pm.author %></td>
<td><%= pm.recipient %></td>
<td><%= pm.message %></td>
+ <td><%= pm.subject %></td>
+ <td><%= pm.conversation %></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>
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 5ee483f..2f3b944 100644
--- a/app/views/pms/show.html.erb
+++ b/app/views/pms/show.html.erb
@@ -15,5 +15,15 @@
<%= @pm.message %>
</p>
+<p>
+ <strong>Subject:</strong>
+ <%= @pm.subject %>
+</p>
+
+<p>
+ <strong>Conversation:</strong>
+ <%= @pm.conversation %>
+</p>
+
<%= link_to 'Edit', edit_pm_path(@pm) %> |
<%= 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