X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FPage%2FUs.pm;h=0a2e78a953d0088b6976f0b799580a14c2bb58a7;hb=0b282e58119cc0dbce678ef56eab20cc352557b5;hp=2c87916aa7075f99ec4c4596f1edd9861ef457ac;hpb=4aa8ba862bf3a79362df73c3d1e8707e8135af23;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Page/Us.pm b/lib/Gruntmaster/Page/Us.pm index 2c87916..0a2e78a 100644 --- a/lib/Gruntmaster/Page/Us.pm +++ b/lib/Gruntmaster/Page/Us.pm @@ -3,29 +3,23 @@ package Gruntmaster::Page::Us; use 5.014000; use strict; use warnings; -use parent qw/Exporter/; -our @EXPORT_OK = qw/generate/; +use Gruntmaster::Page::Base us => 'Users'; +our @ISA = qw/Gruntmaster::Page::Base/; our $VERSION = '0.001'; -use HTML::Template::Compiled; -use Gruntmaster::Data qw/users user_name/; -use Gruntmaster::Page::Common qw/cook_templates reload_templates/; - -my %orig_templates = ( +use constant TEMPLATES => { en => <<'HTML', - +
  1. +
HTML -); - -my %templates = cook_templates %orig_templates, us => 'Users'; +}; -sub generate{ - %templates = cook_templates %orig_templates, us => 'Users' if reload_templates; - my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]}); +sub _generate{ + my ($self, $htc, $path, $lang) = @_; - $htc->param(users => [ map { {id => $_, name => user_name} } users ]); - $htc->output; + $htc->param(users => [ sort { lc $a->{name} cmp lc $b->{name} } + map { {id => $_, name => user_name} } + grep { user_name =~ /\w/ } users ]); } 1