/
reputation.twig
82 lines (74 loc) · 2.23 KB
/
reputation.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<section class="box mt-4">
<div class="card card-default">
<div class="card-body">
<div class="row">
{% if user.reputation > 0 %}
<div class="col-sm-6">
<canvas id="chart"></canvas>
<div class="chart-bar">
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="{{ rank.percentage }}" aria-valuemin="0" aria-valuemax="100" style="width: {{ rank.percentage }}%;">
</div>
<span class="rep"><strong>{{ user.reputation }}</strong> <small>punktów</small></span>
{% if total_users > 0 %}
<span class="rank" title="Miejsce w rankingu"><strong>#{{ rank.rank }}</strong> <small>/ {{ total_users }}</small></span>
{% endif %}
</div>
</div>
</div>
<div class="col-sm-6">
<div id="wrap">
<div id="reputation">
{% include 'profile.partials.reputation_list' %}
</div>
</div>
</div>
{% else %}
<div class="col-12">
<div class="card card-body bg-light p-2 mb-0">
<p class="text-center lead">
Użytkownik nie posiada ani jednego punktu reputacji.<br>
Zobacz, <a href="/Pomoc/Moje_konto/Reputacja">czym jest reputacja</a> i jak mozna ją zdobyć.
</p>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</section>
<script>
{% if user.reputation > 0 %}
new Chart(document.getElementById("chart"), {
type: 'line',
data: {
labels: [
{% for item in chart %}
'{{ item.label }}',
{% endfor %}
],
datasets: [{
label: 'Reputacja z ostatnich 12 miesięcy',
data: [
{% for item in chart %}
{{ item.value }},
{% endfor %}
],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255, 159, 64, 1)',
borderWidth: 1
}]
},
options: {
responsive: true,
scales: {
xAxes: [{
ticks: {
display: false
}
}]
}
}
});
{% endif %}
</script>