Add new scores at the top of he list instead of the bottom

This commit is contained in:
Keplyx 2018-08-27 10:51:21 +02:00
parent a4947bbbeb
commit a9d3ca6fb7
3 changed files with 51 additions and 23 deletions

View file

@ -29,7 +29,7 @@
cursor: pointer;
}
.stats-toggle#toggle-usa, .edit-stats.stats-usa th {
.stats-toggle#toggle-usa {
background-color: #1a5dad;
border-color: #1a5dad;
-webkit-transition: 0.3s;
@ -45,7 +45,7 @@
box-shadow: 0 0 10px #1f6fce;
}
.stats-toggle#toggle-urss, .edit-stats.stats-urss th {
.stats-toggle#toggle-urss {
background-color: #d72229;
border-color: #d72229;
-webkit-transition: 0.3s;
@ -86,14 +86,22 @@
border-bottom: 1px solid #620f12;
}
.stat-log {
.stat-log, .edit-header.stat-log {
width: 80%;
}
.edit-header .stat-log {
width: 70%;
}
.stat-points {
width: 20%;
}
.edit-header .stat-points {
width: 20%;
}
#positive{
color: #ffffff;
font-weight: bold;
@ -108,6 +116,26 @@
margin: 10px;
}
.edit-header {
display: flex;
text-align: center;
background-color: #adaca8;
color: #1c1c1c;
font-weight: bold;
}
.edit-header .stat-trash {
margin: auto;
}
.edit-text {
width: 70%;
}
.edit-points{
width: 20%;
}
.edit-button {
width: auto;
color: #fafafa;
@ -173,7 +201,8 @@ input {
}
.remove-line:hover {
color: #ff4000;
color: #ff5e00;
text-shadow: 0 0 5px #ff4000;
}
.add-line{
@ -181,9 +210,9 @@ input {
color: #fafafa;
cursor: pointer;
transition: 0.3s;
margin: 1% 1% 1% 1%;
width: 100%;
border-radius: 5px;
margin: 30px 0 20px 0;
}
#add-line-usa {
@ -192,6 +221,7 @@ input {
.add-line#add-line-usa:hover {
background: #53bbfc;
box-shadow: 0 0 5px #53bbfc;
}
#add-line-urss {
@ -200,6 +230,7 @@ input {
.add-line#add-line-urss:hover {
background: #ee293d;
box-shadow: 0 0 5px #ee293d;
}
.save-score {
@ -208,13 +239,14 @@ input {
color: #fafafa;
cursor: pointer;
transition: 0.3s;
margin: 30px 1% 1% 1%;
margin: 40px 0 0 0;
width: 100%;
border-radius: 5px;
}
.save-score:hover {
background: #2ce20b;
box-shadow: 0 0 5px #2ce20b;
}
.score-nav{

View file

@ -64,21 +64,17 @@ if (!isset($team))
<p>
<?= $description ?>
</p>
<table class="stats-table edit-stats stats-<?= $team ?>">
<tr>
<th colspan="3"><?= strtoupper($team) ?></th>
</tr>
<tr>
<td class="stat-log">Log</td>
<td class="stat-points">Points</td>
<td class="stat-points"><i class='fas fa-trash'></i></td>
</tr>
<?php get_stats($team) ?>
</table>
<div class="add-line" id="add-line-<?= $team ?>">
<i class="fas fa-plus"></i>
</div>
<div class="edit-header">
<div class="stat-log">Log</div>
<div class="stat-points">Points</div>
<div class="stat-trash"><i class='fas fa-trash'></i></div>
</div>
<table class="stats-table edit-stats stats-<?= $team ?>">
<?php get_stats($team) ?>
</table>
<div class="save-score">
<i class="fas fa-save"></i> Enregistrer
@ -105,8 +101,8 @@ function get_stats($team)
$points = $row['points'];
?>
<tr class="entry">
<td class><input type='text' value="<?= $text ?>"/></td>
<td><input type='number' value="<?= $points ?>"/></td>
<td class="edit-text"><input type='text' value="<?= $text ?>"/></td>
<td class="edit-points"><input type='number' value="<?= $points ?>"/></td>
<td class='remove-line'><i class="fas fa-trash"></td>
</tr>
<?php

View file

@ -1,10 +1,10 @@
$(document).ready(function () {
$(".add-line").click(function () {
$(".stats-table")
.append("<tr class='entry'>" +
"<td>" +
.prepend("<tr class='entry'>" +
"<td class=\"edit-text\">" +
"<input type='text' value='text''></td>" +
"<td><input type='number' value='0'></td>" +
"<td class=\"edit-points\"><input type='number' value='0'></td>" +
"<td class='remove-line'>" +
"<i class='fas fa-trash'></i>" +
"</td>" +