]> iEval git - gruntmaster-page.git/blame - lib/Gruntmaster/Page/Account.pm
Centralize template cooking and introduce reloadable templates
[gruntmaster-page.git] / lib / Gruntmaster / Page / Account.pm
CommitLineData
088a8d62
MG
1package Gruntmaster::Page::Account;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7our @EXPORT_OK = qw/generate/;
8our $VERSION = '0.001';
9
088a8d62 10use HTML::Template::Compiled;
2b0036ac 11use Gruntmaster::Page::Common qw/cook_templates reload_templates/;
088a8d62 12
2b0036ac 13my %orig_templates = (
088a8d62
MG
14 en => <<'HTML',
15<div id="result"></div>
16
17<h1>Register</h1>
18<form action="/action/register" method="POST" class="jsform">
19Username:<br>
20<input type="text" name="username" required><br>
21Password:<br>
22<input type="password" name="password" required><br>
23Confirm password:<br>
24<input type="password" name="confirm_password" required><br>
25Full name:<br>
26<input type="text" name="name" required><br>
27Email:<br>
28<input type="email" name="email" required><br>
29Town:<br>
30<input type="text" name="town" required><br>
31University <i>(full name)</i>:<br>
32<input type="text" name="university" required><br>
33<input type="submit" value="Register">
34</form>
35
36<h1>Change password</h1>
37<form action="/action/passwd" method="POST" class="jsform">
38Old password:<br>
39<input type="password" name="password" required><br>
40New password:<br>
41<input type="password" name="new_password" required><br>
42Confirm new password:<br>
43<input type="password" name="confirm_new_password" required><br>
44<input type="submit" value="Change password">
45</form>
46HTML
47);
48
2b0036ac 49my %templates = cook_templates %orig_templates, account => 'Account';
088a8d62
MG
50
51sub generate{
2b0036ac 52 %templates = cook_templates %orig_templates, account => 'Account' if reload_templates;
088a8d62
MG
53 HTML::Template::Compiled->new(scalarref => \$templates{$_[1]})->output
54}
55
561
This page took 0.026511 seconds and 4 git commands to generate.