2008-11-25 11:01:42 +00:00
|
|
|
package Hydra::View::TT;
|
2008-10-28 10:19:31 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
use base 'Catalyst::View::TT';
|
2013-01-22 21:48:02 +00:00
|
|
|
use Hydra::Helper::Nix;
|
2008-10-28 10:19:31 +00:00
|
|
|
|
2013-01-22 21:48:02 +00:00
|
|
|
__PACKAGE__->config(
|
|
|
|
TEMPLATE_EXTENSION => '.tt',
|
2013-02-05 13:00:09 +00:00
|
|
|
PRE_CHOMP => 1,
|
|
|
|
POST_CHOMP => 1,
|
2013-04-26 11:23:34 +00:00
|
|
|
expose_methods => [qw/log_exists ellipsize/]);
|
2013-01-22 21:48:02 +00:00
|
|
|
|
|
|
|
sub log_exists {
|
|
|
|
my ($self, $c, $drvPath) = @_;
|
|
|
|
my $x = getDrvLogPath($drvPath);
|
|
|
|
return defined $x;
|
|
|
|
}
|
2008-10-28 10:19:31 +00:00
|
|
|
|
2013-04-26 11:23:34 +00:00
|
|
|
sub ellipsize {
|
|
|
|
my ($self, $c, $s, $n) = @_;
|
|
|
|
return length $s <= $n ? $s : substr($s, 0, $n - 3) . "...";
|
|
|
|
}
|
|
|
|
|
2008-10-28 10:19:31 +00:00
|
|
|
1;
|