Extract message system to plugin.
This commit is contained in:
parent
fe0b17cdb0
commit
7556c753d0
45 changed files with 298 additions and 45 deletions
|
|
@ -199,14 +199,9 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
# render user presentation linking to default action (write message)
|
||||
# render user presentation linking to default action (plugins can override this)
|
||||
def show_user_link(user=@current_user)
|
||||
if user.nil?
|
||||
show_user user
|
||||
else
|
||||
link_to show_user(user), new_message_path('message[mail_to]' => user.id),
|
||||
:title => I18n.t('helpers.application.write_message')
|
||||
end
|
||||
show_user user
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
module MessagesHelper
|
||||
def format_subject(message, length)
|
||||
if message.subject.length > length
|
||||
subject = truncate(message.subject, :length => length)
|
||||
body = ""
|
||||
else
|
||||
subject = message.subject
|
||||
body = truncate(message.body, :length => length - subject.length)
|
||||
end
|
||||
"<b>#{link_to(h(subject), message)}</b> <span style='color:grey'>#{h(body)}</span>".html_safe
|
||||
end
|
||||
|
||||
def link_to_new_message(options = {})
|
||||
messages_params = options[:message_params] || nil
|
||||
link_text = content_tag :id, nil, class: 'icon-envelope'
|
||||
link_text << " #{options[:text]}" if options[:text].present?
|
||||
link_to(link_text.html_safe, new_message_path(message: messages_params), class: 'btn',
|
||||
title: I18n.t('helpers.submit.message.create'))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue