Hi to everyone! I need to split one long line in two or multiple
lines.. how can I do that? I have a form where you can write in for
example 200 character long line ("aaaaaaaaa..."), when I submit
it(line contains no spaces), char line updates in my blog, but the
only bug is there that line is posted in its real length 200 chars
from left to right all over other borders, can I set maxlength of it
or something like that? (Example: when form echoes line it should be
100px long height:relative)
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
use text_area for example <%text_area(:product,:description ,:size=>"100x10",:disabled=>"disabled") %> I hope that will help. On May 24, 3:13 pm, Ainar Abramovich <youhubcommun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi to everyone! I need to split one long line in two or multiple > lines.. how can I do that? I have a form where you can write in for > example 200 character long line ("aaaaaaaaa..."), when I submit > it(line contains no spaces), char line updates in my blog, but the > only bug is there that line is posted in its real length 200 chars > from left to right all over other borders, can I set maxlength of it > or something like that? (Example: when form echoes line it should be > 100px long height:relative) > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Ainar Abramovich wrote:> Hi to everyone! I need to split one long line in two or multiple > lines.. how can I do that? I have a form where you can write in for > example 200 character long line ("aaaaaaaaa..."), when I submit > it(line contains no spaces), char line updates in my blog, but the > only bug is there that line is posted in its real length 200 chars > from left to right all over other borders, can I set maxlength of it > or something like that? (Example: when form echoes line it should be > 100px long height:relative)Just split words that are more than a certain number of characters long. Ruby''s String and Regexp classes have many methods that will help you. For further help, I''d recommend that you go to the Ruby list, as this is basically not a Rails question. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
axelsef wrote:> use text_area > for example > <%> text_area(:product,:description ,:size=>"100x10",:disabled=>"disabled") > %> > > I hope that will help. > > On May 24, 3:13�pm, Ainar Abramovich <youhubcommun...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>That''s a really bad solution. Disabled <input> objects are usually a sign that you''re doing something wrong. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
However thank you all,
I found solution, I write few lines in posts helper and everything
works fine
module PostsHelper
def wrap(content)
content.split.map{ |s| wrap_long_string(s) }.join('' '')
end
private
def wrap_long_string(text, max_width = 30)
zero_width_space = "​"
regex = /.{1,#{max_width}}/
(text.length < max_width) ? text :
text.scan(regex).join(zero_width_space)
end
end
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.