Layout home / Chart.js

This commit is contained in:
root 2018-01-18 18:39:24 +01:00
parent 0350cb094f
commit 13631616a7
31 changed files with 192 additions and 198 deletions

0
.gitignore vendored Normal file → Executable file
View file

0
README Normal file → Executable file
View file

3
assholes Normal file → Executable file
View file

@ -1,5 +1,2 @@
Luc Absil Luc Absil
Matthieu Michelet
Clara Husson
Melchior Garapin
Benjamin Criton Benjamin Criton

0
dump.sql Normal file → Executable file
View file

0
import_bdd.py Normal file → Executable file
View file

0
players.db.bak Normal file → Executable file
View file

3
roulette.py Normal file → Executable file
View file

@ -434,7 +434,8 @@ def complete():
con = connect_sql() con = connect_sql()
cur = con.cursor() cur = con.cursor()
cur.execute("""select id, firstname, name from players where cur.execute("""select id, firstname, name from players where
name like "{value}%" or firstname like "{value}%";""".format(value=v)) (name like "{value}%" or firstname like "{value}%")
and {time} > ban_end;""".format(value=v, time=time()))
rows = [[i[0], i[1]+' '+i[2]] for i in cur.fetchall()] rows = [[i[0], i[1]+' '+i[2]] for i in cur.fetchall()]
con.close() con.close()
return json.dumps(rows) return json.dumps(rows)

0
roulette.wsgi Normal file → Executable file
View file

0
schema.sql Normal file → Executable file
View file

0
state Normal file → Executable file
View file

10
static/Chart.min.js vendored Normal file

File diff suppressed because one or more lines are too long

0
static/favicon Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

0
static/favicon.ico Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

0
static/highcharts-custom.js Normal file → Executable file
View file

0
static/highcharts.js Normal file → Executable file
View file

0
static/img/banner.svg Normal file → Executable file
View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

0
static/javascript.js Normal file → Executable file
View file

0
static/jquery-3.1.1.min.js vendored Normal file → Executable file
View file

0
static/style.cs Normal file → Executable file
View file

180
static/style.css Normal file → Executable file
View file

@ -1,113 +1,123 @@
@import url('https://fonts.googleapis.com/css?family=Ubuntu+Mono');
body { body {
background: #2ecc71; background: #d7ebff;
color: white; color: black;
text-align: center; text-align: center;
font-family: helvetica, sans; font-family: 'Ubuntu Mono', monospace;
margin: 0;
}
.center {
display: flex;
flex-flow: column;
align-items: center;
justify-content: center;
} }
a { a {
text-decoration: none; text-decoration: none;
color: grey; color: black;
}
#body_bis {
margin-left: auto;
margin-right: auto;
width: 90%;
max-width: 1300px;
min-width: 550px;
} }
#banner { #banner {
height: 100px; width: 75%;
background: center center url('img/banner.svg') no-repeat; max-width: 1000px;
padding: 10px 10px; margin: 32px;
margin-bottom: 30px;
margin-top: 30px;
} }
#content_container { #card {
margin-left: 200px; margin: 32px auto;
margin-right: 200px; padding: 32px 0 16px 0;
position: relative; max-width: 600px;
background: white; background: white;
color: black; border-radius: 4px;
padding-left: 12px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12),
padding-right: 12px; 0 1px 2px rgba(0, 0, 0, 0.24);
padding-top: 10px;
padding-bottom: 10px;
border-radius:10px;
} }
#content { @media screen and (max-width: 640px) {
position: relative; #card {
z-index: 5; width: 80%;
}
#banner {
margin: 32px 32px 0 32px;
}
}
#chart {
margin-bottom: 16px;
}
.sep {
width: 100%;
height: 1px;
background-color: #DADADA;
margin: 16px;
box-sizing: border-box;
}
.desc {
font-size: 18px;
margin: 16px 0;
padding: 0 16px;
}
#play {
width: 132px;
height: 54px;
font-size: 20px;
margin: 16px auto;
border-radius: 3px;
background-color: #9ce898;
font-weight: bold;
transition: all cubic-bezier(0.4, 0.0, 0.2, 1) 0.2s;
}
#play:hover {
background-color: #7fd87b;
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16),
0 3px 6px rgba(0, 0, 0, 0.23);
}
.title {
font-size: 24px;
}
#history {
margin: 16px;
padding: 0 16px;
list-style-type: decimal-leading-zero;
list-style-position: inside;
}
li {
text-align: left; text-align: left;
} }
li .normal {
/* Contenu */
#content h1 {
margin-top: 5px;
padding-left: 50px;
font-size: 130%;
}
#content h2, #content p {
margin-left: 20px;
margin-right: 20px;
}
#content h2 {
margin-top:0px;
font-size: 100%;
margin-bottom: 5px;
padding-bottom: 0px;
}
#content p {
text-indent: 2em;
margin-top: 0px;
font-size: 90%;
}
#content ul#history {
padding-left: 60px;
}
#content li.events {
font-size: 180%;
}
#content li .normal {
color: black; color: black;
font-size: 80%; font-size: 80%;
} }
#content li.ban { li.ban {
color: red; color: red;
} }
#content li.warn { li.warn {
color: orange; color: orange;
} }
#content li.ok { li.ok {
color: #1D1; color: #1D1;
} }
#content_container #footer {
margin-top: 4em;
font-size: 70%;
}
p#play { p#play {
text-align: center; text-align: center;
font-size: 1.5em; font-size: 1.5em;
font-weight: bold; font-weight: bold;
margin-top: 1.6em; margin-top: 1.6em;
margin-bottom: 2em; margin-bottom: 2em;
} }
p#play a { p#play a {
@ -133,20 +143,10 @@ form#select {
text-align: center; text-align: center;
} }
ul.flashes {
font-size: 80%;
font-weight: bold;
color: #222;
list-style-type: none;
padding: 0;
width: 90%;
margin: .5em auto;
}
ul.flashes li { ul.flashes li {
background: #2E2; background: #2E2;
border: 1px solid #191; border: 1px solid #191;
border-radius: .6em; border-radius: .6em;
margin-bottom: 1em; margin-bottom: 1em;
padding: .4em .7em; padding: .4em .7em;
} }

