Displaying 20 results from an estimated 80000 matches similar to: "A not so simple simple_format helper"
2009 Feb 24
2
Displaying line breaks & paragraphs using 'simple_format' ?
Hi there,
I need to:
1. STORE a text of the below format in a (MySQL) database (using a
''textarea''), and then
2. RETRIEVE & DISPLAY it in exactly the same format (meaning: keeping
all paragraphs/line breaks).
The intended text format looks like this:
***
Blah blahblah blah blah blahblah blah blah
blahblah blah blah blahblah blah, blah
blahblah. <- NEW
2009 Mar 26
0
reverse of simple_format?
Hello!
Is there a way to reverse the TextHelper simple_format? I.e. to take
some text with <p> tags and <br> tags and convert them into line
breaks in a smart way? (smarter than just a regexp that is).
TIA!
-Danimal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2006 Feb 09
0
Weird simple_format behavior
I''m working on a page combining Ajax.InPlaceEditor and the
simple_format helper. The page is demonstrating some very strage
behavior. First, here is the code:
<p>Bio: </p>
<div id="bio">
<% if @user.bio %>
<%= simple_format( @user.bio ) %>\
<% else %>
No Bio Yet
<% end %>
</div><em>(click on your to bio edit
2008 May 29
4
ruby's simple_format method is not working for spaces.
Ruby''s simple_format method is not working for spaces. so how to add and
what to add in simple format method code so it also work for spaces?
--
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
2008 Jul 26
4
simple_format, (long) urls, and wrapping
I''m using simple_format to format and display posted content from
users. This content sometimes has urls in it.
The problem I''m having is that if the urls are long enough to wrap,
they do, but the url gets split with a <br> tag. Then, if the user
clicks on the link, only the first, non-wrapped part of the link gets
posted to the browser... and that''s an invalid
2006 Jan 04
2
simple_format and in_place_editor_field
Hi!
How can i do to force an in_place_editor_field to format the text with
simple_format while not editing?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060104/bbd141a2/attachment.html
2007 Jan 16
2
Using view helpers in migrations?
I''m writing a bloggish/CMSish thing. I had been using simple_format,
but my users requested a rich editor, so I added TinyMCE.
Anyway, I was trying to migrate the existing content (since TinyMCE
assumes it''s reading HTML-formatted text), and realized that I
couldn''t call simple_format (or other helper methods) from Migrations.
Can someone enlighten me here?
2006 Mar 15
4
RJS template eating encoding
I was previously doing an update via .rhtml templates creating an AJAX
:evaluate_remote_response. I use UTF-8 in my pages, and my app
requires that I be able to, say, put Japanese characters in.
The problem is that when I switched this over to an RJS template it
started eating the encoding. I now get garbage characters where before
I got the correct ones.
The code for the RHTML:
<%=
2006 Oct 29
1
:with for observe_field helper--parameter passing
I am trying to write a :with hash for the observe_field helper watching
a select which was built by select_month--it contains all of the months.
The current :with that I have, which works, is:
:with => "month"
,which passes the updated month in the select through params[:month].
However, I need to pass the current year through params[:year], which
does not change when the month
2006 Mar 01
0
TextHelpers in Controller?
I have a controller that saves info to the DB. It''s based on the AJAX
scaffolding code. All I want to do is add a simple_format() function to
it before I save a user-edited text field to the DB. TO convert line
returns to <br>s, etc.
@project_note = ProjectNote.new(params[:project_note])
@project_note.body = simple_format(@project_note.body)
Since this happens in a controller,
2010 Sep 24
0
Rails 3, using helpers in controller
Hi everyone,
is there any way how to use Helpers in Controllers in Rails 3? I was
trying to google about it, but no luck.
In old Rails times (2.x) we were using something like this.
my_active_record_object.variable = "This is the message body:<br /><br
/> #{@template.simple_format(params["message"])}"
point is that when we wanted to attach text from Text Area to
2008 Jul 19
5
helper functions permanently altering variables
Greetings,
I''m not sure if I''m maybe not understanding the helper functions
correctly, but I''m having a weird problem that seems like it shouldn''t
be. I''m sanitizing some book names for url''s using my application
helper:
-- application helper
def format_url(url)
title = url
clean_string(title)
truncate(@title, 100, "")
2006 Mar 30
2
How do I format text before saving it?
I tried to use a before_save and use simple_format, it returns and
undefined method error. Can I even use these methods within a model? I
tried to use auto_link and it failed too. What am I doing wrong?
Furthermore, would it be recommended I format text before saving it to
the database? Advantages or disadvantages?
--
Posted via http://www.ruby-forum.com/.
2009 Jan 18
3
ActionMailer and url_for in helper methods
Hi,
I was wondering how to get url_for to work inside ActionMailer. I did
research on the web but I can''t seem to find something that fits what I
need.
In my application, each user can specify their custom domain to access
their. I have an ActionMailer that sends them notifications of changes
that occur. In there, I have a breadcrumbs helper method, which
generages something like:
2008 May 23
0
R(c,*g) helper method can''t handle nested hash input params
params= {"search"=>"Search",
"date_begin"=>"2007-05-01",
"date_type"=>"created_on",
"order"=>1,
"report_type"=>"year_end",
"person"=>
{"reply_status_id"=>"1",
"created_on"=>
Tue, 01 May 2007 00:00:00 +0000..Fri, 23 May 2008
2008 Oct 29
1
using text helper in a model class
Hi,
I have refactored my code and the previous function in my controller
help.truncate() doesn''t seems to work anymore in my model.
My model class is generating files and I''d like to use this text helper.
How can I fix that?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2007 Oct 06
4
Passing ERB block to helper
I''m trying to pass an ERB block to a helper, and I''m not able to achieve
the results I want. The helper should take the block and incorporate it
into some other text & html, before finally outputing it back to the ERB
template.
Here''s what I want:
--helper--
def helper (a, b)
yld = yield
out = --some function of a, b, and yld--
out
end
--ERB--
<%
2007 Jul 20
4
the value in text_field helper
I have been working on this small, minute, part on my project and it all
hinges on setting the value in a text_field helper. Saying:
<%= text_field ''user'', ''company'', :value => @login %>
does not do it. When I go and look at the raw html, there is no value
there and "value" is an attribute of the input tag, im pretty sure. I
really like
2008 Feb 29
4
App design question: user_photo helper
I''m having trouble using an application helper and understanding how I
should make it work throughout my application - so if you can help me
with this I''ll be overcoming a big hurdle in my learning.
Here''s the helper method;
[code=]# application_helper.rb
def user_photo
if @user.photo?
return @user.photo.public_filename(:thumb)
else
return
2006 Mar 22
3
Which JavaScript effect is this?
http://canadaonrails.com/ (when you hover over news and events)
I''ve seen this implemented on a few rails sites now and I was just
wondering if it is just a simple javascript from the prototype library.
Does anybody know of any links on how to do this?
Thanks in advance!
--
Posted via http://www.ruby-forum.com/.