From: Allen Day Date: Fri, 2 Jan 2004 19:53:40 +0000 (+0000) Subject: factored out more styles to css. atom macros are now focus-aware. X-Git-Tag: v0.06~242 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c01582e98c07af668221691e11da0cae9700db50;p=dbsrgits%2FSQL-Translator.git factored out more styles to css. atom macros are now focus-aware. --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index 529c004..45b312c 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::Turnkey; # ------------------------------------------------------------------- -# $Id: Turnkey.pm,v 1.15 2004-01-02 10:04:37 allenday Exp $ +# $Id: Turnkey.pm,v 1.16 2004-01-02 19:53:40 allenday Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Allen Day , # Brian O'Connor . @@ -23,7 +23,7 @@ package SQL::Translator::Producer::Turnkey; use strict; use vars qw[ $VERSION $DEBUG ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.16 $ =~ /(\d+)\.(\d+)/; $DEBUG = 1 unless defined $DEBUG; use SQL::Translator::Schema::Constants; @@ -373,9 +373,11 @@ sub can_render { sub render { my $self = shift; my $dbobject = shift; - # Assumption here that if it's not rendering on it's own dbobject - # then it's a list. This will be updated when AtomLists are implemented -boconnor + + # Assumption here that if it's not rendering on it's own dbobject + # then it's a list. This will be updated when AtomLists are implemented -boconnor if(ref($dbobject) eq 'Turnkey::Model::[% pname %]') { + $self->focus('yes'); return(_render_record($dbobject)); } else { return(_render_list($dbobject)); } @@ -410,28 +412,27 @@ sub _render_list { my $dbobject = shift; my @output = (); my @objects = $dbobject->[% node.key %]s; - foreach my $object (@objects) - { + foreach my $object (@objects){ my $row = {}; - my $field_hash = {}; + my $field_hash = {}; - #data + #data [% FOREACH value = node.value.data_fields %] [% IF value != 1 %] - $field_hash->{[% value %]} = $object->[% value %](); + $field_hash->{[% value %]} = $object->[% value %](); [% END %] [% END %] - #keys - [% FOREACH value = node.value.edges %] - [% NEXT IF value.type != 'import' %] - $field_hash->{[% value.thisfield.name %]} = $dbobject->[% value.thisfield.name %](); - [% END %] + #keys + [% FOREACH value = node.value.edges %] + [% NEXT IF value.type != 'import' %] + $field_hash->{[% value.thisfield.name %]} = $object->[% value.thisfield.name %](); + [% END %] $row->{data} = $field_hash; - $row->{id} = $object->id(); - push @output, $row; - } + $row->{id} = $object->id(); + push @output, $row; + } return(\@output); } @@ -588,7 +589,7 @@ EOF [- FOREACH node = nodes -] [- IF !node.value.is_trivial_link -] [% CASE '[- node.key FILTER ucfirst -]' %] - [% render[- node.key FILTER ucfirst -]Atom(atom.render(dbobject)) %] + [% render[- node.key FILTER ucfirst -]Atom(atom,dbobject) %] [- END -] [- END -] [% CASE DEFAULT %] @@ -596,7 +597,10 @@ EOF [% END %] [- FOREACH node = nodes -] [- IF !node.value.is_trivial_link -] -[% MACRO render[- node.key FILTER ucfirst -]Atom(lstArr) BLOCK %] +[% MACRO render[- node.key FILTER ucfirst -]Atom(atom, dbobject) BLOCK %] + [% lstArr = atom.render(dbobject) %] + [% rowcount = 0 %] + [% IF atom.focus == "yes" %] [% FOREACH record = lstArr %] [% fields = record.data %] [- pname = node.key FILTER ucfirst -] @@ -611,7 +615,18 @@ EOF [- field.thisfield.name -][% obj2link(fields.[- field.thisfield.name -]) %] [- END -] [% id = record.id %] - Link
+ [% IF (rowcount > 1) %]
[% END %] + [% rowcount = rowcount + 1 %] + [% END %] + [% ELSE %] +
    + [% FOREACH record = lstArr %] + [% class = ref(atom) | replace('::Atom::', '::Model::') %] + [% id = record.id %] + [% PROCESS make_linked_dbobject %] +
  • [% obj2link(linked_dbobject) %]
  • + [% END %] +
[% END %] [% END %] [- END -] @@ -622,7 +637,7 @@ EOF [% class = ref(atom) | replace('::Atom::', '::Model::') %] [% id = item.id %] [% PROCESS make_linked_dbobject %] -
  • [% obj2link(linked_dbobject) %]
  • +
  • [% obj2link(linked_dbobject) %]
  • [% END %] [% END %]