Refactor admin user settings page

- Fix header hierarchy
- [frio] Fix panel display
This commit is contained in:
Hypolite Petovan 2020-04-01 19:45:31 -04:00
parent 76feae2203
commit cc15381007
4 changed files with 441 additions and 417 deletions

View File

@ -1,28 +1,30 @@
<script>
function confirm_delete(uname) {
return confirm("{{$confirm_delete}}".format(uname));
}
function confirm_delete_multi() {
return confirm("{{$confirm_delete_multi}}");
}
function selectall(cls) {
$("." + cls).attr('checked', 'checked');
return false;
}
</script>
<div id='adminpage'>
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<form action="{{$baseurl}}/admin/users" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<h3>{{$h_pending}}</h3>
<h2>{{$h_pending}}</h2>
{{if $pending}}
<table id='pending'>
<table id="pending">
<thead>
<tr>
{{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
{{foreach $th_pending as $th}}
<th>{{$th}}</th>{{/foreach}}
<th></th>
<th></th>
</tr>
@ -33,10 +35,16 @@
<td class="created">{{$u.created}}</td>
<td class="name">{{$u.name}}</td>
<td class="email">{{$u.email}}</td>
<td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
<td class="checkbox">
<input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}"/>
</td>
<td class="tools">
<a href="{{$baseurl}}/admin/users/allow/{{$u.uid}}?t={{$form_security_token}}" title='{{$approve}}'><span class='icon like'></span></a>
<a href="{{$baseurl}}/admin/users/deny/{{$u.uid}}?t={{$form_security_token}}" title='{{$deny}}'><span class='icon dislike'></span></a>
<a href="{{$baseurl}}/admin/users/allow/{{$u.uid}}?t={{$form_security_token}}" title="{{$approve}}">
<span class="icon like"></span>
</a>
<a href="{{$baseurl}}/admin/users/deny/{{$u.uid}}?t={{$form_security_token}}" title="{{$deny}}">
<span class="icon dislike"></span>
</a>
</td>
</tr>
<tr>
@ -45,15 +53,18 @@
{{/foreach}}
</tbody>
</table>
<div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
<div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>
<div class="selectall"><a href="#" onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
<div class="submit">
<input type="submit" name="page_users_deny" value="{{$deny}}"/>
<input type="submit" name="page_users_approve" value="{{$approve}}"/>
</div>
{{else}}
<p>{{$no_pending}}</p>
{{/if}}
<h3>{{$h_users}}</h3>
<h2>{{$h_users}}</h2>
{{if $users}}
<table id='users'>
<table id="users">
<thead>
<tr>
<th></th>
@ -69,7 +80,8 @@
{{else}}
&#8597;
{{/if}}
{{$th.0}}</a>
{{$th.0}}
</a>
</th>
{{/foreach}}
<th></th>
@ -79,23 +91,29 @@
<tbody>
{{foreach $users as $u}}
<tr>
<td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td class='email'>{{$u.email}}</td>
<td class='register_date'>{{$u.register_date}}</td>
<td class='login_date'>{{$u.login_date}}</td>
<td class='lastitem_date'>{{$u.lastitem_date}}</td>
<td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}} {{if $u.blocked}}{{$blocked}}{{/if}}</td>
<td><img class="icon" src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class="name"><a href="{{$u.url}}" title="{{$u.nickname}}">{{$u.name}}</a></td>
<td class="email">{{$u.email}}</td>
<td class="register_date">{{$u.register_date}}</td>
<td class="login_date">{{$u.login_date}}</td>
<td class="lastitem_date">{{$u.lastitem_date}}</td>
<td class="login_date">{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}} {{if $u.blocked}}{{$blocked}}{{/if}}</td>
<td class="checkbox">
{{if $u.is_deletable}}
<input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
<input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/>
{{else}}
&nbsp;
{{/if}}
</td>
<td class="tools">
{{if $u.is_deletable}}
<a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon block {{if $u.blocked==0}}dim{{/if}}'></span></a>
<a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon drop'></span></a>
<a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title="{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}">
<span class="icon block {{if $u.blocked==0}}dim{{/if}}"></span>
</a>
<a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title="{{$delete}}" onclick="return confirm_delete('{{$u.name}}')">
<span class="icon drop"></span>
</a>
{{else}}
&nbsp;
{{/if}}
@ -104,7 +122,7 @@
{{/foreach}}
</tbody>
</table>
<div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
<div class="selectall"><a href="#" onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
<div class="submit">
<input type="submit" name="page_users_block" value="{{$block}}"/>
<input type="submit" name="page_users_unblock" value="{{$unblock}}"/>
@ -115,33 +133,35 @@
{{/if}}
</form>
{{if $deleted}}
<h3>{{$h_deleted}}</h3>
<table id='deleted'>
<h2>{{$h_deleted}}</h2>
<table id="deleted">
<thead>
<tr>
<th></th>
{{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
{{foreach $th_deleted as $th}}
<th>{{$th}}</th>
{{/foreach}}
</tr>
</thead>
<tbody>
{{foreach $deleted as $u}}
<tr>
<td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td class='email'>{{$u.email}}</td>
<td class='register_date'>{{$u.register_date}}</td>
<td class='login_date'>{{$u.login_date}}</td>
<td class='lastitem_date'>{{$u.lastitem_date}}</td>
<td class='login_date'>{{$u.deleted}}</td>
<td><img class="icon" src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class="name"><a href="{{$u.url}}" title="{{$u.nickname}}">{{$u.name}}</a></td>
<td class="email">{{$u.email}}</td>
<td class="register_date">{{$u.register_date}}</td>
<td class="login_date">{{$u.login_date}}</td>
<td class="lastitem_date">{{$u.lastitem_date}}</td>
<td class="login_date">{{$u.deleted}}</td>
</tr>
{{/foreach}}
</tbody>
</table>
{{/if}}
<h3>{{$h_newuser}}</h3>
<h2>{{$h_newuser}}</h2>
<form action="{{$baseurl}}/admin/users" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<table id='users'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<table id="users">
<tbody>
<tr>
<td>{{include file="field_input.tpl" field=$newusername}}</td>

View File

@ -1,6 +1,5 @@
#admin-users.adminpage > h1 { padding: 0 15px; }
#admin-users.adminpage .panel-collapse { margin-left: -15px; margin-right: -15px; }
#adminpage.adminpage > h1 { padding: 0 15px; }
@ -18,5 +17,8 @@ tr.details th {
border-top: 0!important;
}
.adminpage td > .checkbox { margin: 0; }
.adminpage td > .checkbox,
.adminpage th > .checkbox {
margin: 0;
}
.adminpage td { word-break: break-all; }

View File

@ -18,12 +18,12 @@
**
-->
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="admin-settings-pending">
<h4>
<div class="section-subtitle-wrapper panel-heading" role="tab" id="admin-settings-pending">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-pending-collapse" aria-expanded="{{if count($pending) > 0}}true{{else}}false{{/if}}" aria-controls="admin-settings-pending-collapse">
{{$h_pending}} ({{count($pending)}})
</a>
</h4>
</h2>
</div>
<div id="admin-settings-pending-collapse" class="panel-collapse collapse {{if count($pending) > 0}}in{{/if}}" role="tabpanel" aria-labelledby="admin-settings-pending">
@ -31,7 +31,12 @@
<table id="pending" class="table table-hover">
<thead>
<tr>
<th></th>
<th>
<div class="checkbox">
<input type="checkbox" id="admin-settings-pending-select" class="selecttoggle" data-select-class="pending_ckbx"/>
<label for="admin-settings-pending-select"></label>
</div>
</th>
{{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
<th></th>
</tr>
@ -64,14 +69,6 @@
</tbody>
</table>
<div class="panel-footer">
<div class="row">
<div class="col-xs-3 admin-settings-footer-elements">
<div class="checkbox">
<input type="checkbox" id="admin-settings-pending-select" class="selecttoggle" data-select-class="pending_ckbx"/>
<label for="admin-settings-pending-select"></label>
</div>
</div>
<div class="col-xs-9 admin-settings-footer-elements text-right">
<button type="submit" name="page_users_deny" value="1" class="btn btn-primary">
<i class="fa fa-trash-o" aria-hidden="true"></i> {{$deny}}
</button>
@ -79,8 +76,6 @@
<i class="fa fa-check" aria-hidden="true"></i> {{$approve}}
</button>
</div>
</div>
</div>
{{else}}
<div class="panel-body text-center text-muted">{{$no_pending}}</div>
{{/if}}
@ -95,22 +90,26 @@
**
-->
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="admin-settings-user">
<h4>
<div class="section-subtitle-wrapper panel-heading" role="tab" id="admin-settings-user">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-user-collapse" aria-expanded="false" aria-controls="admin-settings-user-collapse">
{{$h_users}} ({{count($users)}})
</a>
</h4>
</h2>
</div>
<div id="admin-settings-user-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-user">
{{if $users}}
<div class="panel-body">
<table id="users" class="table table-hover">
<thead>
<tr>
<th></th>
<th>
<div class="checkbox">
<input type="checkbox" id="admin-settings-users-select" class="selecttoggle" data-select-class="users_ckbx"/>
<label for="admin-settings-users-select"></label>
</div>
</th>
<th></th>
{{foreach $th_users as $k=>$th}}
{{if $k < 2 || $order_users == $th.1 || ($k==5 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.4.1])) }}
@ -243,20 +242,7 @@
{{/foreach}}
</tbody>
</table>
</div>
{{else}}
<div class="panel-body text-center bg-danger">NO USERS?!?</div>
{{/if}}
<div class="panel-footer">
{{if $users}}
<div class="row">
<div class="col-xs-3 admin-settings-footer-elements">
<div class="checkbox">
<input type="checkbox" id="admin-settings-users-select" class="selecttoggle" data-select-class="users_ckbx"/>
<label for="admin-settings-users-select"></label>
</div>
</div>
<div class="col-xs-9 admin-settings-footer-elements text-right">
<button type="submit" name="page_users_block" value="1" class="btn btn-warning">
<i class="fa fa-ban" aria-hidden="true"></i> {{$block}}
</button>
@ -267,12 +253,11 @@
<i class="fa fa-trash" aria-hidden="true"></i> {{$delete}}
</button>
</div>
</div>
{{else}}
<div class="panel-body text-center bg-danger">NO USERS?!?</div>
{{/if}}
</div>
</div>
</div>
<!--
**
@ -283,12 +268,12 @@
-->
{{if $deleted}}
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="admin-settings-deleted">
<h4>
<div class="section-subtitle-wrapper panel-heading" role="tab" id="admin-settings-deleted">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-deleted-collapse" aria-expanded="false" aria-controls="admin-settings-deleted-collapse">
{{$h_deleted}} ({{count($deleted)}})
</a>
</h4>
</h2>
</div>
<div id="admin-settings-deleted-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-deleted">
@ -328,12 +313,12 @@
**
-->
<div class="panel">
<div class="section-subtitle-wrapper" role="tab" id="admin-settings-new-user">
<h4>
<div class="section-subtitle-wrapper panel-heading" role="tab" id="admin-settings-new-user">
<h2>
<a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-new-user-collapse" aria-expanded="false" aria-controls="admin-settings-new-user-collapse">
{{$h_newuser}}
</a>
</h4>
</h2>
</div>
<div id="admin-settings-new-user-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="admin-settings-new-user">
@ -342,11 +327,9 @@
{{include file="field_input.tpl" field=$newusernickname}}
{{include file="field_input.tpl" field=$newuseremail}}
</div>
<div class="panel-footer text-right">
<div class="panel-footer">
<button type="submit" class="btn btn-primary">{{$submit}}</button>
</div>
</div>
</div>
</div>

View File

@ -1,28 +1,31 @@
<script>
function confirm_delete(uname) {
return confirm("{{$confirm_delete}}".format(uname));
}
function confirm_delete_multi() {
return confirm("{{$confirm_delete_multi}}");
}
function selectall(cls) {
$("." + cls).attr('checked', 'checked');
return false;
}
</script>
<div id='adminpage'>
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<form action="{{$baseurl}}/admin/users" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<h3>{{$h_pending}}</h3>
<h2>{{$h_pending}}</h2>
{{if $pending}}
<table id='pending'>
<table id="pending">
<thead>
<tr>
{{foreach $th_pending as $th}}<th>{{$th}}</th>{{/foreach}}
{{foreach $th_pending as $th}}
<th>{{$th}}</th>
{{/foreach}}
<th></th>
<th></th>
</tr>
@ -33,10 +36,16 @@
<td class="created">{{$u.created}}</td>
<td class="name">{{$u.name}}</td>
<td class="email">{{$u.email}}</td>
<td class="checkbox"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}" /></td>
<td class="checkbox">
<input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}"/>
</td>
<td class="tools">
<a href="{{$baseurl}}/admin/users/allow/{{$u.uid}}?t={{$form_security_token}}" title='{{$approve}}'><span class='icon like'></span></a>
<a href="{{$baseurl}}/admin/users/deny/{{$u.uid}}?t={{$form_security_token}}" title='{{$deny}}'><span class='icon dislike'></span></a>
<a href="{{$baseurl}}/admin/users/allow/{{$u.uid}}?t={{$form_security_token}}" title="{{$approve}}">
<span class="icon like"></span>
</a>
<a href="{{$baseurl}}/admin/users/deny/{{$u.uid}}?t={{$form_security_token}}" title="{{$deny}}">
<span class="icon dislike"></span>
</a>
</td>
</tr>
<tr>
@ -45,15 +54,17 @@
{{/foreach}}
</tbody>
</table>
<div class='selectall'><a href='#' onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
<div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/> <input type="submit" name="page_users_approve" value="{{$approve}}" /></div>
<div class="selectall"><a href="#" onclick="return selectall('pending_ckbx');">{{$select_all}}</a></div>
<div class="submit"><input type="submit" name="page_users_deny" value="{{$deny}}"/>
<input type="submit" name="page_users_approve" value="{{$approve}}"/>
</div>
{{else}}
<p>{{$no_pending}}</p>
{{/if}}
<h3>{{$h_users}}</h3>
<h2>{{$h_users}}</h2>
{{if $users}}
<table id='users'>
<table id="users">
<thead>
<tr>
<th></th>
@ -69,7 +80,8 @@
{{else}}
&#8597;
{{/if}}
{{$th.0}}</a>
{{$th.0}}
</a>
</th>
{{/foreach}}
<th></th>
@ -79,23 +91,28 @@
<tbody>
{{foreach $users as $u}}
<tr>
<td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td class='email'>{{$u.email}}</td>
<td class='register_date'>{{$u.register_date}}</td>
<td class='login_date'>{{$u.login_date}}</td>
<td class='lastitem_date'>{{$u.lastitem_date}}</td>
<td class='login_date'>{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
<td><img class="icon" src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class="name"><a href="{{$u.url}}" title="{{$u.nickname}}">{{$u.name}}</a></td>
<td class="email">{{$u.email}}</td>
<td class="register_date">{{$u.register_date}}</td>
<td class="login_date">{{$u.login_date}}</td>
<td class="lastitem_date">{{$u.lastitem_date}}</td>
<td class="login_date">{{$u.page_flags}} {{if $u.is_admin}}({{$siteadmin}}){{/if}} {{if $u.account_expired}}({{$accountexpired}}){{/if}}</td>
<td class="checkbox">
{{if $u.is_deletable}}
<input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/></td>
<input type="checkbox" class="users_ckbx" id="id_user_{{$u.uid}}" name="user[]" value="{{$u.uid}}"/>
{{else}}
&nbsp;
{{/if}}
</td>
<td class="tools">
{{if $u.is_deletable}}
<a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title='{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}'><span class='icon {{if $u.blocked==0}}unlock{{else}}lock{{/if}}'></span></a>
<a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title='{{$delete}}' onclick="return confirm_delete('{{$u.name}}')"><span class='icon delete'></span></a>
<a href="{{$baseurl}}/admin/users/block/{{$u.uid}}?t={{$form_security_token}}" title="{{if $u.blocked}}{{$unblock}}{{else}}{{$block}}{{/if}}">
<span class="icon {{if $u.blocked==0}}unlock{{else}}lock{{/if}}"></span>
</a>
<a href="{{$baseurl}}/admin/users/delete/{{$u.uid}}?t={{$form_security_token}}" title="{{$delete}}" onclick="return confirm_delete('{{$u.name}}')">
<span class="icon delete"></span>
</a>
{{else}}
&nbsp;
{{/if}}
@ -104,7 +121,7 @@
{{/foreach}}
</tbody>
</table>
<div class='selectall'><a href='#' onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
<div class="selectall"><a href="#" onclick="return selectall('users_ckbx');">{{$select_all}}</a></div>
<div class="submit">
<input type="submit" name="page_users_block" value="{{$block}}"/>
<input type="submit" name="page_users_unblock" value="{{$unblock}}"/>
@ -115,33 +132,35 @@
{{/if}}
</form>
{{if $deleted}}
<h3>{{$h_deleted}}</h3>
<table id='deleted'>
<h2>{{$h_deleted}}</h2>
<table id="deleted">
<thead>
<tr>
<th></th>
{{foreach $th_deleted as $th}}<th>{{$th}}</th>{{/foreach}}
{{foreach $th_deleted as $th}}
<th>{{$th}}</th>
{{/foreach}}
</tr>
</thead>
<tbody>
{{foreach $deleted as $u}}
<tr>
<td><img class='icon' src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class='name'><a href="{{$u.url}}" title="{{$u.nickname}}" >{{$u.name}}</a></td>
<td class='email'>{{$u.email}}</td>
<td class='register_date'>{{$u.register_date}}</td>
<td class='login_date'>{{$u.login_date}}</td>
<td class='lastitem_date'>{{$u.lastitem_date}}</td>
<td class='login_date'>{{$u.deleted}}</td>
<td><img class="icon" src="{{$u.micro}}" alt="{{$u.nickname}}" title="{{$u.nickname}}"></td>
<td class="name"><a href="{{$u.url}}" title="{{$u.nickname}}">{{$u.name}}</a></td>
<td class="email">{{$u.email}}</td>
<td class="register_date">{{$u.register_date}}</td>
<td class="login_date">{{$u.login_date}}</td>
<td class="lastitem_date">{{$u.lastitem_date}}</td>
<td class="login_date">{{$u.deleted}}</td>
</tr>
{{/foreach}}
</tbody>
</table>
{{/if}}
<h3>{{$h_newuser}}</h3>
<h2>{{$h_newuser}}</h2>
<form action="{{$baseurl}}/admin/users" method="post">
<input type='hidden' name='form_security_token' value='{{$form_security_token}}'>
<table id='users'>
<input type="hidden" name="form_security_token" value="{{$form_security_token}}">
<table id="users">
<tbody>
<tr>
<td>{{include file="field_input.tpl" field=$newusername}}</td>