foodoles/templates/index.tmpl

50 lines
2.1 KiB
Cheetah

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Foodoles written in Go</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.2.13/semantic.min.js"></script>
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
<style type="text/css">h2 { margin: 2em 0em; } .ui.container { padding-top: 5em; padding-bottom: 5em; } </style>
<script type="text/javascript">
var key = "{{ .Key }}";
function vote(option){$.post( "/", {option, key}, ( data ) => { $('.modal').modal('show');});}
function reload(){document.location.reload(true);}
</script>
</head>
<body>
<div class="ui container">
<h1 class="ui header">Foodoles - {{.Foods.Date}}</h1><br/>
<h2 class="ui header">Pick Your Preferred Lunch's Food For Today</h2><br/>
<div class="ui ">
{{ range .Foods.Foods }}
<a onclick="vote('{{ .Title }}')" class="ui label massive" data-tooltip="{{ .Title }}" data-variation="basic" data-position="bottom center">
{{$cur := .Title}}
{{ .Icon }}
{{ range $.Votes.Votes }}
{{ if eq .Food $cur }}
<div class="floating ui blue left label">{{ .Voices }}</div>
{{end}}
{{end}}
</a>
{{ end }}
</div>
</div>
<div class="ui modal">
<div class="header">Foodoles</div>
<div class="content">
<p>Vote sent <strong>successfully</strong></p>
</div>
<div class="actions">
<div class="ui cancel button blue" onclick="reload()">Close</div>
</div>
</div>
</body>
<script type="text/javascript">
twemoji.parse(document.body);
</script>
</html>