From: Marius Gavrilescu Date: Sat, 22 Feb 2014 10:29:53 +0000 (+0200) Subject: Make Gruntmaster::Page::Base::variants not need overriding X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=16aa291dc49dceda7e612ed7eb2745036790d81c;p=gruntmaster-page.git Make Gruntmaster::Page::Base::variants not need overriding --- diff --git a/lib/Gruntmaster/Page/Base.pm b/lib/Gruntmaster/Page/Base.pm index 6ced614..475be80 100644 --- a/lib/Gruntmaster/Page/Base.pm +++ b/lib/Gruntmaster/Page/Base.pm @@ -92,6 +92,7 @@ sub vary { '' } sub max_age { 60 } sub variants { + return [] unless exists $templates{$_[0]}; [ map { [ $_, 1, 'text/html', undef, undef, $_, undef ]} keys $templates{$_[0]} ] } diff --git a/lib/Gruntmaster/Page/CSS.pm b/lib/Gruntmaster/Page/CSS.pm index 2553ab6..7165c3a 100644 --- a/lib/Gruntmaster/Page/CSS.pm +++ b/lib/Gruntmaster/Page/CSS.pm @@ -19,6 +19,4 @@ sub generate{ [200, ['Content-Type' => 'text/css', 'Cache-Control' => 'public, max-age=604800', 'X-Forever' => 1], [minify $css] ] } -sub variants{ [[css => 1, 'text/css', undef, undef, undef, undef]] } - 1 diff --git a/lib/Gruntmaster/Page/JS.pm b/lib/Gruntmaster/Page/JS.pm index b8ddafb..fbaf3da 100644 --- a/lib/Gruntmaster/Page/JS.pm +++ b/lib/Gruntmaster/Page/JS.pm @@ -18,6 +18,4 @@ sub generate{ [200, ['Content-Type' => 'application/javascript', 'Cache-Control' => 'public, max-age=604800', 'X-Forever' => 1], [minify $js] ] } -sub variants{ [[js => 1, 'application/javascript', undef, undef, undef, undef]] } - 1 diff --git a/lib/Gruntmaster/Page/Passwd.pm b/lib/Gruntmaster/Page/Passwd.pm index 86689ac..73b7680 100644 --- a/lib/Gruntmaster/Page/Passwd.pm +++ b/lib/Gruntmaster/Page/Passwd.pm @@ -22,6 +22,4 @@ sub generate{ reply 'Password changed successfully'; } -sub variants{ [[reply => 1, undef, undef, undef, undef, undef]] } - 1 diff --git a/lib/Gruntmaster/Page/Register.pm b/lib/Gruntmaster/Page/Register.pm index dcb9451..5a3edd1 100644 --- a/lib/Gruntmaster/Page/Register.pm +++ b/lib/Gruntmaster/Page/Register.pm @@ -27,6 +27,4 @@ sub generate{ reply 'Registered successfully'; } -sub variants{ [[reply => 1, undef, undef, undef, undef, undef]] } - 1 diff --git a/lib/Gruntmaster/Page/Src.pm b/lib/Gruntmaster/Page/Src.pm index 8e51d8b..6dd5a9c 100644 --- a/lib/Gruntmaster/Page/Src.pm +++ b/lib/Gruntmaster/Page/Src.pm @@ -25,6 +25,4 @@ sub generate{ [200, ['Content-Type' => CONTENT_TYPES->{$ext}, 'Cache-Control' => 'max-age=604800', 'X-Forever' => 1], [job_inmeta($job)->{files}{prog}{content}] ] } -sub variants{ [[file => 1, undef, undef, undef, undef, undef]] } - 1 diff --git a/lib/Gruntmaster/Page/Submit.pm b/lib/Gruntmaster/Page/Submit.pm index 0159a9d..2c9fef0 100644 --- a/lib/Gruntmaster/Page/Submit.pm +++ b/lib/Gruntmaster/Page/Submit.pm @@ -61,6 +61,4 @@ sub generate{ [303, [Location => $r->path =~ s,/pb/\w+/submit$,/log/,r], ['']] } -sub variants{ [[reply => 1, undef, undef, undef, undef, undef]] } - 1