[Catalyst] InstantCRUD issues

Lars Balker Rasmussen lars at balker.dk
Sun Jul 2 11:50:45 CEST 2006


On Sun, Jul 02, 2006 at 11:41:01AM +0200, Kaare Rasmussen wrote:
> I have run into a couple of issues when using InstantCRUD for a project.
> 
> 1. Edit/Add fields unaligned
> When editing or adding a field, they are not aligned under each other, making 
> it both look ugly and harder to process. I found two things wrong with it. 
> The easy problem is that _build_widget doesn't insert a <br> tag for each 
> label/field pair. I think it should, at least it makes for an easier css.
> The hard problem is that HTML::Widget incloses _both_ the label and the field 
> ind <label></label> tags. And it's even documented in HTML..Widgets POD. I 
> can't see why it should, but perhaps someone more familiar with the module 
> do?
> I had a short chat with Zbigniew Lukasiak about this, who told that there's 
> supposed to be a HTML::Widget specific css around somewhere but he doesn't 
> like it because it doesn't allow for aligning error messages correct.
> 
> From anyones experience, can I make HTML::Widget do what I want in an 
> InstantCRUD environment, limit the <label></label> to the actual label of the 
> field?

It's not impossible to style, but it is a problem.  People have suggested 
XSLT to convert the generated html into something sane.

> 2. Relationship dropdowns.
> _build_widget tries to build a dropdown if it recognises a relationship. This 
> is a very nice idea, but as it doesn't know which column in the related table 
> to use, it just returns a stringified hash of it all. So this feature doesn't 
> seem finished.
> 
> I'm thinking that it could be solved easy if it is possible to add custom 
> properties to the table's class, so _build_widget could pick up the wanted 
> column from there. I dont' think DBIC can do that, though, at least I 
> couldn't find the possibility.

You need to tell the model classes how to stringify, eg:

    use overload '""' => sub { shift->name }, fallback=> 1;
-- 
Lars Balker Rasmussen                                        Consult::Perl



More information about the Catalyst mailing list