Skip to content

Commit daa3f06

Browse files
committed
Fix #17 - responsive tables
1 parent f32c945 commit daa3f06

File tree

2 files changed

+67
-71
lines changed

2 files changed

+67
-71
lines changed

admin/settings.php

Lines changed: 66 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -12,77 +12,81 @@
1212
Template::render_header(_("Settings"), true);
1313
?>
1414
<div class="text-center">
15-
<h2>Settings</h2>
15+
<h2>Settings</h2>
1616
</div>
1717
<?php
1818
if (isset($message)){
19-
?>
19+
?>
2020
<p class="alert alert-danger"><?php echo $message; ?></p>
2121
<?php }?>
2222
<section>
23-
<h3 class="pull-left"><?php echo _("Services");?></h3>
24-
<?php if ($user->get_rank() <= 1){?>
25-
<form action="?do=settings&new=service" method="post">
26-
<div class="input-group pull-right new-service">
27-
<input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service']):''); ?>" maxlength="50" required>
28-
<span class="input-group-btn">
29-
<button type="submit" class="btn btn-success pull-right"><?php echo _("Add service");?></button>
30-
</span>
23+
<h3 class="pull-left"><?php echo _("Services");?></h3>
24+
<?php if ($user->get_rank() <= 1){?>
25+
<form action="?do=settings&new=service" method="post">
26+
<div class="input-group pull-right new-service">
27+
<input class="form-control" name="service" placeholder="Name" type="text" value="<?php echo ((isset($_POST['service']))?htmlspecialchars($_POST['service']):''); ?>" maxlength="50" required>
28+
<span class="input-group-btn">
29+
<button type="submit" class="btn btn-success pull-right"><?php echo _("Add service");?></button>
30+
</span>
31+
</div>
32+
</form>
33+
<?php }?>
34+
<div class="table-responsive">
35+
<table class="table">
36+
37+
<thead><tr>
38+
<th scope="col"><?php echo _("ID");?></th>
39+
<th scope="col"><?php echo _("Name");?></th>
40+
<?php if ($user->get_rank()<=1)
41+
{?>
42+
<th scope="col"><?php echo _("Delete");?></th>
43+
<?php } ?>
44+
</tr>
45+
</thead>
46+
<tbody>
47+
<?php
48+
$query = $mysqli->query("SELECT * FROM services");
49+
while($result = $query->fetch_assoc())
50+
{
51+
echo "<tr>";
52+
echo "<td>".$result['id']."</td>";
53+
echo "<td>".$result['name']."</td>";
54+
if ($user->get_rank()<=1)
55+
{
56+
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>';
57+
}
58+
echo "</tr>";
59+
}?>
60+
</tbody>
61+
</table>
3162
</div>
32-
</form>
33-
<?php }?>
34-
<table class="table">
35-
36-
<thead><tr>
37-
<th scope="col"><?php echo _("ID");?></th>
38-
<th scope="col"><?php echo _("Name");?></th>
39-
<?php if ($user->get_rank()<=1)
40-
{?>
41-
<th scope="col"><?php echo _("Delete");?></th>
42-
<?php } ?>
43-
</tr>
44-
</thead>
45-
<tbody>
46-
<?php
47-
$query = $mysqli->query("SELECT * FROM services");
48-
while($result = $query->fetch_assoc())
49-
{
50-
echo "<tr>";
51-
echo "<td>".$result['id']."</td>";
52-
echo "<td>".$result['name']."</td>";
53-
if ($user->get_rank()<=1)
54-
{
55-
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>';
56-
}
57-
echo "</tr>";
58-
}?>
59-
</tbody>
60-
</table>
6163
</section>
6264

6365

6466
<section>
65-
<h3 class="pull-left"><?php echo _("Users");?></h3>
66-
<?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 }?>
67-
<table class="table">
68-
69-
<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>
70-
<tbody>
71-
<?php
72-
$query = $mysqli->query("SELECT * FROM users");
73-
while($result = $query->fetch_assoc())
74-
{
75-
echo "<tr>";
76-
echo "<td>".$result['id']."</td>";
77-
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
78-
echo "<td>".$result['name']."</td>";
79-
echo "<td>".$result['surname']."</td>";
80-
echo "<td><a href=\"mailto:".$result['email']."\">".$result['email']."</a></td>";
81-
echo "<td>".$permissions[$result['permission']]."</td><td>";
82-
echo "<i class='fa fa-".($result['active']?"check success":"times danger")."'></i>";
83-
echo "</td>";
84-
echo "</tr>";
85-
}?>
86-
</tbody>
87-
</table>
67+
<h3 class="pull-left"><?php echo _("Users");?></h3>
68+
<?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 }?>
69+
<div class="table-responsive">
70+
<table class="table">
71+
72+
<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>
73+
<tbody>
74+
<?php
75+
$query = $mysqli->query("SELECT * FROM users");
76+
while($result = $query->fetch_assoc())
77+
{
78+
echo "<tr>";
79+
echo "<td>".$result['id']."</td>";
80+
echo "<td><a href='".WEB_URL."/admin/?do=user&id=".$result['id']."'>".$result['username']."</a></td>";
81+
echo "<td>".$result['name']."</td>";
82+
echo "<td>".$result['surname']."</td>";
83+
echo "<td><a href=\"mailto:".$result['email']."\">".$result['email']."</a></td>";
84+
echo "<td>".$permissions[$result['permission']]."</td><td>";
85+
echo "<i class='fa fa-".($result['active']?"check success":"times danger")."'></i>";
86+
echo "</td>";
87+
echo "</tr>";
88+
}?>
89+
</tbody>
90+
</table>
91+
</div>
8892
</section>

css/main.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ div.center {
117117
.service{
118118
float: left;
119119
box-sizing: border-box;
120-
width:60%;
121-
min-width: 200px;
122120
padding: 15px 35px;
123121
font-weight: bold;
124122
font-size: 1.1em;
@@ -132,10 +130,8 @@ a h1{
132130
}
133131

134132
.status{
135-
float: left;
133+
float: right;
136134
box-sizing: border-box;
137-
width:40%;
138-
min-width: 150px;
139135
padding: 15px 35px;
140136
text-align: right;
141137
font-size: 1.05em;
@@ -474,10 +470,6 @@ body .panel-heading input::placeholder{
474470
vertical-align: middle;
475471
}
476472

477-
body.admin{
478-
min-width: 500px
479-
}
480-
481473
body.admin table td{
482474
word-break: break-all;
483475
}

0 commit comments

Comments
 (0)