Git Ur Radiant Extensions

written by nap on March 5th, 2008 @ 04:11 PM

I published a new Radiant extension yesterday: Database Form. It provides a new page type and tags for constructing contact and request info forms and will save user responses to a database table. Those responses can then be exported for use in another application (CRM, etc). See the README for usage and examples. It was extracted from some client work that we'll be deploying soon.

If this sounds good, you can download or clone it from GitHub. While you're there, spend a few minutes poking around; GitHub is pretty dang cool. They've definitely succeeded in making Git repository hosting stupid simple. Just click a button to create a project, follow a few commands on your local system to import your sources, and you're off and running. You can then view the repo history, browse the source, see diffs, download a tarball (for easy extension installation in your pre-existing Radiant project), and fork it if you want to add your own features. That's where things get sweet, of course: Fork the project, make some changes, and send me a pull request so we can merge them into the master branch. All this is possible without GitHub, but it sure does a swell job of streamlining things and abstracting the suck away.

It also exposes the links between developers and their project contributions in a pretty cool way. See the DataMapper project's "network" page to see what I'm talking about. Ryan Tomayko has pointed out that this sort of interaction starts to smell an awful lot like a MySpace for developers, where lines in the social graph are drawn based on OSS project work. Wow, that's a cool thought, ain't it?

Comments

  • Al Chou on 18 May 19:57

    I started playing with this extension because of the form validation stuff; I recommend adding to the README for radio buttons, given that I've spent hours figuring out how to get the validate='validate-one-required' attribute to work on those.

    First, I'm greatly surprised that despite what Andrew says about how to use this particular validation at http://www.tetlaw.id.au/view/javascript/really-easy-field-validation , it turns out not to be necessary to have an element wrap the group of radio buttons (even though I spent some time adding a bit of code to databaseform/app/models/databaseform_page.rb to generate such a wrapping div, which also worked).

    Anyway, the key to using validate='validate-one-required' is to put this attribute on just one out of the group of radio elements. As Andrew recommends, I put it on the last one in the group.

    In case you care about the code I added to generate a div to wrap the group of radio buttons generated by a radiogroup tag, here it is (hopefully Textile will be kind to the formatting):

    
        tag 'database:radiogroup' do |tag|
          @tag_attr = tag.attr.symbolize_keys
          raise_error_if_name_missing("database:radiogroup")
          tag.locals.parent_tag_name = tag_attr[:name]
          tag.locals.parent_tag_type = 'radiogroup'
          +tag_attr[:class] = tag.locals.parent_tag_type+
          +results = %Q(
    )+ -tag.expand- +results << tag.expand+ +results << '
    '+ end
  • nap on 20 May 14:05

    @al Why don't you fork the repo on github and send me a pull request? I'll be more than happy to merge it in!

    I do have some updates in mind for this extension but have been slammed with work lately... I'll clean up the README when I have a few moments (or feel free to do it and send another pull request, wink wink!)

    For everyone else, there's also been some good discussion about form extensions on the radiant dev list lately.. Make sure to check that out.

  • Al Chou on 21 May 00:50

    Good idea. I'm so new to git, I hadn't thought of that. I'll try to do both of these soon.

Post a comment