Fix #17 - responsive tables

This commit is contained in:
Vojtěch Sajdl 2018-03-10 01:15:47 +01:00
parent f32c9458bc
commit daa3f06fe9
No known key found for this signature in database
GPG Key ID: 5D4EB1361A272390
2 changed files with 67 additions and 71 deletions

View File

@ -16,37 +16,38 @@ Template::render_header(_("Settings"), true);
</div> </div>
<?php <?php
if (isset($message)){ if (isset($message)){
?> ?>
<p class="alert alert-danger"><?php echo $message; ?></p> <p class="alert alert-danger"><?php echo $message; ?></p>
<?php }?> <?php }?>
<section> <section>
<h3 class="pull-left"><?php echo _("Services");?></h3> <h3 class="pull-left"><?php echo _("Services");?></h3>
<?php if ($user->get_rank() <= 1){?> <?php if ($user->get_rank() <= 1){?>
<form action="?do=settings&new=service" method="post"> <form action="?do=settings&new=service" method="post">
<div class="input-group pull-right new-service"> <div class="input-group pull-right new-service">
<input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service']):''); ?>" maxlength="50" required> <input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service']):''); ?>" maxlength="50" required>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="submit" class="btn btn-success pull-right"><?php echo _("Add service");?></button> <button type="submit" class="btn btn-success pull-right"><?php echo _("Add service");?></button>
</span> </span>
</div> </div>
</form> </form>
<?php }?> <?php }?>
<table class="table"> <div class="table-responsive">
<table class="table">
<thead><tr> <thead><tr>
<th scope="col"><?php echo _("ID");?></th> <th scope="col"><?php echo _("ID");?></th>
<th scope="col"><?php echo _("Name");?></th> <th scope="col"><?php echo _("Name");?></th>
<?php if ($user->get_rank()<=1) <?php if ($user->get_rank()<=1)
{?> {?>
<th scope="col"><?php echo _("Delete");?></th> <th scope="col"><?php echo _("Delete");?></th>
<?php } ?> <?php } ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
$query = $mysqli->query("SELECT * FROM services"); $query = $mysqli->query("SELECT * FROM services");
while($result = $query->fetch_assoc()) while($result = $query->fetch_assoc())
{ {
echo "<tr>"; echo "<tr>";
echo "<td>".$result['id']."</td>"; echo "<td>".$result['id']."</td>";
echo "<td>".$result['name']."</td>"; echo "<td>".$result['name']."</td>";
@ -55,23 +56,25 @@ while($result = $query->fetch_assoc())
echo '<td><a href="'.WEB_URL.'/admin/?do=settings&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>'; echo '<td><a href="'.WEB_URL.'/admin/?do=settings&delete='.$result['id'].'" class="pull-right delete-service"><i class="fa fa-trash"></i></a></td>';
} }
echo "</tr>"; echo "</tr>";
}?> }?>
</tbody> </tbody>
</table> </table>
</div>
</section> </section>
<section> <section>
<h3 class="pull-left"><?php echo _("Users");?></h3> <h3 class="pull-left"><?php echo _("Users");?></h3>
<?php if ($user->get_rank() == 0){?> <a href="<?php echo WEB_URL;?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?> <?php if ($user->get_rank() == 0){?> <a href="<?php echo WEB_URL;?>/admin/?do=new-user" class="btn btn-success pull-right"><?php echo _("Add new user");?></a><?php }?>
<table class="table"> <div class="table-responsive">
<table class="table">
<thead><tr><th scope="col"><?php echo _("ID");?></th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead> <thead><tr><th scope="col"><?php echo _("ID");?></th><th scope="col"><?php echo _("Username");?></th><th scope="col"><?php echo _("Name");?></th><th scope="col"><?php echo _("Surname");?></th><th scope="col"><?php echo _("Email");?></th><th scope="col"><?php echo _("Role");?></th><th scope="col">Active</th></tr></thead>
<tbody> <tbody>
<?php <?php
$query = $mysqli->query("SELECT * FROM users"); $query = $mysqli->query("SELECT * FROM users");
while($result = $query->fetch_assoc()) while($result = $query->fetch_assoc())
{ {
echo "<tr>"; echo "<tr>";
echo "<td>".$result['id']."</td>"; echo "<td>".$result['id']."</td>";
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>"; echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
@ -82,7 +85,8 @@ while($result = $query->fetch_assoc())
echo "<i class='fa fa-".($result['active']?"check success":"times danger")."'></i>"; echo "<i class='fa fa-".($result['active']?"check success":"times danger")."'></i>";
echo "</td>"; echo "</td>";
echo "</tr>"; echo "</tr>";
}?> }?>
</tbody> </tbody>
</table> </table>
</div>
</section> </section>

View File

@ -117,8 +117,6 @@ div.center {
.service{ .service{
float: left; float: left;
box-sizing: border-box; box-sizing: border-box;
width:60%;
min-width: 200px;
padding: 15px 35px; padding: 15px 35px;
font-weight: bold; font-weight: bold;
font-size: 1.1em; font-size: 1.1em;
@ -132,10 +130,8 @@ a h1{
} }
.status{ .status{
float: left; float: right;
box-sizing: border-box; box-sizing: border-box;
width:40%;
min-width: 150px;
padding: 15px 35px; padding: 15px 35px;
text-align: right; text-align: right;
font-size: 1.05em; font-size: 1.05em;
@ -474,10 +470,6 @@ body .panel-heading input::placeholder{
vertical-align: middle; vertical-align: middle;
} }
body.admin{
min-width: 500px
}
body.admin table td{ body.admin table td{
word-break: break-all; word-break: break-all;
} }