0
static/style_red.css Normal file → Executable file
View file

0
templates/banned.html Normal file → Executable file
View file

0
templates/down.html Normal file → Executable file
View file

133
templates/home.html Normal file → Executable file
View file

@ -1,77 +1,62 @@
{% extends "layout.html" %} {% extends "layout.html" %} {% block content %}
{% block content %} <canvas id="chart"></canvas>
<br>
<h2>Toi aussi abuse des pouvoirs du Rézo avec les Metzthernets !</h2>
<p id="play" style="text-align: center; font-size: 1.5em">
<a href="{{url_for('play')}}">Jouer</a>
</p>
<div id="container" style="min-width: 310px; max-width: 600px; margin: 0 auto"></div> <div class="sep"></div>
<h2>Historique personnel</h2>
{% if bans_hist != [] %} <div class="desc">Toi aussi abuse des pouvoirs du Rézo avec les Metzthernets !</div>
<ul id="history">
{% for entry in bans_hist %}
<li class="{{ entry[0] }}" class="events">
<span class="normal"> {{ entry[1] }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<p>
Rien pour l'instant
</p>
{% endif %} <a href="{{url_for('play')}}">
<script type="text/javascript"> <div id="play" class="center">
$(function () { JOUER
Highcharts.chart('container', { </div>
chart: { </a>
plotBackgroundColor: null,
plotBorderWidth: 0, <div class="sep"></div>
plotShadow: false
}, <div class="desc title">Historique personnel</div>
title: {
text: 'État du Rézo', {% if bans_hist != [] %}
align: 'center', <ul id="history">
verticalAlign: 'middle', {% for entry in bans_hist %}
y: 60 <li class="{{ entry[0] }}" class="events">
}, <span class="normal">{{ entry[1] }}</span>
tooltip: { </li>
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' {% endfor %}
}, </ul>
plotOptions: { {% else %}
pie: { <p>
dataLabels: { Rien pour l'instant
enabled: true, </p>
distance: -50, {% endif %}
style: {
fontWeight: 'bold', <div class="sep"></div>
color: 'white'
} <script type="text/javascript">
}, $(function () {
startAngle: -90,
endAngle: 90, var ctx = document.getElementById("chart").getContext('2d');
center: ['50%', '75%'] var data = {
}, datasets: [{
}, data: [ {{ stats[0] }}, {{ stats[1] }} ],
series: [{ backgroundColor: ['#ffd7d7', '#d7ebff']
type: 'pie', }],
name: 'État du Rézo', labels: ['Tranchés', 'Vivants']
innerSize: '50%', };
data: [
{ var options = {
name: 'Tranchés', cutoutPercentage: 40,
y: {{ stats[0] }}, rotation: -Math.PI,
color: '#FF0000', circumference: Math.PI,
},{ legend: { labels: { fontSize: 18 }},
name: 'Vivants', tooltips: { bodyFontSize: 18 }
y: {{ stats[1] }}, };
color: '#FFCC00',
} var chart = new Chart(ctx, {
] type: 'doughnut',
}] data: data,
}); options: options
}); });
</script>
{% endblock %} });
</script>
{% endblock %}

60
templates/layout.html Normal file → Executable file
View file

@ -1,38 +1,38 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<title>Rézoroulette Metzthernet</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
<script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='highcharts.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='jquery-3.1.1.min.js') }}"></script>
<link rel="shortcut icon" type="image/x-icon"
href="{{ url_for('static', filename='favicon.ico') }}" />
</head>
<body> <head>
<div id="body_bis"> <title>Rézoroulette Metzthernet</title>
<a href="/"> <meta charset="utf-8" />
<div id="banner"> <meta name="viewport" content="width=device-width,initial-scale=1">
</div> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}" />
</a> <script type="text/javascript" src="{{ url_for('static', filename='javascript.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='Chart.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='jquery-3.1.1.min.js') }}"></script>
<link rel="shortcut icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}" />
</head>
<body>
<div id="content_container"> <a href="/">
<div id="content"> <img id="banner" src="{{ url_for('static', filename='img/banner.svg') }}">
{% with messages = get_flashed_messages() %} </a>
{% if messages %}
<ul class=flashes> <div id="card">
{% for message in messages %} <div id="content" class="center">
<li>{{ message }}</li> {% with messages = get_flashed_messages() %} {% if messages %}
{% endfor %} <ul class=flashes>
</ul> {% for message in messages %}
{% endif %} <li>{{ message }}</li>
{% endwith %} {% endfor %}
{% block content %}{% endblock %} </ul>
{% endif %} {% endwith %} {% block content %}{% endblock %}
</div> </div>
<div id="footer">Contact technique : <a href="mailto:metzthernet@gmail.com">metzthernet@gmail.com</a></div> <div id="footer">
<a href="mailto:metzthernet@gmail.com">metzthernet@gmail.com</a>
</div> </div>
</div> </div>
</div>
</body> </body>
</html>
</html>

0
templates/layout_banned.html Normal file → Executable file
View file

0
templates/layout_precampagne.html Normal file → Executable file
View file

0
templates/not_subscribed.html Normal file → Executable file
View file

0
templates/play.html Normal file → Executable file
View file

0
templates/precampagne.html Normal file → Executable file
View file

1
test.txt Normal file
View file

@ -0,0 +1 @@
This is only a test.