The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

display_line

display_line is used in the list template to display a row from the database, by iterating over the columns and displaying the data for each column. It misses out the id column by default, and magically URLifies columns called url. This may be considered too much magic for some.

</%doc> <%args> $item </%args>

% foreach my $col ( @{ $classmetadata->{columns} } ) { % next if $col eq "id"; <td> % if ( $col eq "url" && $item->url ) { <a href="<% $item->url %>"><% $item->url %></a> % } elsif ( $col eq $item->stringify_column ) { <& maybe_link_view, object => $item &> % } else { <& maybe_link_view, object => $item->$col &> % } </td> % }

<td class="actions"> <& button, obj => $item, action => "edit" &> <& button, obj => $item, action => "delete" &> </td>