summaryrefslogtreecommitdiff
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
parentdf982eca7ab85f2782799ee49dd0d78a1c6b18d4 (diff)
run ./generate.sh
-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
-rw-r--r--db/migrate/20140424190540_create_simple_captcha_data.rb (renamed from db/migrate/20140424162546_create_simple_captcha_data.rb)0
-rw-r--r--db/migrate/20140424230536_create_mailboxer.mailboxer_engine.rb (renamed from db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230537_add_notified_object.mailboxer_engine.rb (renamed from db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230538_add_notification_code.mailboxer_engine.rb (renamed from db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230539_add_attachments.mailboxer_engine.rb (renamed from db/migrate/20140424202545_add_attachments.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230540_rename_receipts_read.mailboxer_engine.rb (renamed from db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230541_add_global_notification_support.mailboxer_engine.rb (renamed from db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb)0
-rw-r--r--db/migrate/20140424230543_create_delayed_jobs.rb (renamed from db/migrate/20140424202549_create_delayed_jobs.rb)0
-rw-r--r--db/migrate/20140424230547_create_servers.rb (renamed from db/migrate/20140424202553_create_servers.rb)0
-rw-r--r--db/migrate/20140424230550_create_matches.rb (renamed from db/migrate/20140424202557_create_matches.rb)0
-rw-r--r--db/migrate/20140424230554_create_teams.rb (renamed from db/migrate/20140424202600_create_teams.rb)0
-rw-r--r--db/migrate/20140424230558_create_alerts.rb (renamed from db/migrate/20140424202604_create_alerts.rb)0
-rw-r--r--db/migrate/20140424230602_create_pms.rb (renamed from db/migrate/20140424202608_create_pms.rb)2
-rw-r--r--db/migrate/20140424230605_create_tournaments.rb (renamed from db/migrate/20140424202611_create_tournaments.rb)0
-rw-r--r--db/migrate/20140424230609_create_games.rb (renamed from db/migrate/20140424202615_create_games.rb)0
-rw-r--r--db/migrate/20140424230613_create_users.rb (renamed from db/migrate/20140424202619_create_users.rb)0
-rw-r--r--db/migrate/20140424230617_create_sessions.rb (renamed from db/migrate/20140424202623_create_sessions.rb)0
-rw-r--r--db/migrate/20140424230620_create_brackets.rb (renamed from db/migrate/20140424202626_create_brackets.rb)0
-rw-r--r--db/migrate/20140424230624_create_game_settings.rb (renamed from db/migrate/20140424202630_create_game_settings.rb)0
-rw-r--r--db/migrate/20140424230628_create_tournament_settings.rb (renamed from db/migrate/20140424202634_create_tournament_settings.rb)0
-rw-r--r--db/migrate/20140424230632_create_tournament_stages.rb (renamed from db/migrate/20140424202638_create_tournament_stages.rb)0
-rw-r--r--db/migrate/20140424230635_create_statistics.rb (renamed from db/migrate/20140424202641_create_statistics.rb)0
-rw-r--r--db/migrate/20140424230639_create_remote_usernames.rb (renamed from db/migrate/20140424202645_create_remote_usernames.rb)0
-rw-r--r--db/migrate/20140424230643_create_bracket_matches.rb (renamed from db/migrate/20140424202649_create_bracket_matches.rb)0
-rw-r--r--db/migrate/20140424230646_create_api_requests.rb (renamed from db/migrate/20140424202652_create_api_requests.rb)0
-rw-r--r--db/migrate/20140424230650_create_tournament_players_join_table.rb (renamed from db/migrate/20140424202656_create_tournament_players_join_table.rb)0
-rw-r--r--db/migrate/20140424230654_create_tournament_hosts_join_table.rb (renamed from db/migrate/20140424202659_create_tournament_hosts_join_table.rb)0
-rw-r--r--db/migrate/20140424230657_create_team_user_join_table.rb (renamed from db/migrate/20140424202703_create_team_user_join_table.rb)0
-rw-r--r--db/migrate/20140424230701_create_match_team_join_table.rb (renamed from db/migrate/20140424202706_create_match_team_join_table.rb)0
-rw-r--r--db/migrate/20140424230712_add_hidden_attrs_to_user.rb (renamed from db/migrate/20140424202717_add_hidden_attrs_to_user.rb)0
-rw-r--r--db/schema.rb5
-rw-r--r--test/controllers/pms_controller_test.rb4
-rw-r--r--test/fixtures/pms.yml4
40 files changed, 38 insertions, 6 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
diff --git a/db/migrate/20140424162546_create_simple_captcha_data.rb b/db/migrate/20140424190540_create_simple_captcha_data.rb
index 4573b20..4573b20 100644
--- a/db/migrate/20140424162546_create_simple_captcha_data.rb
+++ b/db/migrate/20140424190540_create_simple_captcha_data.rb
diff --git a/db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb b/db/migrate/20140424230536_create_mailboxer.mailboxer_engine.rb
index 690cec2..690cec2 100644
--- a/db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb
+++ b/db/migrate/20140424230536_create_mailboxer.mailboxer_engine.rb
diff --git a/db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb b/db/migrate/20140424230537_add_notified_object.mailboxer_engine.rb
index 7f41ac6..7f41ac6 100644
--- a/db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb
+++ b/db/migrate/20140424230537_add_notified_object.mailboxer_engine.rb
diff --git a/db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb b/db/migrate/20140424230538_add_notification_code.mailboxer_engine.rb
index 04c12ef..04c12ef 100644
--- a/db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb
+++ b/db/migrate/20140424230538_add_notification_code.mailboxer_engine.rb
diff --git a/db/migrate/20140424202545_add_attachments.mailboxer_engine.rb b/db/migrate/20140424230539_add_attachments.mailboxer_engine.rb
index b8d6588..b8d6588 100644
--- a/db/migrate/20140424202545_add_attachments.mailboxer_engine.rb
+++ b/db/migrate/20140424230539_add_attachments.mailboxer_engine.rb
diff --git a/db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb b/db/migrate/20140424230540_rename_receipts_read.mailboxer_engine.rb
index 9ce904f..9ce904f 100644
--- a/db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb
+++ b/db/migrate/20140424230540_rename_receipts_read.mailboxer_engine.rb
diff --git a/db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb b/db/migrate/20140424230541_add_global_notification_support.mailboxer_engine.rb
index 60f67ab..60f67ab 100644
--- a/db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb
+++ b/db/migrate/20140424230541_add_global_notification_support.mailboxer_engine.rb
diff --git a/db/migrate/20140424202549_create_delayed_jobs.rb b/db/migrate/20140424230543_create_delayed_jobs.rb
index ec0dd93..ec0dd93 100644
--- a/db/migrate/20140424202549_create_delayed_jobs.rb
+++ b/db/migrate/20140424230543_create_delayed_jobs.rb
diff --git a/db/migrate/20140424202553_create_servers.rb b/db/migrate/20140424230547_create_servers.rb
index fbe1b02..fbe1b02 100644
--- a/db/migrate/20140424202553_create_servers.rb
+++ b/db/migrate/20140424230547_create_servers.rb
diff --git a/db/migrate/20140424202557_create_matches.rb b/db/migrate/20140424230550_create_matches.rb
index bac92d1..bac92d1 100644
--- a/db/migrate/20140424202557_create_matches.rb
+++ b/db/migrate/20140424230550_create_matches.rb
diff --git a/db/migrate/20140424202600_create_teams.rb b/db/migrate/20140424230554_create_teams.rb
index dd8397d..dd8397d 100644
--- a/db/migrate/20140424202600_create_teams.rb
+++ b/db/migrate/20140424230554_create_teams.rb
diff --git a/db/migrate/20140424202604_create_alerts.rb b/db/migrate/20140424230558_create_alerts.rb
index 68a8e10..68a8e10 100644
--- a/db/migrate/20140424202604_create_alerts.rb
+++ b/db/migrate/20140424230558_create_alerts.rb
diff --git a/db/migrate/20140424202608_create_pms.rb b/db/migrate/20140424230602_create_pms.rb
index 93bb5c6..eb9f443 100644
--- a/db/migrate/20140424202608_create_pms.rb
+++ b/db/migrate/20140424230602_create_pms.rb
@@ -4,6 +4,8 @@ class CreatePms < ActiveRecord::Migration
t.references :author, index: true
t.references :recipient, index: true
t.text :message
+ t.text :subject
+ t.references :conversation, index: true
t.timestamps
end
diff --git a/db/migrate/20140424202611_create_tournaments.rb b/db/migrate/20140424230605_create_tournaments.rb
index 716871f..716871f 100644
--- a/db/migrate/20140424202611_create_tournaments.rb
+++ b/db/migrate/20140424230605_create_tournaments.rb
diff --git a/db/migrate/20140424202615_create_games.rb b/db/migrate/20140424230609_create_games.rb
index 23edf0b..23edf0b 100644
--- a/db/migrate/20140424202615_create_games.rb
+++ b/db/migrate/20140424230609_create_games.rb
diff --git a/db/migrate/20140424202619_create_users.rb b/db/migrate/20140424230613_create_users.rb
index 8032870..8032870 100644
--- a/db/migrate/20140424202619_create_users.rb
+++ b/db/migrate/20140424230613_create_users.rb
diff --git a/db/migrate/20140424202623_create_sessions.rb b/db/migrate/20140424230617_create_sessions.rb
index f667f1e..f667f1e 100644
--- a/db/migrate/20140424202623_create_sessions.rb
+++ b/db/migrate/20140424230617_create_sessions.rb
diff --git a/db/migrate/20140424202626_create_brackets.rb b/db/migrate/20140424230620_create_brackets.rb
index 8813bf2..8813bf2 100644
--- a/db/migrate/20140424202626_create_brackets.rb
+++ b/db/migrate/20140424230620_create_brackets.rb
diff --git a/db/migrate/20140424202630_create_game_settings.rb b/db/migrate/20140424230624_create_game_settings.rb
index 06fb72e..06fb72e 100644
--- a/db/migrate/20140424202630_create_game_settings.rb
+++ b/db/migrate/20140424230624_create_game_settings.rb
diff --git a/db/migrate/20140424202634_create_tournament_settings.rb b/db/migrate/20140424230628_create_tournament_settings.rb
index e56697f..e56697f 100644
--- a/db/migrate/20140424202634_create_tournament_settings.rb
+++ b/db/migrate/20140424230628_create_tournament_settings.rb
diff --git a/db/migrate/20140424202638_create_tournament_stages.rb b/db/migrate/20140424230632_create_tournament_stages.rb
index e3668cb..e3668cb 100644
--- a/db/migrate/20140424202638_create_tournament_stages.rb
+++ b/db/migrate/20140424230632_create_tournament_stages.rb
diff --git a/db/migrate/20140424202641_create_statistics.rb b/db/migrate/20140424230635_create_statistics.rb
index cc2e97d..cc2e97d 100644
--- a/db/migrate/20140424202641_create_statistics.rb
+++ b/db/migrate/20140424230635_create_statistics.rb
diff --git a/db/migrate/20140424202645_create_remote_usernames.rb b/db/migrate/20140424230639_create_remote_usernames.rb
index e265985..e265985 100644
--- a/db/migrate/20140424202645_create_remote_usernames.rb
+++ b/db/migrate/20140424230639_create_remote_usernames.rb
diff --git a/db/migrate/20140424202649_create_bracket_matches.rb b/db/migrate/20140424230643_create_bracket_matches.rb
index 3323e31..3323e31 100644
--- a/db/migrate/20140424202649_create_bracket_matches.rb
+++ b/db/migrate/20140424230643_create_bracket_matches.rb
diff --git a/db/migrate/20140424202652_create_api_requests.rb b/db/migrate/20140424230646_create_api_requests.rb
index 544c330..544c330 100644
--- a/db/migrate/20140424202652_create_api_requests.rb
+++ b/db/migrate/20140424230646_create_api_requests.rb
diff --git a/db/migrate/20140424202656_create_tournament_players_join_table.rb b/db/migrate/20140424230650_create_tournament_players_join_table.rb
index be240e8..be240e8 100644
--- a/db/migrate/20140424202656_create_tournament_players_join_table.rb
+++ b/db/migrate/20140424230650_create_tournament_players_join_table.rb
diff --git a/db/migrate/20140424202659_create_tournament_hosts_join_table.rb b/db/migrate/20140424230654_create_tournament_hosts_join_table.rb
index 7521d89..7521d89 100644
--- a/db/migrate/20140424202659_create_tournament_hosts_join_table.rb
+++ b/db/migrate/20140424230654_create_tournament_hosts_join_table.rb
diff --git a/db/migrate/20140424202703_create_team_user_join_table.rb b/db/migrate/20140424230657_create_team_user_join_table.rb
index f3b57fc..f3b57fc 100644
--- a/db/migrate/20140424202703_create_team_user_join_table.rb
+++ b/db/migrate/20140424230657_create_team_user_join_table.rb
diff --git a/db/migrate/20140424202706_create_match_team_join_table.rb b/db/migrate/20140424230701_create_match_team_join_table.rb
index c2ed1b7..c2ed1b7 100644
--- a/db/migrate/20140424202706_create_match_team_join_table.rb
+++ b/db/migrate/20140424230701_create_match_team_join_table.rb
diff --git a/db/migrate/20140424202717_add_hidden_attrs_to_user.rb b/db/migrate/20140424230712_add_hidden_attrs_to_user.rb
index 9b5c505..9b5c505 100644
--- a/db/migrate/20140424202717_add_hidden_attrs_to_user.rb
+++ b/db/migrate/20140424230712_add_hidden_attrs_to_user.rb
diff --git a/db/schema.rb b/db/schema.rb
index 0833263..d7e4efd 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20140424202717) do
+ActiveRecord::Schema.define(version: 20140424230712) do
create_table "alerts", force: true do |t|
t.integer "author_id"
@@ -156,11 +156,14 @@ ActiveRecord::Schema.define(version: 20140424202717) do
t.integer "author_id"
t.integer "recipient_id"
t.text "message"
+ t.text "subject"
+ t.integer "conversation_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "pms", ["author_id"], name: "index_pms_on_author_id"
+ add_index "pms", ["conversation_id"], name: "index_pms_on_conversation_id"
add_index "pms", ["recipient_id"], name: "index_pms_on_recipient_id"
create_table "receipts", force: true do |t|
diff --git a/test/controllers/pms_controller_test.rb b/test/controllers/pms_controller_test.rb
index 18b2449..2a2c1ce 100644
--- a/test/controllers/pms_controller_test.rb
+++ b/test/controllers/pms_controller_test.rb
@@ -18,7 +18,7 @@ class PmsControllerTest < ActionController::TestCase
test "should create pm" do
assert_difference('Pm.count') do
- post :create, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id }
+ post :create, pm: { author_id: @pm.author_id, conversation_id: @pm.conversation_id, message: @pm.message, recipient_id: @pm.recipient_id, subject: @pm.subject }
end
assert_redirected_to pm_path(assigns(:pm))
@@ -35,7 +35,7 @@ class PmsControllerTest < ActionController::TestCase
end
test "should update pm" do
- patch :update, id: @pm, pm: { author_id: @pm.author_id, message: @pm.message, recipient_id: @pm.recipient_id }
+ patch :update, id: @pm, pm: { author_id: @pm.author_id, conversation_id: @pm.conversation_id, message: @pm.message, recipient_id: @pm.recipient_id, subject: @pm.subject }
assert_redirected_to pm_path(assigns(:pm))
end
diff --git a/test/fixtures/pms.yml b/test/fixtures/pms.yml
index f77e727..ba31b86 100644
--- a/test/fixtures/pms.yml
+++ b/test/fixtures/pms.yml
@@ -4,8 +4,12 @@ one:
author_id:
recipient_id:
message: MyText
+ subject: MyText
+ conversation_id:
two:
author_id:
recipient_id:
message: MyText
+ subject: MyText
+ conversation_id: