From 9823642115ef52f0a21b9466cef412098a124f3d Mon Sep 17 00:00:00 2001 From: nfoy Date: Thu, 24 Apr 2014 19:03:36 -0400 Subject: Mailboxer progress without generate changes. --- app/controllers/pms_controller.rb | 10 +++- app/views/pms/_form.html.erb | 4 ++ app/views/pms/index.html.erb | 117 ++++++++++++++++++++++---------------- app/views/pms/show.html.erb | 2 +- 4 files changed, 80 insertions(+), 53 deletions(-) (limited to 'app') diff --git a/app/controllers/pms_controller.rb b/app/controllers/pms_controller.rb index 1d6540d..9dbe760 100644 --- a/app/controllers/pms_controller.rb +++ b/app/controllers/pms_controller.rb @@ -24,11 +24,11 @@ class PmsController < ApplicationController def create @pm = Pm.new(pm_params) @pm.author = current_user - require 'pp' - pp @pm.message + #require 'pp' + #pp @pm.message @pm.recipient = User.find_by_user_name(pm_params['recipient_id']) - @pm.author.send_message(@pm.recipient, @pm.message, 'Default') + @pm.conversation = @pm.author.send_message(@pm.recipient, @pm.message, @pm.subject).conversation respond_to do |format| if @pm.save @@ -41,6 +41,10 @@ class PmsController < ApplicationController end end + #def reply + # current_user.reply_to_conversation(conversation, message) + #end + # PATCH/PUT /pms/1 # PATCH/PUT /pms/1.json def update diff --git a/app/views/pms/_form.html.erb b/app/views/pms/_form.html.erb index e9a7c08..b329e24 100644 --- a/app/views/pms/_form.html.erb +++ b/app/views/pms/_form.html.erb @@ -14,6 +14,10 @@
<%= f.label :recipient_id %>
<%= f.text_field :recipient_id %> +
+
+ <%= f.label :subject %>
+ <%= f.text_field :subject %>
<%= f.label :message %>
diff --git a/app/views/pms/index.html.erb b/app/views/pms/index.html.erb index 1175cb2..ee31e08 100644 --- a/app/views/pms/index.html.erb +++ b/app/views/pms/index.html.erb @@ -1,66 +1,85 @@ -

Listing pms

+

Conversations

- - - - - - - - - - - - - + + + <% conversations = current_user.mailbox.inbox %> + <% if !conversations.empty? %> + <%# require 'pp' %> + <%= conversations.class %> + + + + + + <% conversations.each do |conversation| %> + <% receipts = conversation.receipts_for current_user %> + <% receipts.each do |receipt| %> + <% message = receipt.message %> + + + + + + + <% end %> + <% end %> - <% message = @pms.where(recipient: current_user) %> - <% unless message.empty? then message.each do |pm| %> - - - - - - - - + <% else %> + <% end %> - <% else %> - - <% end %> + - - + + - - <% message = @pms.where(author: current_user) %> - <% unless message.empty? then message.each do |pm| %> - - - - - - - - + + <% conversations = current_user.mailbox.sentbox %> + <% if !conversations.empty? %> + + + + + + <% conversations.each do |conversation| %> + <% receipts = conversation.receipts_for current_user %> + <% receipts.each do |receipt| %> + <% message = receipt.message %> + + + + + + + <% end %> + <% end %> + + <% else %> + <% end %> - <% else %> - - <% end %> + - - - + +
AuthorRecipientMessage

Inbox

Inbox

FromSubjectBody
<%= conversation.last_sender.user_name %><%= message.subject %><%= message.body %><%# link_to 'Show', @pms.where(conversation: conversation) %>
<%= pm.author.user_name %><%= pm.recipient.user_name %><%= pm.message %><%= link_to 'Show', pm %><%# link_to 'Edit', edit_pm_path(pm) %><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the author\'s copy)?' } %>

No Messages

No New Messages

Outbox

Outbox

<%= pm.author.user_name %><%= pm.recipient.user_name %><%= pm.message %><%= link_to 'Show', pm %><%# link_to 'Edit', edit_pm_path(pm) %><%= link_to 'Delete', pm, method: :delete, data: { confirm: 'Are you sure (also deletes the recipient\'s copy)?'} %>
ToSubjectBody
Doesn't work<%= message.subject %><%= message.body %><%# link_to 'Show', @pms.where(conversation: conversation) %>

No Messages

No New Messages

Conversations

+ +
+ +<%= link_to 'New Pm', new_pm_path %> +

Conversations

+ + + <% conversations = current_user.mailbox.inbox %> - <% if !conversations.nil? %> + <% if !conversations.empty? %> + <%# require 'pp' %> + <%= conversations.class %> @@ -74,7 +93,7 @@ - + <% end %> <% end %> @@ -89,7 +108,7 @@ <% conversations = current_user.mailbox.sentbox %> - <% if !conversations.nil? %> + <% if !conversations.empty? %> diff --git a/app/views/pms/show.html.erb b/app/views/pms/show.html.erb index cfaf00d..aec160f 100644 --- a/app/views/pms/show.html.erb +++ b/app/views/pms/show.html.erb @@ -1,6 +1,6 @@

Author: - <%= @conversation.last_sender.user_name %> + <%# @conversation.last_sender.user_name %>

-- cgit v1.2.3-2-g168b From c909eb46740a1daeaf8fac1d60d0e4539f01e342 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 19:06:34 -0400 Subject: more fixes to the SVG --- app/assets/stylesheets/matches.css.scss | 11 ----------- app/views/tournaments/show.html.erb | 1 + 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'app') diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss index ee43ab4..64d0ca9 100644 --- a/app/assets/stylesheets/matches.css.scss +++ b/app/assets/stylesheets/matches.css.scss @@ -56,14 +56,3 @@ svg { min-width: 600px; } - -@media (max-width: 900px) { - svg text { - font-size: 200%; - } -} -@media (max-width: 700px) { - svg text { - font-size: 150%; - } -} \ No newline at end of file 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 %> + -- cgit v1.2.3-2-g168b From 67d95e5b92e3d19765c7ccaf5460737ffe2173f4 Mon Sep 17 00:00:00 2001 From: nfoy Date: Thu, 24 Apr 2014 19:07:40 -0400 Subject: run ./generate.sh --- app/controllers/pms_controller.rb | 2 +- app/models/pm.rb | 1 + app/views/pms/_form.html.erb | 8 ++++++++ app/views/pms/index.html.erb | 4 ++++ app/views/pms/index.json.jbuilder | 2 +- app/views/pms/show.html.erb | 10 ++++++++++ app/views/pms/show.json.jbuilder | 2 +- 7 files changed, 26 insertions(+), 3 deletions(-) (limited to 'app') 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 %>
<%= f.text_area :message %> +

+ <%= f.label :subject %>
+ <%= f.text_area :subject %> +
+
+ <%= f.label :conversation_id %>
+ <%= f.text_field :conversation_id %> +
<%= f.submit %>
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 @@ + + @@ -18,6 +20,8 @@ + + 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 %>

+

+ Subject: + <%= @pm.subject %> +

+ +

+ Conversation: + <%= @pm.conversation %> +

+ <%= 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 -- cgit v1.2.3-2-g168b

Inbox

From Subject<%= conversation.last_sender.user_name %> <%= message.subject %> <%= message.body %><%# link_to 'Show', pm %><%# link_to 'Show', @pm.where(conversation: conversation) %>
To Subject Author Recipient MessageSubjectConversation <%= pm.author %> <%= pm.recipient %> <%= pm.message %><%= pm.subject %><%= pm.conversation %> <%= link_to 'Show', pm %> <%= link_to 'Edit', edit_pm_path(pm) %> <%= link_to 'Destroy', pm, method: :delete, data: { confirm: 'Are you sure?' } %>