--- lib/Arh/View.pm 2008/04/08 23:22:22 67 +++ lib/Arh/View.pm 2008/04/19 21:36:07 78 @@ -70,4 +70,37 @@ } }; +template '/index.html' => page { + my $units = Arh::Model::UnitCollection->new; + $units->unlimit; + $units->order_by( column => 'id', order => 'DESC' ); + + my $last = get('last') || 15; + + h1 { _("Last %1 units entered", $last) }; + + ol { + class is 'units'; + for ( 1 .. $last ) { + my $unit = $units->next || last; + li { + outs( $unit->name, ' ' ); + hyperlink( + label => $unit->unit_id, + url => '/units/single?id=' . $unit->id, + ); + span { class is 'unit details'; + outs join(', ', grep(defined($_), + $unit->subcategory, + $unit->category->name, + $unit->location->name, + $unit->site->name, + )); + } + } + } + } + +}; + 1;