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." end private # # This adds the bodywork methods to the current controller. with_bodywork # # 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>" end end
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!