On Sunday, February 19, 2012 10:00:00 AM UTC-7, Walter Lee Davis wrote:
On Feb 19, 2012, at 2:11 AM, Don wrote:

I have limited screen space for a table that I'm displaying, so I'm
showing a truncated view of a description field:
<td><%= simple_format car.description.truncate(200, :separator => ' ') %></td>
I need a mouse over or click event to generate a simple pop up window
(an "alert", a "tool tip", a "dialog", etc.) displaying the full contents
of the car.description field.
Is there some very, very simple way to have JS pop up the text held in a
Rails field?

If you use the Title attribute on the shortened example, you could get a
poor-man's popup for free:

<td><span class="more" title="<%=simple_format car.description %>"><%=
simple_format car.description.truncate(200, :separator => ' ')

Then you could layer over that some JavaScript to pull the title content
into a rich popup if you like. But all alone, this will give you an
accessible solution with minimal code. If you added some CSS to the .more
class, you could change the cursor on mouseover to clue the user, or add
some color or underline to make it really apparent.

Walter - this is a perfect work-around; thanks for the great idea. I'll
use it in the short term, until I can figure out my real issue. There is
something very basic that I'm not getting/finding. How do I access JS
libraries for enhancing my UI from within a html.erb view? If you can
point me to any resources or code examples that would be great.


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/wL8PsmDE3t0J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 8 | next ›
Discussion Overview
grouprubyonrails-talk @
postedFeb 19, '12 at 7:11a
activeFeb 20, '12 at 2:49p



site design / logo © 2022 Grokbase