From 36b7502bb586953f62f56a2c6edd3b22c184702d Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Sat, 31 Jan 2004 14:02:15 +0000 Subject: [PATCH] Make the view page a bit prettier, and link has-a and url links nicely. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@23 48953598-375a-da11-a14b-00016c27c3ee --- templates/factory/edit | 2 +- templates/factory/list | 2 +- templates/factory/list_macros | 22 ---------------------- templates/factory/macros | 34 ++++++++++++++++++++++++++++++++++ templates/factory/view | 35 ++++++++++++++++++----------------- 5 files changed, 54 insertions(+), 41 deletions(-) delete mode 100644 templates/factory/list_macros create mode 100644 templates/factory/macros diff --git a/templates/factory/edit b/templates/factory/edit index 11a2539..712348a 100644 --- a/templates/factory/edit +++ b/templates/factory/edit @@ -1,4 +1,4 @@ -[% PROCESS list_macros %] +[% PROCESS macros %] [% INCLUDE header %] [% FOR item = objects; %] diff --git a/templates/factory/list b/templates/factory/list index 69bb868..5bd6a10 100644 --- a/templates/factory/list +++ b/templates/factory/list @@ -1,4 +1,4 @@ -[% PROCESS list_macros %] +[% PROCESS macros %] [% INCLUDE header %] diff --git a/templates/factory/list_macros b/templates/factory/list_macros deleted file mode 100644 index 0a88996..0000000 --- a/templates/factory/list_macros +++ /dev/null @@ -1,22 +0,0 @@ -[% MACRO display_line(item) BLOCK; - FOR col = classmetadata.columns; - NEXT IF col == "id"; - ""; - "" IF item.$col.moniker; # it's an object - item.$col; - "" IF item.$col.moniker; - ""; - END; - button(item, "edit"); - button(item, "delete"); -END %] -[% MACRO button(obj, action) BLOCK; %] - - -
- -
- -[% END %] - diff --git a/templates/factory/macros b/templates/factory/macros new file mode 100644 index 0000000..b9b8dee --- /dev/null +++ b/templates/factory/macros @@ -0,0 +1,34 @@ +[% MACRO maybe_link_view(object) BLOCK; + IF object.moniker; # It's an object, i.e. a has-a + ""; + object; + ""; + ELSE; + object; + END; +END; +%] + +[% MACRO display_line(item) BLOCK; + FOR col = classmetadata.columns; + NEXT IF col == "id"; + ""; + IF col == "url"; # Possibly too much magic. + " "; item.url; ""; + ELSE; + maybe_link_view(item.$col); + END; + ""; + END; + button(item, "edit"); + button(item, "delete"); +END %] + +[% MACRO button(obj, action) BLOCK; %] + +
+ +
+ +[% END %] + diff --git a/templates/factory/view b/templates/factory/view index 48dec99..861e876 100644 --- a/templates/factory/view +++ b/templates/factory/view @@ -1,26 +1,27 @@ -[% MACRO button(obj, action) BLOCK; %] - - -
- -
- -[% END %] - +[% PROCESS macros %] [% INCLUDE header %] [% FOR item = objects %]

[% item.name %]

-[% FOR col = classmetadata.columns.list; - NEXT IF col == "id"; - "

"; - classmetadata.colnames.$col; ":"; - " "; item.$col;"

"; - END; +[% INCLUDE navbar %] + + +[% + FOR col = classmetadata.columns.list; + NEXT IF col == "id" OR col == "name"; +%] + + + + + +[% END; %] +
[% classmetadata.colnames.$col; %] [% maybe_link_view(item.$col) %]
+[% button(item, "edit"); button(item, "delete"); - ""; -END; %] + +[% END; %] -- 2.39.2