Ruby On Rails, Design, Simplicity, Web 2.0, Ajax, Mac and Tons of Pizza.

Jun 20

Streamlined 1.0 hacks: add help text to forms.

Posted by Sandro Paganotti in Ruby on Rails - 1 comment digg this add to delicious

I’ve created a small Streamlined hack that let you implement a :help option while defining ‘user columns’, here’s a sample:


                :title,                 {
                                          :human_name   => "Book title",
                                          :help         => "Please specify the title of the book you're reading." 
                                        }

and this is the result (for ‘edit’ and ‘new’ views):

Instructions:

Here you’ll find what to change in the plugin:


#  in /lib/streamlined/column/base.rb 

# around line 9
attr_accessor :human_name, :link_to, :popup, :parent_model, :wrapper, :additional_column_pairs,
                :additional_includes, :filter_column, :help

# around line 196
      x.td(:class => 'sl_edit_value') do
        x << render_td(view, item)
        if(!help.nil?)
          x.p{ x << help }
        end  
      end 

Hope you’ll find useful.

Sandro

Comments

  • Matthew Bass

    Posted on June 24

    Good enhancement, Sandro. I've incorporated it into the edge version of Streamlined.

Post a comment

Categories:

Tags:

Powered by Mephisto, Valid XHTML 1.1, Valid CSS - Supported by Wave Factory