X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2Ftemplates%2Ffactory%2Fmacros;h=ce9d0e1d3e837944885b63541dc829d834b1c676;hb=2af3091e4954c080708cb08eb3c72d52416f9ca1;hp=cbf58bb21902fd0b1f80a907190363aa184ecf1b;hpb=a02686080acb66fce170e9657e110761b09e62a2;p=maypole.git diff --git a/lib/Maypole/templates/factory/macros b/lib/Maypole/templates/factory/macros index cbf58bb..ce9d0e1 100644 --- a/lib/Maypole/templates/factory/macros +++ b/lib/Maypole/templates/factory/macros @@ -56,15 +56,19 @@ for some. [% MACRO display_line(item) BLOCK; FOR col = classmetadata.list_columns; NEXT IF col == "id" OR col == classmetadata.table _ "_id"; + col_obj = item.find_column(col); ""; IF col == "url" AND item.url; ' '; item.url; ''; ELSIF col == classmetadata.stringify_column; maybe_link_view(item); - ELSE; - accessor = item.accessor_name(col); + ELSIF col_obj; # its a real column + accessor = item.accessor_name_for(col_obj) || item.accessor_name(col_obj); # deprecated in cdbi maybe_link_view(item.$accessor); + ELSE; + item.$col; END; + ""; END; ''; @@ -133,7 +137,7 @@ This takes an object and and displays its properties in a table. [% INCLUDE navbar %] - + [% FOR col = classmetadata.columns.list; @@ -149,11 +153,18 @@ from the C method: #%] - +
[% classmetadata.colnames.$string %][% classmetadata.colnames.$string %] [% item.$string | html %]
[% classmetadata.colnames.$col; %][% classmetadata.colnames.$col || + col | ucfirst | replace('_',' '); %] [% IF col == "url" && item.url; # Possibly too much magic. ' '; item.url; ''; + ELSIF item.$col.size > 1; # has_many column + FOR thing IN item.$col; + maybe_link_view(thing);", "; + END; + ELSE; + maybe_link_view(item.$col); END; %] [%#