Ellipsize long jobset/job names to prevent bootstrap navbar breakage

This commit is contained in:
Eelco Dolstra 2013-04-26 13:23:34 +02:00
parent fd7acd9bbf
commit 71eaa115f8
2 changed files with 8 additions and 3 deletions

View file

@ -8,7 +8,7 @@ __PACKAGE__->config(
TEMPLATE_EXTENSION => '.tt', TEMPLATE_EXTENSION => '.tt',
PRE_CHOMP => 1, PRE_CHOMP => 1,
POST_CHOMP => 1, POST_CHOMP => 1,
expose_methods => [qw/log_exists/]); expose_methods => [qw/log_exists ellipsize/]);
sub log_exists { sub log_exists {
my ($self, $c, $drvPath) = @_; my ($self, $c, $drvPath) = @_;
@ -16,4 +16,9 @@ sub log_exists {
return defined $x; return defined $x;
} }
sub ellipsize {
my ($self, $c, $s, $n) = @_;
return length $s <= $n ? $s : substr($s, 0, $n - 3) . "...";
}
1; 1;

View file

@ -61,7 +61,7 @@
[% END %] [% END %]
[% IF jobset %] [% IF jobset %]
[% WRAPPER makeSubMenu title=("Jobset: " _ jobset.name) %] [% WRAPPER makeSubMenu title=("Jobset: " _ ellipsize(jobset.name, 30)) %]
[% INCLUDE makeLink [% INCLUDE makeLink
uri = c.uri_for(c.controller('Jobset').action_for('index'), [project.name, jobset.name]) uri = c.uri_for(c.controller('Jobset').action_for('index'), [project.name, jobset.name])
title = "Overview" %] title = "Overview" %]
@ -109,7 +109,7 @@
[% END %] [% END %]
[% IF job %] [% IF job %]
[% WRAPPER makeSubMenu title=("Job: " _ job.name) %] [% WRAPPER makeSubMenu title=("Job: " _ ellipsize(job.name, 30)) %]
[% INCLUDE makeLink [% INCLUDE makeLink
uri = c.uri_for(c.controller('Job').action_for('overview'), [project.name, jobset.name, job.name]) uri = c.uri_for(c.controller('Job').action_for('overview'), [project.name, jobset.name, job.name])
title = "Overview" %] title = "Overview" %]