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