]> iEval git - plack-app-gruntmaster.git/commitdiff
Sort user list by name and exclude users with empty names
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 20 Jan 2014 21:30:07 +0000 (23:30 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 20 Jan 2014 21:30:07 +0000 (23:30 +0200)
lib/Gruntmaster/Page/Us.pm

index 2095fd55aaf0963b1511b60bdaa0b394d4712b26..0a2e78a953d0088b6976f0b799580a14c2bb58a7 100644 (file)
@@ -9,15 +9,17 @@ our $VERSION = '0.001';
 
 use constant TEMPLATES => {
        en => <<'HTML',
-<ul><tmpl_loop users><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
-</tmpl_loop></ul>
+<ol><tmpl_loop users><li><a href="<tmpl_var id>.var"><tmpl_var name></a>
+</tmpl_loop></ol>
 HTML
 };
 
 sub _generate{
        my ($self, $htc, $path, $lang) = @_;
 
-       $htc->param(users => [ map { {id => $_, name => user_name} } users ]);
+       $htc->param(users => [ sort { lc $a->{name} cmp lc $b->{name} }
+                                                        map { {id => $_, name => user_name} }
+                                                          grep { user_name =~ /\w/ } users ]);
 }
 
 1
This page took 0.026799 seconds and 4 git commands to generate.