Skip to content

Commit 11ceff3

Browse files
authored
Search for members by email address (#63)
1 parent 45e43f2 commit 11ceff3

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

resources/views/members/index.blade.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<table class="table table-striped" id="data-table">
1717
<thead><tr>
1818
<th>Name</th>
19+
<th>Email</th>
1920
<th>Joined</th>
2021
<th>Status</th>
2122
<th>Team(s)</th>
@@ -25,6 +26,7 @@
2526
@foreach($users as $user)
2627
<tr>
2728
<td>{{ $user->get_name() }}</td>
29+
<td>{{ $user->email }}</td>
2830
<td nowrap>@isset($user->date_admitted) {{ $user->date_admitted->toDateString() }} @endisset</td>
2931
<td>@include('users.status')
3032
@php ($roles = $user->roles()->get())
@@ -73,8 +75,18 @@
7375
iDisplayLength: {{ config('kwartzlabos.results_per_page.default') }},
7476
"language": {
7577
"emptyTable": "No results???"
76-
}
78+
},
79+
// Enable member search by email without displaying the email address.
80+
columnDefs: [{
81+
targets: 1, // Email column
82+
visible: false
83+
}]
7784
});
85+
86+
// Hiding a column with data tables gives the table a goofy behaviour where the table itself shrinks in width.
87+
// This is a known issue where the "fix" is to reset the table back to full width once the column has been
88+
// hidden.
89+
$('#data-table').width('100%');
7890
});
7991
</script>
8092
@stop

resources/views/users/index.blade.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<thead><tr>
2626
<th scope="col">First Name</th>
2727
<th scope="col">Last Name</th>
28+
<th scope="col">Email</th>
2829
<th scope="col">Status / Role</th>
2930
<th scope="col">Team(s)</th>
3031
<th scope="col"># Keys</th>
@@ -35,6 +36,7 @@
3536
<tr>
3637
<td>{{ $user->get_name('first') }}</td>
3738
<td>{{ $user->get_name('last') }}</td>
39+
<td>{{ $user->email }}</td>
3840
<td>@include('users.status')
3941
@foreach($user->roles()->get() as $role)
4042
@if($role->id>1)
@@ -73,15 +75,14 @@
7375
@section('js')
7476
<script>
7577
$(document).ready(function () {
76-
$('#data-table').dataTable({
78+
$('#data-table').dataTable({
7779
ordering: false,
7880
pagingType: "simple_numbers",
7981
iDisplayLength: {{ config('kwartzlabos.results_per_page.default') }},
8082
"language": {
81-
"emptyTable": "No results."
83+
"emptyTable": "No results."
8284
}
83-
});
84-
85+
});
8586
});
8687
8788
function modal_do_stuff_success(data) {

0 commit comments

Comments
 (0)