Date: Wed, 16 Apr 2014 21:11:31 +0000 (UTC) From: Dag-Erling Smørgrav <des@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r264559 - in user/des/fbp: lib/FBP/View root root/lib root/poll root/question root/static t Message-ID: <201404162111.s3GLBVWS042052@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: des Date: Wed Apr 16 21:11:31 2014 New Revision: 264559 URL: http://svnweb.freebsd.org/changeset/base/264559 Log: View. Added: user/des/fbp/lib/FBP/View/Web.pm (contents, props changed) user/des/fbp/root/blank.tt (contents, props changed) user/des/fbp/root/fof.tt (contents, props changed) user/des/fbp/root/help.tt (contents, props changed) user/des/fbp/root/index.tt (contents, props changed) user/des/fbp/root/lib/ user/des/fbp/root/lib/date (contents, props changed) user/des/fbp/root/lib/datetime (contents, props changed) user/des/fbp/root/lib/footer (contents, props changed) user/des/fbp/root/lib/header (contents, props changed) user/des/fbp/root/lib/help (contents, props changed) user/des/fbp/root/lib/html_bottom (contents, props changed) user/des/fbp/root/lib/html_top (contents, props changed) user/des/fbp/root/lib/loginout (contents, props changed) user/des/fbp/root/lib/main (contents, props changed) user/des/fbp/root/lib/navigation (contents, props changed) user/des/fbp/root/lib/time (contents, props changed) user/des/fbp/root/login.tt (contents, props changed) user/des/fbp/root/poll/ user/des/fbp/root/poll/done.tt (contents, props changed) user/des/fbp/root/poll/review.tt (contents, props changed) user/des/fbp/root/poll/see.tt (contents, props changed) user/des/fbp/root/poll/vote.tt (contents, props changed) user/des/fbp/root/polls.tt (contents, props changed) user/des/fbp/root/question/ user/des/fbp/root/static/fbp.css (contents, props changed) user/des/fbp/t/view_Web.t Modified: user/des/fbp/root/favicon.ico (contents, props changed) Added: user/des/fbp/lib/FBP/View/Web.pm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/lib/FBP/View/Web.pm Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,39 @@ +use utf8; +package FBP::View::Web; +use Moose; +use namespace::autoclean; + +extends 'Catalyst::View::TT'; + +__PACKAGE__->config( + TEMPLATE_EXTENSION => '.tt', + ENCODING => 'utf-8', + render_die => 1, +); + +=head1 NAME + +FBP::View::Web - TT View for FBP + +=head1 DESCRIPTION + +TT View for FBP. + +=head1 SEE ALSO + +L<FBP> + +=head1 AUTHOR + +Dag-Erling Smørgrav <des@freebsd.org> + +=head1 LICENSE + +This library is free software. You can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + +1; + +# $FreeBSD$ Added: user/des/fbp/root/blank.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/blank.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,12 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +<div class="errorbox"> + <p>This page intentionally left blank.</p> +</div> + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Modified: user/des/fbp/root/favicon.ico ============================================================================== Binary file (source and/or target). No diff available. Added: user/des/fbp/root/fof.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/fof.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,14 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +<div class="errorbox"> + <p>This is not the page you are looking for.</p> + <p>You may go about your business.</p> + <p>Move along, move along.</p> +</div> + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/help.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/help.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,12 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +<a name="help"></a> +<h2>Help</h2> +[% PROCESS lib/help %] + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/index.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/index.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,19 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +<p>This site hosts polls for the <a href="http://www.freebsd.org/">FreeBSD Project</a>.</p> +[% IF c.user %] +[% IF polls.size() > 0 %] +<p>Please proceed to <a href="[% c.uri_for('/polls') | html %]">the polls</a>.</p> +[% ELSE %] +<p>There are no active polls at the moment.</p> +[% END %] +[% ELSE %] +<p>You must <a href="[% c.uri_for('/login') | html %]">log in</a> to see or answer polls.</p> +[% END %] + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/lib/date ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/date Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,2 @@ +[%# $FreeBSD$ %] +[%- dt.day_name %], [% dt.day %] [% dt.month_name %] [% dt.year -%] Added: user/des/fbp/root/lib/datetime ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/datetime Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,2 @@ +[%# $FreeBSD$ %] +[%- PROCESS lib/date%] at [% PROCESS lib/time -%] Added: user/des/fbp/root/lib/footer ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/footer Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,2 @@ +[%# $FreeBSD$ %] +<div class="footer">Developed and maintained by <a href="mailto:des@freebsd.org">Dag-Erling Smørgrav</a></div> Added: user/des/fbp/root/lib/header ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/header Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,5 @@ +<div class="header"> +<h1 class="title">[% title | html %]</h1> +[% PROCESS lib/navigation %] +[% PROCESS lib/loginout %] +</div> Added: user/des/fbp/root/lib/help ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/help Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,40 @@ +<h3>What is this?</h3> + +<p>This is a website for FreeBSD polls and elections.</p> + +<h3>Who has access?</h3> + +<p>Anyone with a valid commit bit in at least one of FreeBSD's repositories (src, doc, ports) can log in with their FreeBSD user name. However, only active committers, i.e. those who have made at least one commit in the twelve months preceding the opening of the poll are qualified to vote. Inactive committers can only observe.</p> + +[% IF c.user %] + [% IF c.user.active %] +<p>You are registered as an active committer, and are qualified to vote.</p> + [% ELSE %] +<p>You are not registered as an active committer, and are therefore not qualified to vote. If you believe this is incorrect, please contact the election administrator.</p> + [% END %] +[% ELSE %] +<p>When you are logged in, your status (active or inactive) will be visible next to your name in the top right corner.</p> +[% END %] + +<h3>How do I log in?</h3> + +[% IF c.user %] +<p>You're already logged in, you big dummy.</p> +[% ELSE %] +<p>Click the <a href="[% c.uri_for('/login') | html %]">Log in</a> link below the navigation bar (or the one right here). Log in with your FreeBSD user name and the password that was left in your home directory on the FreeBSD cluster.</p> +[% IF polls.count > 0 %] +<p>If you have a valid FreeBSD commit bit but you haven't received a password, please contact the election administrator.</p> +[% END %] +[% END %] + +<h3>How do I vote?</h3> + +[% IF !c.user %] +<p>You must be logged in to vote.</p> +[% ELSIF !c.user.active %] +<p>You are not registered as an active committer, and are therefore not qualified to vote. If you believe this is incorrect, please contact the election administrator.</p> +[% ELSIF polls.count == 0 %] +<p>There are currently no active polls.</p> +[% ELSE %] +<p>Click the <a href="[% c.uri_for('/polls') | html %]">Active Polls</a> link in the navigation bar (or the one right here) to view the list of active polls. Select the poll in which you wish to vote and hit the “Let me vote” button. Answer all the questions, then hit the “I'm done” button. You can come back and change your vote at any time until the poll closes.</p> +[% END %] Added: user/des/fbp/root/lib/html_bottom ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/html_bottom Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,3 @@ +[%# $FreeBSD$ %] +</body> +</html> Added: user/des/fbp/root/lib/html_top ============================================================================== Binary file. No diff available. Added: user/des/fbp/root/lib/loginout ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/loginout Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,9 @@ +[%# $FreeBSD$ %] +<div class="loginout"> + <div class="datetime">[% PROCESS lib/datetime dt=c.now %]</div> + [% IF c.user %] + Logged in as [% c.user.realname | html %] ([% IF c.user.active %]active[% ELSE %]inactive[% END %]) – <a href="[% c.uri_for_action('/logout') | html %]">Log out</a> + [% ELSE %] + <a href="[% c.uri_for_action('/login') | html %]">Log in</a> + [% END %] +</div> Added: user/des/fbp/root/lib/main ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/main Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,4 @@ +[%# $FreeBSD$ %] +<div class="main [% c.controller.path_prefix %]"> +[% content %] +</div> Added: user/des/fbp/root/lib/navigation ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/navigation Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,12 @@ +[%# $FreeBSD$ %] +<div class="navigation"> + <ul> + <li><a href="[% c.uri_for('/') | html %]">Home</a></li> + [% IF c.user %] + [% IF polls.count() >= 0 %]<li><a href="[% c.uri_for('/polls') | html %]">Active polls</a></li>[% END %] + [% IF announced %]<li><a href="[% c.uri_for('/result') | html %]">Result</a></li>[% END %] + [% IF c.user.admin %]<li><a href="[% c.uri_for('/admin') | html %]">Admin</a></li>[% END %] + [% END %] + <li><a href="[% c.uri_for('/help') | html %]">Help</a></li> + </ul> +</div> Added: user/des/fbp/root/lib/time ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/lib/time Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,2 @@ +[%# $FreeBSD$ %] +[%- dt.hms %] UTC[% -%] Added: user/des/fbp/root/login.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/login.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,22 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] + +<form class="loginform" method="POST" action="[% c.uri_for('/login') | html %]"> + <fieldset> + <legend>[% title | html %]</legend> + <input type="hidden" name="action" value="[% action | html %]"/> + <div class="loginfield"> + <label for="login">Login:</label> + <input type="text" name="login" size="24"/> + </div> + <div class="passwordfield"> + <label for="password">Password:</label> + <input type="password" name="password" size="24"/> + </div> + <div class="submit"> + <input type="submit" name="submit" value="Login"/> + </div> + </fieldset> +</form> + +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/poll/done.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/poll/done.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,12 @@ +[%# $FreeBSD$ %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header title='Thank you for voting' %] +[% WRAPPER lib/main %] + +<p>Thank you for voting in this poll.</p> + +<p><a href="[% c.uri_for('/') | html %]">Return to the front page</a></p> + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/poll/review.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/poll/review.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,39 @@ +[%# $FreeBSD$ %] +[% USE WikiFormat %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +[% IF error %] +<div class="error"> +<p>[% error | html %]</p> +</div> +[% ELSE %] +<div class="review"> +<p>You have submitted valid answers to all questions in the poll.</p> + [% FOREACH question IN poll.questions %] + [% qid = question.id %] +<div class="short"> + [% question.short | wiki %] +</div> + [% IF question.max_options == 1 %] +<p>You answered: <span class="answer">[% answers.$qid.0.label | html %]</span></p> + [% ELSE %] +<p>You answered:</p> +<ul> + [% FOREACH option IN answers.$qid %] +<li class="answer">[% option.label %]</li> + [% END %] +</ul> + [% END %] + [% END %] +<form action=""> +<input type="submit" name="return" value="Return to the questions"/> +<input type="submit" name="confirm" value="Submit my vote"/> +</form> +</div> +[% END %] + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/poll/see.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/poll/see.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,27 @@ +[%# $FreeBSD$ %] +[% USE WikiFormat %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +<div class="poll"> +<div class="synopsis"> +[% poll.synopsis | wiki %] +</div> +<div class="long"> +[% poll.long | wiki %] +</div> +<div class="question-link"> +[% IF !c.user.active %] +<p>You are not qualified to vote in this poll.</p> +[% ELSIF questions.size() == 0 %] +<p>Strangely, this poll has no questions.</p> +[% ELSE %] +<p><a href="[% c.uri_for('/poll', questions.first.id, 'vote') | html %]">Vote in this poll.</a></p> +[% END %] +</div> +</div> + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/poll/vote.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/poll/vote.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,41 @@ +[% USE WikiFormat %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +[% IF error %] +<div class="error"> +<p>[% error | html %]</p> +</div> +[% END %] +<div class="question"> +<form method="POST" action=""> +<input type="hidden" name="qid" value="[% question.id %]"/> +<div class="short"> +[% question.short | wiki %] +</div> +<div class="long"> +[% question.long | wiki %] +</div> +<div class="options"> +[% IF question.max_options == 1 %] +[% itype = 'radio' %] +[% ELSE %] +[% itype = 'checkbox' %] +[% END %] +[% FOREACH option = question.options %] +[% oid = option.id %] +<div class="option"> +<input type="[% itype %]" name="answer" value="[% oid %]"[% IF answer.$oid %] checked="checked"[% END %]>[% option.label | html %]</input> +</div> +[% END %] +<input type="submit" name="prev" value="Previous question"[% IF !question.prev %]disabled="disabled"[% END %]/> +<input type="submit" name="done" value="I'm done"/> +<input type="submit" name="next" value="Next question"[% IF !question.next %]disabled="disabled"[% END %]/> +</div> +</form> +</div> + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/polls.tt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/polls.tt Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,20 @@ +[%# $FreeBSD$ %] +[% USE WikiFormat %] +[% PROCESS lib/html_top %] +[% PROCESS lib/header %] +[% WRAPPER lib/main %] + +[% IF polls.count == 0 %] +<p>There are no active polls at present.</p> +[% ELSE %] +<dl> +[% WHILE (poll = polls.next) %] +<dt><a href="[% c.uri_for('/poll', poll.id) | html %]">[% poll.title | html%]</a></dt> +<dd>[% poll.synopsis | wiki %]</dd> +[% END %] +</dl> +[% END %] + +[% END %] +[% PROCESS lib/footer %] +[% PROCESS lib/html_bottom %] Added: user/des/fbp/root/static/fbp.css ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/root/static/fbp.css Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,187 @@ +/* + * $FreeBSD$ + */ + +/* + * Body + */ +body { + font-family: sans-serif; + background-color: #fff; + margin: 5% auto 5% auto; + min-width: 400px; + width: 80%; + max-width: 800px; +} + +/* + * General formatting + */ +a { + text-decoration: none; + color: #900; +} + +a:hover, a:focus { + background-color: #fee; +} + +th { + text-align: left; +} + +/* + * Title + */ +.title { + display: block; + padding: 6pt; + font-size: 200%; + font-weight: bold; +} + +/* + * Navigation bar + */ +.navigation { + display: block; + margin: 0; + padding: 2pt; + border-top: thin solid black; + border-bottom: thin solid black; + text-align: center; + background-color: #fc6; + color: #900; +} + +.navigation ul { + margin: 0; + padding: 0; +} + +.navigation li { + display: inline; + padding: 0; + margin: 0; +} + +.navigation a { + padding: 2pt 2em 2pt 2em; + margin: 0; + // font-size: 120%; + text-transform: uppercase; + font-weight: bold; + color: #900; +} + +.navigation a:hover, .navigation a:focus { + background-color: #900; + color: #fc6; +} + +/* + * Date / time, name and login / logout link + */ +.loginout { + display: block; + margin: 0; + padding: 3pt; + text-align: right; + font-size: 75%; + font-style: italic; +} + +.datetime { + float: left; +} + +/* + * Content + */ +.main { + display: block; + padding: 6pt; + min-height: 400px; + overflow: auto; +} + +.info { + color: green; + font-weight: bold; +} + +.error { + color: red; + font-weight: bold; +} + +/* + * Footer + */ +.footer { + padding: 3pt 0 3pt 0; + border-top: thin solid black; + border-bottom: thin solid black; + background-color: #fc6; + text-align: center; + font-size: 75%; + font-style: italic; +} + +/* + * Error message + */ +.errorbox { + display: block; + margin: 20% auto 0 auto; + font-size: large; + text-align: center; + vertical-align: middle; +} + +/* + * Login page + */ +.loginform { + display: block; + width: 50%; + margin: 25% auto 0 auto; +} + +.loginform fieldset { + padding: 12pt; + border: thin solid #900; +} + +.loginform legend { + padding: 0.5ex; + font-size: large; + font-weight: bold; + color: #900; + // background-color: #fc6; +} + +.loginform div { + padding: 6pt; + white-space: nowrap; + text-align: right; +} + +/* + * Poll + */ +.poll .synopsis { + font-size: large; +} + +.poll .long { + margin-left: 2ex; +} + +/* + * Voting + */ +.vote .votebox { + width: 2ex; + text-align: center; +} Added: user/des/fbp/t/view_Web.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/des/fbp/t/view_Web.t Wed Apr 16 21:11:31 2014 (r264559) @@ -0,0 +1,8 @@ +use strict; +use warnings; +use Test::More; + + +BEGIN { use_ok 'FBP::View::Web' } + +done_testing();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404162111.s3GLBVWS042052>