0x07: More bodywork

Now, last monday I promised to rework the bodywork code into a plugin, “tested and all”. Some clashes with git later I finally managed to push it to github, you’ll find it at github. It even comes with a nice and cute README file, so head over and check it out.

Here I want to ask you, dear reader, for your praised input. As you might know, this is the proposed ‘with_bodywork’ usage:

class BlaController < ApplicationController

  def index
    render :layout => "web", :text => "This is some text."

  # This adds the bodywork methods to the current controller.  
  # An after_filter which uses some of the bodywork methods
  # on all actions
  after_filter :add_somefunkystuff

  def add_somefunkystuff
    link_to_file "some_app.js"    # add some JS file to the header
    link_to_file "some_app.css"   # add some CSS to the header

                                  # add some stuff to the HTML body
    append_html "<p>This page is dignified with some bodywork.</p>"

This looks a bit chatty to me. Does any of you has any idea about a more concise syntax here?

Shameless self-ad: At github you find some other plugins by yours truly – check it out if you like. But note that the with_profiler, with_query_stats, and with_urchin_tracker might get moved into with_bodywork during the next weeks.

Well, just watch out. Next week you’ll find fresh code again here!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s