Now that I have learned to use cluetip relatively well,

1. I want to congratulate the author for a job really well done.  I am
going to look up his book in the local book-store.

2. I have automated my entire online help system using his Ajax calls
technique and it is working great!  From a Ruby on Rails programmer's
point of view, a few things that I found useful:

 You may want to consider putting in a default call to jQuery cluetip
plugin (along with other plugins) in the application.html.erb as I
show below:

    <script type="text/javascript">
      $(document).ready(function() {
        $("#accordion").accordion({ autoHeight: false, event:
'mouseover' });
        $(".tip").cluetip( {width: 650, sticky: true, closePosition:
'title', arrows: true} );
      });
    </script>

This will apply to ALL views until you override it (or have to
override it).

The next tip is more subtle:  I had sidebar help which was working
perfect EXCEPT under certain conditions and through some detective
work, I found that it had to do with my Rails Routing which was
affecting the cluetip's "rel" attribute value.  Specifically, the
level of depth that you are at will affect cluetip's ability to locate
the help file correctly.  Here is a code snippet from the sidebar
partial:

    <% rel_path = (controller.action_name == 'index' ? '' : '../../')
+ 'images/xxx.jpg' %>
    <% image_str = link_to("Some Image", {},
         {:class => "tip", :title => "Some Image", :rel => rel_path})
%>

See the rel_path variable above?  If we are at a point where the
default action "index" is used for any controller then  a value such
as "images/xxx.jpg" will cause Rails to look into the images directory
off its document root which is the "public" directory.  However, if
you are deep within a specific action of a controller such as
http://localhost:3000/client/edit/3 which means edit action of
clients_controller for specific client number 3, then you have to give
it a prefix to start two levels below as I show above.  This was
driving me crazy until I looked at the logs more closely and found
that cluetip could not locate the correct file because of the Rails
Route specifics.

Again, these tips are Rails specific, but I suspect that a number of
Rails programmers like me are using jQuery/cluetip and they may find
it useful.

Bharat

Reply via email to