Helperful 0.3.0

March 16th, 2009 at 11:46 pm • permalink0 comments

Last week I released a new minor version of the Helperful GEM. This is essentially a bugfix release, although it comes with one minor new feature: the javascript_content_for tag. The following overview is taken directly from the documentation.

The javascript_content_for helper combines the features of content_for and javascript_tag into a single helper.

1
2
3
<% javascript_content_for :head do %>
$("#id").hide();
<% end %>

The block is passed as it is to javascript_tag, then the result is stored as content_for :head.

Now you can call yield and output your javascript content.

1
2
<%= yield :head %>
<script>$("#id").hide();</script>

This example is equal to the following statements.

1
2
3
4
<% javascript_content_for :head do; javascript_tag do %> $("#id").hide(); <% end; end %>
<% javascript_content_for :head do %>
<script>$("#id").hide();</script>
<% end %>

This feature also addresses an annoying bug in the has_content helper method caused by an undefined variable.

To install or upgrade:

1
gem install weppos-helperful --source http://gems.github.com

More features still to come. Visit the project page for further details.

  1. Helperful: a large collection of Rails Helpers
  2. Ruby on Rails and Canonical link tag
  3. TabsOnRails and Helperful migrated to Gemcutter
  4. TabsOnRails: creating and managing Tabs with Ruby on Rails
  5. BreadcrumbOnRails now open-source

Filed in Programming • Tags: , , , , , ,

Add a Comment




Follow Me
    Random Quote