make table cells clickable with hyperlink callback
This commit is contained in:
@@ -35,11 +35,15 @@ ajax '/ajax/content/search/vlan' => sub {
|
||||
results => $set,
|
||||
columns => [
|
||||
{ key => 'dns', label => 'Device' },
|
||||
{ key => [qw/vlan description/], label => 'Description' },
|
||||
{ key => 'vlan.description', label => 'Description' },
|
||||
{ key => 'model', label => 'Model' },
|
||||
{ key => 'os', label => 'OS' },
|
||||
{ key => 'vendor', label => 'Vendor' },
|
||||
],
|
||||
hyperlink => sub {
|
||||
my $row = shift;
|
||||
return '/device?q=' . $row->ip;
|
||||
},
|
||||
}, { layout => undef };
|
||||
};
|
||||
|
||||
|
||||
@@ -32,3 +32,11 @@
|
||||
.nd_search {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.nd_linkcell {
|
||||
text-decoration: none !important;
|
||||
color: #404040;
|
||||
display: block;
|
||||
padding: 0px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
<tr>
|
||||
[% FOREACH col IN columns %]
|
||||
[% SET val = row %]
|
||||
[% FOREACH method IN col.key %]
|
||||
[% FOREACH method IN col.key.split('\.') %]
|
||||
[% SET val = val.$method %]
|
||||
[% END %]
|
||||
<td>[% val %]</td>
|
||||
<td><a class="nd_linkcell" href="[% hyperlink(row) %]">[% val %]</a></td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
Reference in New Issue
Block a user