Skip to content
Extraits de code Groupes Projets
Valider 035db983 rédigé par archi's avatar archi
Parcourir les fichiers

Added HTML links to posts

parent 482b2f5f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -10,4 +10,14 @@ module StatusMessagesHelper
return I18n.t('status_messages.helper.no_message_to_display')
end
end
def make_links(message)
# If there should be some kind of bb-style markup, email/diaspora highlighting, it could go here.
# next line is important due to XSS! (h is rail's make_html_safe-function)
message = h(message).html_safe
message.gsub!(/( |^)(www\.[^ ]+\.[^ ])/, '\1http://\2');
return message.gsub(/(http|ftp):\/\/([^ ]+)/, '<a target="_blank" href="\1://\2">\2</a>');
end
end
......@@ -23,7 +23,7 @@
= render "shared/reshare", :post => post, :current_user => current_user
= link_to t('.delete'), status_message_path(post), :confirm => t('.are_you_sure'), :method => :delete, :remote => true, :class => "delete"
= post.message
= make_links(post.message)
.info
%span.time= link_to(how_long_ago(post), object_path(post))
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter