Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More improvements to message views

  • Loading branch information...
commit 4925f3c37bcbed0237eb7bbba001edb95d375a58 1 parent 3beec27
Mutwin Kraus authored
2  app/controllers/messages_controller.rb
View
@@ -24,7 +24,7 @@ def show
@message.status = Message::STATUS_READ
@message.save
end
- @new_message = Message.new(:receiver_name => @message.sender.login, :quote_message => @message)
+ @new_message = Message.new(:receiver_name => @message.sender.login, :quote_message => @message) if @message.sender
end
def new
4 app/helpers/messages_helper.rb
View
@@ -1,7 +1,7 @@
module MessagesHelper
def message_user_link(user)
- link_to h(user.display_name), new_message_path(:receiver_name => user.login)
+ link_to h(user.display_name), new_message_path(:receiver_name => user.login) rescue "Deleted User"
end
def format_message_body(message)
@@ -11,4 +11,4 @@ def format_message_body(message)
return text
end
-end
+end
13 app/views/messages/_header.html.haml
View
@@ -0,0 +1,13 @@
+-if !(@incoming_messages || []).any? && !(@outgoing_messages || []).any?
+ No messages found...
+-else
+ %li.header
+ .messages_who
+ -if @active_menu == :sent
+ To
+ -else
+ From
+ .messages_date
+ Date
+ .messages_subject
+ Subject
8 app/views/messages/index.html.haml
View
@@ -1,13 +1,7 @@
%h2 Inbox
=render :partial => "navigation"
%ul#message_list
- %li.header
- .messages_who
- From
- .messages_date
- Date
- .messages_subject
- Subject
+ =render :partial => "header"
-@incoming_messages.each do |message|
%li{:class => "#{'message_unread' if message.status == Message::STATUS_UNREAD}"}
=render :partial => message, :locals => {:inbox => true}
3  app/views/messages/sent.html.haml
View
@@ -1,6 +1,7 @@
%h2 Sent messages
=render :partial => "navigation"
%ul#message_list
+ =render :partial => "header"
-@outgoing_messages.each do |message|
%li
- =render :partial => message
+ =render :partial => message
25 app/views/messages/show.html.haml
View
@@ -6,17 +6,18 @@
=h(@message.subject)
.messages_show_body
=format_message_body(@message.body)
- %h2 Reply
- =form_for @new_message, :as => :message, :url => messages_path do |f|
- =f.hidden_field :receiver_name
- %p
- %label{:for => "subject"} Subject:
- =f.text_field :subject
- %p
- %label{:for => "body"} Message:
- %br
- =f.text_area :body
- %p.right
- =f.submit 'Send Message', :accesskey => "s"
+ -if @new_message
+ %h2 Reply
+ =form_for @new_message, :as => :message, :url => messages_path do |f|
+ =f.hidden_field :receiver_name
+ %p
+ %label{:for => "subject"} Subject:
+ =f.text_field :subject
+ %p
+ %label{:for => "body"} Message:
+ %br
+ =f.text_area :body
+ %p.right
+ =f.submit 'Send Message', :accesskey => "s"
-else
.error Don't you try an hack the system! This message is not for you!
Please sign in to comment.
Something went wrong with that request. Please try again.