diff options
author | Johan Sørensen <johan@johansorensen.com> | 2009-12-04 15:00:33 +0100 |
---|---|---|
committer | Johan Sørensen <johan@johansorensen.com> | 2009-12-07 09:41:36 +0100 |
commit | 8059c3c249c9cbfa26a9fceec7d11a53b431689c (patch) | |
tree | 99a7b38f3a82b39b1ebb0b7e7474e9b671497043 /app | |
parent | b9fff57efc266d16617624e3ef9e10f6425084ba (diff) | |
download | gitorious-mainline-outdated-8059c3c249c9cbfa26a9fceec7d11a53b431689c.zip gitorious-mainline-outdated-8059c3c249c9cbfa26a9fceec7d11a53b431689c.tar.gz gitorious-mainline-outdated-8059c3c249c9cbfa26a9fceec7d11a53b431689c.tar.bz2 |
Link to the user from a message and cut some long lines
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/messages_helper.rb | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/app/helpers/messages_helper.rb b/app/helpers/messages_helper.rb index f5cf8c9..10418b9 100644 --- a/app/helpers/messages_helper.rb +++ b/app/helpers/messages_helper.rb @@ -19,26 +19,34 @@ module MessagesHelper def sender_and_recipient_display(message) sender_and_recipient_for(message).collect(&:capitalize).join(",") end - + def sender_and_recipient_for(message) if message.recipient == current_user - [h(message.sender_name), "me"] + [link_to(h(message.sender_name), message.sender), "me"] else - ["me", h(message.recipient.title)] + ["me", link_to(h(message.recipient.title), message.recipient)] end end - + def message_title(message) sender, recipient = sender_and_recipient_for(message) - + case message.notifiable when MergeRequest - "From <strong>#{sender}</strong> to <strong>#{recipient}</strong>, about a #{link_to('merge request', [message.notifiable.target_repository.project, message.notifiable.target_repository, message.notifiable])}" - when Membership - %Q{<strong>#{sender}</strong> added <strong>#{recipient}</strong> to the team #{link_to("#{message.notifiable.group.name}", message.notifiable.group)}} + msg_link = link_to('merge request', [message.notifiable.target_repository.project, + message.notifiable.target_repository, + message.notifiable]) + "From <strong>#{sender}</strong> to <strong>#{recipient}</strong>, about a #{msg_link}" + when Membership + %Q{<strong>#{sender}</strong> added <strong>#{recipient}</strong> to the } + + %Q{team #{link_to("#{message.notifiable.group.name}", message.notifiable.group)}} when Committership committership = message.notifiable - %Q{<strong>#{sender}</strong> added #{link_to(committership.committer.title, [committership.repository.project,committership.repository,:committerships])} as committer in <strong>#{committership.repository.name}</strong>} + user_link = link_to(committership.committer.title, [committership.repository.project, + committership.repository, + :committerships]) + %Q{<strong>#{sender}</strong> added #{user_link} as committer in } + + %Q{<strong>#{committership.repository.name}</strong>} else "#{link_to('message', message)} from <strong>#{sender}</strong> to <strong>#{recipient}</strong>" end |