1 |
<%init> |
2 |
my $landscapes = Transports::Model::LandscapeCollection->new(); |
3 |
$landscapes->unlimit; |
4 |
|
5 |
sub admin_link { |
6 |
my ($label, $type, $id) = @_; |
7 |
if (Jifty->web->current_user->admin) { |
8 |
return Jifty->web->link( |
9 |
label => $label, |
10 |
onclick => { |
11 |
replace_with => '/systems/edit', |
12 |
args => { |
13 |
type => $type, |
14 |
id => $id, |
15 |
}, |
16 |
}, |
17 |
); |
18 |
} else { |
19 |
return $label; |
20 |
} |
21 |
} |
22 |
|
23 |
</%init> |
24 |
|
25 |
<div class="outer-landscapes"> |
26 |
|
27 |
% while (my $l = $landscapes->next) { |
28 |
<div class="float-left boxed"> |
29 |
|
30 |
<b><% $l->name %></b> |
31 |
|
32 |
<br/><small> |
33 |
|
34 |
Source systems: |
35 |
<ul> |
36 |
% foreach my $s ( sort { $a->name cmp $b->name } @{$l->sources->items_array_ref} ) { |
37 |
<li><% admin_link( $s->name, 'Source', $s->id ) %></li> |
38 |
% } |
39 |
</ul> |
40 |
|
41 |
Destination systems: |
42 |
<ul> |
43 |
% foreach my $d ( sort { $a->name cmp $b->name } @{$l->destinations->items_array_ref} ) { |
44 |
<li><% admin_link( $d->name, 'Destination', $d->id ) %></li> |
45 |
% } |
46 |
</ul> |
47 |
|
48 |
</small> |
49 |
|
50 |
</div> |
51 |
|
52 |
% } # while |
53 |
|
54 |
</div> |
55 |
|
56 |
Add new: |
57 |
<% admin_link( 'source', 'Source', 0 ) %> |
58 |
<% admin_link( 'destination', 'Destination', 0 ) %> |
59 |
|