Improved Feedback list page
This commit is contained in:
parent
4beb26a0a4
commit
c3519fa4df
5 changed files with 61 additions and 8 deletions
18
lib/Pear/LocalLoop/Plugin/TemplateHelpers.pm
Normal file
18
lib/Pear/LocalLoop/Plugin/TemplateHelpers.pm
Normal file
|
@ -0,0 +1,18 @@
|
|||
package Pear::LocalLoop::Plugin::TemplateHelpers;
|
||||
use Mojo::Base 'Mojolicious::Plugin';
|
||||
|
||||
sub register {
|
||||
my ( $plugin, $app, $conf ) = @_;
|
||||
|
||||
$app->helper( truncate_text => sub {
|
||||
my ( $c, $string, $length ) = @_;
|
||||
if ( length $string < $length ) {
|
||||
return $string;
|
||||
} else {
|
||||
return substr( $string, 0, $length - 3 ) . '...';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
1;
|
Reference in a new issue