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

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

@ -1,107 +1,117 @@
@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;
@ -133,16 +143,6 @@ 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;

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

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

@ -1,19 +1,25 @@
{% 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>
<a href="{{url_for('play')}}">
<div id="play" class="center">
JOUER
</div>
</a>
<div class="sep"></div>
<div class="desc title">Historique personnel</div>
{% if bans_hist != [] %}
<ul id="history"> <ul id="history">
{% for entry in bans_hist %} {% for entry in bans_hist %}
<li class="{{ entry[0] }}" class="events"> <li class="{{ entry[0] }}" class="events">
<span class="normal"> {{ entry[1] }}</span> <span class="normal">{{ entry[1] }}</span>
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -21,57 +27,36 @@
<p> <p>
Rien pour l'instant Rien pour l'instant
</p> </p>
{% endif %}
{% endif %} <div class="sep"></div>
<script type="text/javascript">
<script type="text/javascript">
$(function () { $(function () {
Highcharts.chart('container', {
chart: { var ctx = document.getElementById("chart").getContext('2d');
plotBackgroundColor: null, var data = {
plotBorderWidth: 0, datasets: [{
plotShadow: false data: [ {{ stats[0] }}, {{ stats[1] }} ],
}, backgroundColor: ['#ffd7d7', '#d7ebff']
title: { }],
text: 'État du Rézo', labels: ['Tranchés', 'Vivants']
align: 'center', };
verticalAlign: 'middle',
y: 60 var options = {
}, cutoutPercentage: 40,
tooltip: { rotation: -Math.PI,
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' circumference: Math.PI,
}, legend: { labels: { fontSize: 18 }},
plotOptions: { tooltips: { bodyFontSize: 18 }
pie: { };
dataLabels: {
enabled: true, var chart = new Chart(ctx, {
distance: -50, type: 'doughnut',
style: { data: data,
fontWeight: 'bold', options: options
color: 'white'
}
},
startAngle: -90,
endAngle: 90,
center: ['50%', '75%']
},
},
series: [{
type: 'pie',
name: 'État du Rézo',
innerSize: '50%',
data: [
{
name: 'Tranchés',
y: {{ stats[0] }},
color: '#FF0000',
},{
name: 'Vivants',
y: {{ stats[1] }},
color: '#FFCC00',
}
]
}]
}); });
}); });
</script> </script>
{% endblock %} {% endblock %}

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

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