]> iEval git - gruntmaster-page.git/commitdiff
Add article support
authorMarius Gavrilescu <marius@ieval.ro>
Wed, 5 Feb 2014 09:54:46 +0000 (11:54 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Wed, 5 Feb 2014 09:54:46 +0000 (11:54 +0200)
a/account.en [new file with mode: 0644]
a/account.en.title [new file with mode: 0644]
a/index.en [new file with mode: 0644]
a/index.en.title [new file with mode: 0644]
css/custom.css
lib/Plack/App/Gruntmaster.pm

diff --git a/a/account.en b/a/account.en
new file mode 100644 (file)
index 0000000..7c55ecf
--- /dev/null
@@ -0,0 +1,21 @@
+<h1>Register</h1>
+<form action="/action/register" method="POST" role="form">
+<div class="form-group"><label for="r_username">Username</label><input type="text" class="form-control" id="r_username" name="username" required></div>
+<div class="form-group"><label for="r_password">Password</label><input type="password" class="form-control" id="r_password" name="password" required></div>
+<div class="form-group"><label for="r_confirm_password">Confirm password</label><input type="password" class="form-control" id="r_confirm_password" name="confirm_password" required></div>
+<div class="form-group"><label for="r_name">Full name</label><input type="text" class="form-control" id="r_name" name="name" required></div>
+<div class="form-group"><label for="r_email">Email</label><input type="email" class="form-control" id="r_email" name="email" required></div>
+<div class="form-group"><label for="r_phone">Phone</label><input type="tel" class="form-control" id="r_phone" name="phone" required></div>
+<div class="form-group"><label for="r_town">Town</label><input type="text" class="form-control" id="r_town" name="town" required></div>
+<div class="form-group"><label for="r_university">Institution</label><input type="text" class="form-control" id="r_university" name="university" required></div>
+<div class="form-group"><label for="r_level">Level</label><select id="level" name="level" class="form-control"> <option>Highschool</option> <option>Undergraduate</option> <option>Master</option> <option>Doctorate</option> <option>Other</option> </select></div>
+<input type="submit" class="btn btn-default" value="Submit">
+</form>
+
+<h1>Change password</h1>
+<form action="/action/passwd" method="POST" class="jsform" role="form">
+<div class="form-group"><label for="ch_password">Old password</label><input type="password" id="ch_password" name="password" class="form-control" required></div>
+<div class="form-group"><label for="ch_new_password">New password</label><input type="password" id="ch_new_password" name="new_password" class="form-control" required></div>
+<div class="form-group"><label for="ch_confirm_new_password">Confirm new password</label><input type="password" id="ch_confirm_new_password" name="confirm_new_password" class="form-control" required></div>
+<input type="submit" class="btn btn-default" value="Change password">
+</form>
diff --git a/a/account.en.title b/a/account.en.title
new file mode 100644 (file)
index 0000000..171e128
--- /dev/null
@@ -0,0 +1 @@
+Account
diff --git a/a/index.en b/a/index.en
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/a/index.en.title b/a/index.en.title
new file mode 100644 (file)
index 0000000..e7e81c9
--- /dev/null
@@ -0,0 +1 @@
+Gruntmaster 6000
\ No newline at end of file
index 3511469b1c62081a256fe95e3ede480d1dc90a04..429e4895a31cc4f7cbdfb6b9227580b52c410abb 100644 (file)
@@ -58,6 +58,6 @@ div.container-fluid {
        padding: 0 15px;
 }
 
-.list-group-item {
+.list-group-item, .form-control {
        max-width: 30em;
 }
index 60ab49f963b184207cdbf6e507c6e5b1b13bff52..5530c73dab29dd2eab00d60d715f73e2dfbf3b40 100644 (file)
@@ -7,6 +7,7 @@ use parent qw/Plack::Component/;
 no if $] >= 5.017011, warnings => 'experimental::smartmatch';
 our $VERSION = '5999.000_001';
 
+use File::Slurp qw/read_file/;
 use HTTP::Negotiate qw/choose/;
 use Plack::Request;
 
@@ -24,6 +25,20 @@ sub call {
                return $obj->generate($format, $env->{'psgix.logger'}, map { $_ // '' } @args);
        }
 
+       if ($r->method eq 'GET' || $r->method eq 'HEAD') {
+               my $article = $r->path eq '/' ? '/index' : $r->path;
+               $article = substr $article, 1;
+               $article =~ tr,/,_,;
+               my @variants = grep { !/\.title$/ } <a/$article.*>;
+               if (@variants) {
+                       my $lang = choose [ map { [$_, 1, 'text/html', undef, undef, $_, undef] } map { /\.(.+)$/ } @variants ], $r->headers;
+                       my $content = read_file "a/$article.$lang";
+                       my $title = read_file "a/$article.$lang.title";
+                       my $html = Gruntmaster::Page::Base::header($lang, $title) . $content . Gruntmaster::Page::Base::footer($lang);
+                       return [200, ['Content-Type' => 'text/html', 'Content-Language' => $lang, 'Vary' => 'Accept-Language'], [$html] ]
+               }
+       }
+
        [404, ['Content-Type' => 'text/plain'], ['Not found']]
 }
 
This page took 0.02437 seconds and 4 git commands to generate.