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

View file

@ -64,21 +64,17 @@ if (!isset($team))
<p> <p>
<?= $description ?> <?= $description ?>
</p> </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 ?>"> <div class="add-line" id="add-line-<?= $team ?>">
<i class="fas fa-plus"></i> <i class="fas fa-plus"></i>
</div> </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"> <div class="save-score">
<i class="fas fa-save"></i> Enregistrer <i class="fas fa-save"></i> Enregistrer
@ -105,8 +101,8 @@ function get_stats($team)
$points = $row['points']; $points = $row['points'];
?> ?>
<tr class="entry"> <tr class="entry">
<td class><input type='text' value="<?= $text ?>"/></td> <td class="edit-text"><input type='text' value="<?= $text ?>"/></td>
<td><input type='number' value="<?= $points ?>"/></td> <td class="edit-points"><input type='number' value="<?= $points ?>"/></td>
<td class='remove-line'><i class="fas fa-trash"></td> <td class='remove-line'><i class="fas fa-trash"></td>
</tr> </tr>
<?php <?php

View file

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