-[% PROCESS list_macros %]
+[% PROCESS macros %]
[% INCLUDE header %]
[% FOR item = objects; %]
-[% PROCESS list_macros %]
+[% PROCESS macros %]
[% INCLUDE header %]
+++ /dev/null
-[% MACRO display_line(item) BLOCK;
- FOR col = classmetadata.columns;
- NEXT IF col == "id";
- "<td>";
- "<A HREF='" _ base _ item.$col.moniker _ "/view/" _
- item.$col.id _"'>" IF item.$col.moniker; # it's an object
- item.$col;
- "</A>" IF item.$col.moniker;
- "</td>";
- END;
- button(item, "edit");
- button(item, "delete");
-END %]
-[% MACRO button(obj, action) BLOCK; %]
-
-<TD>
-<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/[%action%]/[%obj.id%]">
- <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
-</FORM>
-</TD>
-[% END %]
-
--- /dev/null
+[% MACRO maybe_link_view(object) BLOCK;
+ IF object.moniker; # It's an object, i.e. a has-a
+ "<A HREF='" _ base _ object.moniker _ "/view/" _ object.id _"'>";
+ object;
+ "</A>";
+ ELSE;
+ object;
+ END;
+END;
+%]
+
+[% MACRO display_line(item) BLOCK;
+ FOR col = classmetadata.columns;
+ NEXT IF col == "id";
+ "<td>";
+ IF col == "url"; # Possibly too much magic.
+ "<A HREF="; item.url; "> "; item.url; "</A>";
+ ELSE;
+ maybe_link_view(item.$col);
+ END;
+ "</td>";
+ END;
+ button(item, "edit");
+ button(item, "delete");
+END %]
+
+[% MACRO button(obj, action) BLOCK; %]
+<TD>
+<FORM METHOD="post" ACTION="[%base%]/[%obj.moniker%]/[%action%]/[%obj.id%]">
+ <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
+</FORM>
+</TD>
+[% END %]
+
-[% MACRO button(obj, action) BLOCK; %]
-
-<TD>
-<FORM METHOD="post" ACTION="[%base%]/[%classmetadata.moniker%]/[%action%]/[%obj.id%]">
- <INPUT TYPE="submit" NAME="[%action%]" VALUE="[%action%]">
-</FORM>
-</TD>
-[% END %]
-
+[% PROCESS macros %]
[% INCLUDE header %]
[% FOR item = objects %]
<h2> [% item.name %]</h2>
-[% FOR col = classmetadata.columns.list;
- NEXT IF col == "id";
- "<P>";
- classmetadata.colnames.$col; ":";
- " "; item.$col;"</p>";
- END;
+[% INCLUDE navbar %]
+
+<TABLE class="view">
+[%
+ FOR col = classmetadata.columns.list;
+ NEXT IF col == "id" OR col == "name";
+%]
+
+<TR>
+ <TD class="field"> [% classmetadata.colnames.$col; %] </TD>
+ <TD> [% maybe_link_view(item.$col) %] </TD>
+</TR>
+[% END; %]
+</TABLE>
+[%
button(item, "edit");
button(item, "delete");
- "</tr>";
-END;
%]
+</TABLE>
+[% END; %]