Improve page contacblock for frio theme

This commit is contained in:
Hypolite Petovan 2017-12-01 22:33:04 -05:00
parent 8826ece55e
commit 75181322ba
4 changed files with 44 additions and 16 deletions

View file

@ -441,6 +441,7 @@ function admin_page_contactblock(App $a)
'$baseurl' => System::baseUrl(true),
'$contacts' => $contacts,
'$total_contacts' => tt('%s total blocked contact', '%s total blocked contacts', $total),
'$paginate' => paginate($a),
'$contacturl' => ['contact_url', t("Profile URL"), '', t("URL of the remote contact to block.")],
));

View file

@ -1,4 +1,3 @@
<script>
function selectall(cls) {
$('.' + cls).prop('checked', true);

View file

@ -0,0 +1,31 @@
/**
* @brief Javascript for the admin module
*/
$(function() {
$('body').on('click', '.selectall', function() {
selectall($(this).data('selectAll'));
});
$('body').on('click', '.selectnone', function() {
selectnone($(this).data('selectNone'));
});
$('body').on('change', 'input[type=checkbox].select', function() {
$this = $(this);
if ($this.prop('checked')) {
selectall($this.data('selectClass'));
$this.attr('title', $this.data('selectNone'));
} else {
selectnone($this.data('selectClass'));
$this.attr('title', $this.data('selectAll'));
}
});
function selectall(cls) {
$('.' + cls).prop('checked', true);
return false;
}
function selectnone(cls) {
$('.' + cls).prop('checked', false);
return false;
}
});

View file

@ -1,14 +1,4 @@
<script>
function selectall(cls) {
$('.' + cls).prop('checked', true);
return false;
}
function selectnone(cls) {
$('.' + cls).prop('checked', false);
return false;
}
</script>
<script type="text/javascript" src="view/theme/frio/js/mod_admin.js"></script>
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<p>{{$description}}</p>
@ -20,7 +10,7 @@
<table id="contactblock" class="table table-condensed table-striped">
<thead>
<tr>
<th></th>
<th><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}" data-select-none="{{$select_none}}" title="{{$select_all}}"/></th>
{{foreach $th_contacts as $th}}
<th>
{{$th}}
@ -39,10 +29,17 @@
</tr>
{{/foreach}}
</tbody>
<tfoot>
<tr>
<td><input type="checkbox" class="select contacts_ckbx" data-select-class="contacts_ckbx" data-select-all="{{$select_all}}" data-select-none="{{$select_none}}" title="{{$select_all}}"/></td>
<td colspan="3">
{{$total_contacts}}
</td>
</tr>
</tfoot>
</table>
<p><a href="#" onclick="return selectall('contacts_ckbx');">{{$select_all}}</a> | <a href="#" onclick="return selectnone('contacts_ckbx');">{{$select_none}}</a></p>
<div class="submit"><button type="submit" class="btn btn-small btn-default" name="page_contactblock_unblock" value="1">{{$unblock|escape:'html'}}</button></div>
{{$paginate}}
<div class="submit"><input type="submit" name="page_contactblock_unblock" value="{{$unblock|escape:'html'}}" /></div>
{{else}}
<p>{{$no_data|escape:'html'}}</p>
{{/if}}
@ -58,6 +55,6 @@
</tr>
</tbody>
</table>
<div class="submit"><input type="submit" name="page_contactblock_block" value="{{$submit|escape:'html'}}" /></div>
<div class="submit"><button type="submit" class="btn btn-primary" name="page_contactblock_block" value="1">{{$submit|escape:'html'}}</button></div>
</form>
</div>