I am building a social networking site which currently has comments enabled. I was wondering if anyone knew how to enable html within these comments so that people can post links to other sites on the internet and have these links actually work if you click on them. Actually, this hyperlink capability is the only think that I really need. Anyone know how to enable hyperlinks in comments? Thanks, Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 25, 9:02 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am building a social networking site which currently has comments > enabled. I was wondering if anyone knew how to enable html within > these comments so that people can post links to other sites on the > internet and have these links actually work if you click on them. > Actually, this hyperlink capability is the only think that I really > need. Anyone know how to enable hyperlinks in comments? Thanks, DaveHi Dave, I would suggest trying the sanitize helper. This can be configured to only permit certain HTML tags. The API docs are quite detailed. http://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html Allow people to put anything in the comment (within reason of course - some input validation would be useful), and then use the helper in the view. The alternative of course is to use regular expressions to validate the input. Best Regards Robin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.railslodge.com/plugins/106-nofollow-links may also come in useful if you go with the above approach. else there is also an auto_link text helper http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001058 Dave Lynam wrote:> I am building a social networking site which currently has comments > enabled. I was wondering if anyone knew how to enable html within > these comments so that people can post links to other sites on the > internet and have these links actually work if you click on them. > Actually, this hyperlink capability is the only think that I really > need. Anyone know how to enable hyperlinks in comments? Thanks, Dave-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Dave, I assume you are asking this question because you already have something implemented and are wondering why links aren''t working. Have a look in your view code and remove the html escape method ("h"):- <%=h "some html text" %> and change the erb to:- <% "some html text" %> Once you have done that and the links are working I strongly suggest you look at SanitizeHelper as Robin suggested, you don''t want anyone to slip malicious code into your comments ;) Jabbslad On Feb 25, 9:02 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am building a social networking site which currently has comments > enabled. I was wondering if anyone knew how to enable html within > these comments so that people can post links to other sites on the > internet and have these links actually work if you click on them. > Actually, this hyperlink capability is the only think that I really > need. Anyone know how to enable hyperlinks in comments? Thanks, Dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I would suggest the whitelist plugin. That way you can set what they can and can''t do as far as html, like bold, italic, links, etc. On Feb 25, 7:16 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Dave, > > I assume you are asking this question because you already have > something implemented and are wondering why links aren''t working. Have > a look in your view code and remove the html escape method ("h"):- > > <%=h "some html text" %> > > and change the erb to:- > > <% "some html text" %> > > Once you have done that and the links are working I strongly suggest > you look at SanitizeHelper as Robin suggested, you don''t want anyone > to slip malicious code into your comments ;) > > Jabbslad > > On Feb 25, 9:02 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I am building a social networking site which currently has comments > > enabled. I was wondering if anyone knew how to enable html within > > these comments so that people can post links to other sites on the > > internet and have these links actually work if you click on them. > > Actually, this hyperlink capability is the only think that I really > > need. Anyone know how to enable hyperlinks in comments? Thanks, Dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Awesome, this all looks like good advice. Thanks. On Feb 25, 7:13 pm, kopf1988 <kopf1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I would suggest the whitelist plugin. That way you can set what they > can and can''t do as far as html, like bold, italic, links, etc. > > On Feb 25, 7:16 pm, Jabbslad <jabbs...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi Dave, > > > I assume you are asking this question because you already have > > something implemented and are wondering why links aren''t working. Have > > a look in your view code and remove the html escape method ("h"):- > > > <%=h "some html text" %> > > > and change the erb to:- > > > <% "some html text" %> > > > Once you have done that and the links are working I strongly suggest > > you look at SanitizeHelper as Robin suggested, you don''t want anyone > > to slip malicious code into your comments ;) > > > Jabbslad > > > On Feb 25, 9:02 pm, Dave Lynam <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I am building a social networking site which currently has comments > > > enabled. I was wondering if anyone knew how to enable html within > > > these comments so that people can post links to other sites on the > > > internet and have these links actually work if you click on them. > > > Actually, this hyperlink capability is the only think that I really > > > need. Anyone know how to enable hyperlinks in comments? Thanks, Dave--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---