70 |
} |
} |
71 |
}; |
}; |
72 |
|
|
73 |
|
template '/index.html' => page { |
74 |
|
my $units = Arh::Model::UnitCollection->new; |
75 |
|
$units->unlimit; |
76 |
|
$units->order_by( column => 'id', order => 'DESC' ); |
77 |
|
|
78 |
|
my $last = get('last') || 15; |
79 |
|
|
80 |
|
h1 { _("Last %1 units entered", $last) }; |
81 |
|
|
82 |
|
ol { |
83 |
|
class is 'units'; |
84 |
|
for ( 1 .. $last ) { |
85 |
|
my $unit = $units->next || last; |
86 |
|
li { |
87 |
|
outs( $unit->name, ' ' ); |
88 |
|
hyperlink( |
89 |
|
label => $unit->unit_id, |
90 |
|
url => '/units/single?id=' . $unit->id, |
91 |
|
); |
92 |
|
span { class is 'unit details'; |
93 |
|
outs join(', ', grep(defined($_), |
94 |
|
$unit->subcategory, |
95 |
|
$unit->category->name, |
96 |
|
$unit->location->name, |
97 |
|
$unit->site->name, |
98 |
|
)); |
99 |
|
} |
100 |
|
} |
101 |
|
} |
102 |
|
} |
103 |
|
|
104 |
|
}; |
105 |
|
|
106 |
1; |
1; |