I made a nice (imo), custom table for my posts while following a simple blog in Rails tutorial. I was wondering tho if I can set a maximum width for a table row/cell and have it cut off text if its too long to fit, so it just shows a preview of the blog post. Also, is it possible for the table to size and get bigger with the resizing of a browser window? I know that this is mostly an HTML problem, so I''m sorry if this is the wrong place. -- 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 -~----------~----~----~----~------~----~------~--~---
Bob Martens
2009-Mar-06 17:51 UTC
Re: Cut off text if its too big for a table? (Resize table?)
There should be a way to just limit the number of words displayed from a certain field. Do it that way and then you''ll have some consistency. I can''t think at the moment, but I would think there is a way to limit the number of words to just a certain limit relatively easily in Ruby/ Rails. On Mar 6, 11:48 am, Tim Mcd <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I made a nice (imo), custom table for my posts while following a simple > blog in Rails tutorial. I was wondering tho if I can set a maximum width > for a table row/cell and have it cut off text if its too long to fit, so > it just shows a preview of the blog post. Also, is it possible for the > table to size and get bigger with the resizing of a browser window? I > know that this is mostly an HTML problem, so I''m sorry if this is the > wrong place. > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
bill walton
2009-Mar-06 20:56 UTC
Re: Cut off text if its too big for a table? (Resize table?)
Hi Tim, On Fri, 2009-03-06 at 18:48 +0100, Tim Mcd wrote:> I made a nice (imo), custom table for my posts while following a simple > blog in Rails tutorial. I was wondering tho if I can set a maximum width > for a table row/cell and have it cut off text if its too long to fit, so > it just shows a preview of the blog post. Also, is it possible for the > table to size and get bigger with the resizing of a browser window? I > know that this is mostly an HTML problem, so I''m sorry if this is the > wrong place.I can think of a couple of ways to approach this. CSS overflow - not sure if this works with table elements, but you can set the overflow attribute in a CSS rule to simply clip content to the element size, make the element scroll, or a couple of other choices. Helper methods - either a view helper, or a method in your model, can trim the string prior to display; assuming you know the size you want to trim it to. I prefer the CSS approach because it''s simpler. It''ll automatically take care of the resizing issue. But, like I said, I''m not sure if it''s supported with table elements. Make a test and let us know. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Morgan Morgan
2009-Mar-06 22:24 UTC
Re: Cut off text if its too big for a table? (Resize table?)
Tim Mcd wrote:> I made a nice (imo), custom table for my posts while following a simple > blog in Rails tutorial. I was wondering tho if I can set a maximum width > for a table row/cell and have it cut off text if its too long to fit, so > it just shows a preview of the blog post. Also, is it possible for the > table to size and get bigger with the resizing of a browser window? I > know that this is mostly an HTML problem, so I''m sorry if this is the > wrong place.i agree with the previous post that you should just limit your word count so it would just kill anything over the limit and replace it with a link "...." that goes to full text... that seems to be the bog standard way to do it. -- 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 -~----------~----~----~----~------~----~------~--~---