Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env perl | ||
package EggsML::Website; | ||
use Mojolicious::Lite; | ||
use Env qw/EGGS_DIR/; | ||
use EggsML::Lunchfile; | ||
|
||
my $lunchfile = EggsML::Lunchfile->new( filename => "$EGGS_DIR/slashdotfrokost" ); | ||
|
||
get '/' => sub { | ||
my $self = shift; | ||
|
||
$lunchfile->parse; | ||
|
||
$self->stash( | ||
wishes => $lunchfile->wishes, | ||
members => $lunchfile->all_members, | ||
); | ||
|
||
return $self->render('index'); | ||
}; | ||
|
||
push (@{ app->renderer->paths }, "$EGGS_DIR/spindel/skabeloner"); | ||
push (@{ app->static->paths }, "$EGGS_DIR/spindel/statisk"); | ||
|
||
app->defaults( | ||
layout => 'bootstrap', | ||
title => 'EggsML', | ||
); | ||
|
||
app->config(hypnotoad => { | ||
pid => "$EGGS_DIR/spindel/hypnotoad.pid", | ||
listen => [ 'http://127.0.0.1:14500' ], | ||
}); | ||
|
||
app->start; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<div class="jumbotron"> | ||
<div class="container"> | ||
<h1>EggsML</h1> | ||
<p>Frokostmanagement til den moderne enterprise.</p> | ||
</div> | ||
</div> | ||
|
||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<h1>Saldoer</h1> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>Bruger</th> | ||
<th>Saldo</th> | ||
<th>Betalt i alt</th> | ||
<th>Måltider</th> | ||
<th>Gns. pris</th> | ||
<th>Seneste eggs</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
% for my $member (@$members) { | ||
<tr> | ||
<td><%= $member->canonical %></td> | ||
<td<%== $member->balance > 0 ? ' class="text-success"' : | ||
$member->balance < 0 ? ' class="text-danger"' : '' %>><%= sprintf("%.02f", $member->balance) %></td> | ||
<td><%= sprintf("%.02f", $member->total_purchased) %></td> | ||
<td><%= $member->lunch_count %></td> | ||
<td></td> | ||
% my $days_ago = $member->days_since_latest_lunch; | ||
<td><%= $days_ago == 0 ? "I dag" : | ||
$days_ago == 1 ? "I går" : "For $days_ago dage siden" %></td> | ||
</tr> | ||
% } | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-xs-6"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<h2>Ønsker</h2> | ||
</div> | ||
<ul class="list-group"> | ||
% for my $wish (@$wishes) { | ||
<li class="list-group-item"><%= $wish %></li> | ||
% } | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="col-xs-6"> | ||
|
||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<% | ||
my @menu = ( | ||
{ title => "Medlemmer", url => '/medlemmer', key => 'member' } | ||
); | ||
%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<title><%= title %></title> | ||
|
||
<!-- Bootstrap --> | ||
<link href="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/readable/bootstrap.min.css" rel="stylesheet" integrity="sha384-/x/+iIbAU4qS3UecK7KIjLZdUilKKCjUFVdwFx8ba7S/WvxbrYeQuKEt0n/HWqTx" crossorigin="anonymous"> | ||
|
||
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> | ||
<!--[if lt IE 9]> | ||
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> | ||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> | ||
<![endif]--> | ||
|
||
<style> | ||
body { padding-top: 70px; } | ||
</style> | ||
</head> | ||
<body> | ||
<nav class="navbar navbar-default navbar-fixed-top"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> | ||
<span class="sr-only">Toggle navigation</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
<a class="navbar-brand" href="/">EggsML</a> | ||
</div> | ||
<div id="navbar" class="navbar-collapse collapse"> | ||
<ul class="nav navbar-nav"> | ||
% for my $entry (@menu) { | ||
<li<%= (stash('key') eq $entry->{key}) ? ' class="active"' : '' %>> | ||
<a href="<%= $entry->{url} %>"><%= $entry->{title} %></a> | ||
</li> | ||
% } | ||
</ul> | ||
</div> | ||
</div> | ||
</nav> | ||
|
||
<div class="container"> | ||
<%= content %> | ||
</div> | ||
|
||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | ||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> | ||
</body> | ||
</html> |