commit
8fc7a954ab
@ -0,0 +1 @@
|
|||||||
|
{"username":"davide","password":"AssarIsTheNewGoogle17"}
|
@ -0,0 +1,42 @@
|
|||||||
|
import random
|
||||||
|
import operator
|
||||||
|
import json
|
||||||
|
from flask import Flask, Response, redirect, url_for, request, session, abort, render_template
|
||||||
|
from flask_login import LoginManager, UserMixin, login_required, login_user, logout_user, current_user
|
||||||
|
from sqlalchemy.sql import select, text
|
||||||
|
import datetime
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
#config
|
||||||
|
app.config.update(
|
||||||
|
DEBUG = True,
|
||||||
|
SECRET_KEY = 'secret_xxx',
|
||||||
|
SESSION_TYPE = 'memcached'
|
||||||
|
)
|
||||||
|
|
||||||
|
db_engine = {}
|
||||||
|
db_metadata = {}
|
||||||
|
meals = {}
|
||||||
|
|
||||||
|
def getLeaderboard():
|
||||||
|
leaders = []
|
||||||
|
leaders.append({'name':'marek', 'score':'34'})
|
||||||
|
leaders.append({'name':'sven', 'score':'16'})
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def getUpcomingMeals():
|
||||||
|
meals = []
|
||||||
|
meals.append({'id':1, 'kuk':'davide', 'eaters':['marek','sven','wille'], 'flavor_text':'Pizza', 'date':'Tuesday 21st of November', 'selection_deadline':'23 hours 14 minutes', 'status':0})
|
||||||
|
meals.append({'id':2, 'kuk':'marek', 'eaters':['davide','sven','david', 'wille'], 'flavor_text':'Grzybowa', 'date':'Friday 23rd of November', 'selection_deadline':'3 Days 23 hours', 'status':0})
|
||||||
|
return {}
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def index():
|
||||||
|
return render_template('index-new.html', leaderboard=getLeaderboard(), upcomingMeals=getUpcomingMeals(), current_user_name='Wille')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
with open('admin.json') as f:
|
||||||
|
postgres_credentials = json.load(f)
|
||||||
|
db_engine, db_metadata = connect(postgres_credentials['username'], postgres_credentials['password'], 'kuk_app')
|
||||||
|
meals = sqlalchemy.Table('meals', db_metadata)
|
||||||
|
app.run('0.0.0.0')
|
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>KUKapp</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
|
||||||
|
<script src="{{ url_for('static', filename='script.js') }}"></script>
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
<script src="https://use.fontawesome.com/2fef7be393.js"></script>
|
||||||
|
<style type="text/css">
|
||||||
|
html {
|
||||||
|
background-image: url({{url_for('static', filename='burger.jpg')}});
|
||||||
|
background-position: left top;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% auto;
|
||||||
|
background-color: #aeaeac;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="leaderboard">
|
||||||
|
<h1 style="text-align: center">Leaderboard</h1>
|
||||||
|
<div class="leaderboard-contiainer">
|
||||||
|
{% for person in leaderboard %}
|
||||||
|
<div class="lb-entry">
|
||||||
|
<img src="{{url_for('static', filename=person['name'] + '.png')}}">
|
||||||
|
<span class="name">{{ person['name'] }}</span>
|
||||||
|
<span class="score">{{ person['score'] }}</span>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="next-meal">
|
||||||
|
<h1 style="padding-left: 40pt">Next Meal</h1>
|
||||||
|
<h2>Cook</h2>
|
||||||
|
<div class="cook-entry">
|
||||||
|
Davide
|
||||||
|
</div>
|
||||||
|
<h2>Eaters</h2>
|
||||||
|
<div class="eater-entry">
|
||||||
|
Marek
|
||||||
|
</div>
|
||||||
|
<div class="eater-entry">
|
||||||
|
Sven
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="user-info">
|
||||||
|
<div class="user-card">
|
||||||
|
<img src="{{url_for('static', filename=current_user_name + '.png')}}">
|
||||||
|
<span>{{current_user_name}}</span>
|
||||||
|
<div class="logout-button" onclick="location.href='/logout';"><span>LOGOUT</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in new issue