Skip to content

Commit

Permalink
Fix filter properties to search for.
Browse files Browse the repository at this point in the history
  • Loading branch information
kiarn committed Oct 10, 2020
1 parent 2e0065e commit e10a5bd
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 44 deletions.
84 changes: 60 additions & 24 deletions usr/lib/linuxmuster-webui/plugins/lmn_users/resources/build/all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ angular.module('lm.users').controller 'LMUsersStudentsController', ($scope, $htt
pageSize: 50

$scope.all_selected = false
$scope.query = ''

$http.post('/api/lm/sophomorixUsers/students', {action: 'get-all'}).then (resp) ->
$scope.students = resp.data
Expand Down Expand Up @@ -98,19 +99,26 @@ angular.module('lm.users').controller 'LMUsersStudentsController', ($scope, $htt
$scope.batchSetCustomPassword = () ->
$scope.setCustomPassword((x for x in $scope.students when x.selected))

$scope.selectAll = (filter) ->
if !filter?
filter = ''
$scope.filter = (row) ->
# Only query sAMAccountName, givenName, sn and sophomorixAdminClass
result = false
for value in ['sAMAccountName', 'givenName', 'sn', 'sophomorixAdminClass']
result = result || row[value].toLowerCase().indexOf($scope.query.toLowerCase() || '') != -1
return result

$scope.selectAll = (query) ->
if !query?
query = ''
for student in $scope.students
if filter is undefined || filter == ''
if query is undefined || query == ''
student.selected = $scope.all_selected
if student.sn.toLowerCase().includes filter.toLowerCase()
if student.sn.toLowerCase().includes query.toLowerCase()
student.selected = $scope.all_selected
if student.givenName.toLowerCase().includes filter.toLowerCase()
if student.givenName.toLowerCase().includes query.toLowerCase()
student.selected = $scope.all_selected
if student.sophomorixAdminClass.toLowerCase().includes filter.toLowerCase()
if student.sophomorixAdminClass.toLowerCase().includes query.toLowerCase()
student.selected = $scope.all_selected
if student.sAMAccountName.toLowerCase().includes filter.toLowerCase()
if student.sAMAccountName.toLowerCase().includes query.toLowerCase()
student.selected = $scope.all_selected


Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ angular.module('lm.users').controller 'LMUsersTeachersController', ($scope, $htt
pageSize: 50

$scope.all_selected = false
$scope.query = ''


$http.post('/api/lm/sophomorixUsers/teachers',{action: 'get-all'}).then (resp) ->
Expand Down Expand Up @@ -107,17 +108,24 @@ angular.module('lm.users').controller 'LMUsersTeachersController', ($scope, $htt
$scope.batchSetCustomPassword = () ->
$scope.setCustomPassword((x for x in $scope.teachers when x.selected))

$scope.selectAll = (filter) ->
if !filter?
filter = ''
$scope.filter = (row) ->
# Only query sAMAccountName, givenName and sn
result = false
for value in ['sAMAccountName', 'givenName', 'sn']
result = result || row[value].toLowerCase().indexOf($scope.query.toLowerCase() || '') != -1
return result

$scope.selectAll = (query) ->
if !query?
query = ''
for teacher in $scope.teachers
if filter is undefined || filter == ''
if query is undefined || query == ''
teacher.selected = $scope.all_selected
if teacher.sn.toLowerCase().includes filter.toLowerCase()
if teacher.sn.toLowerCase().includes query.toLowerCase()
teacher.selected = $scope.all_selected
if teacher.givenName.toLowerCase().includes filter.toLowerCase()
if teacher.givenName.toLowerCase().includes query.toLowerCase()
teacher.selected = $scope.all_selected
if teacher.sophomorixAdminClass.toLowerCase().includes filter.toLowerCase()
if teacher.sophomorixAdminClass.toLowerCase().includes query.toLowerCase()
teacher.selected = $scope.all_selected
if teacher.sAMAccountName.toLowerCase().includes filter.toLowerCase()
if teacher.sAMAccountName.toLowerCase().includes query.toLowerCase()
teacher.selected = $scope.all_selected
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div ng:show="students[0] != 'none'">
<div class="input-group">

<input ng:model="filter" type="search" autofocus class="form-control" placeholder="Filter" typeahead-min-length="1" />
<input ng:model="query" type="search" autofocus class="form-control" placeholder="Filter" typeahead-min-length="1" />
<div uib-dropdown class="input-group-btn">
<button class="btn btn-default" uib-dropdown-toggle>
<i class="fa fa-sort-amount-asc"></i> {{sort.name}}
Expand Down Expand Up @@ -47,7 +47,7 @@
</div>
</div>
<table class="table" style="width:100%">
<tr><th><span checkbox ng:model="all_selected" ng:change="selectAll(filter)"></span></th>
<tr><th><span checkbox ng:model="all_selected" ng:change="selectAll(query)"></span></th>
<th width="120"> <span translate> Login / Class </span> </th>
<th> Name </th></tr>
<tr ng:repeat="student in students|filter:filter|orderBy:['-_isNew', sort.fx]|page:paging.page:paging.pageSize" ng:show="student.class[0] != '#'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<div ng:show="teachers[0] != 'none'">
<div class="input-group">
<input ng:model="filter" type="search" autofocus class="form-control" placeholder="Filter" />
<input ng:model="query" type="search" autofocus class="form-control" placeholder="Filter" />
<div uib-dropdown class="input-group-btn">
<button class="btn btn-default" uib-dropdown-toggle>
<i class="fa fa-sort-amount-asc"></i> {{sort.name}}
Expand Down Expand Up @@ -50,7 +50,7 @@

<table class="table" style="width:100%">
<tr>
<th><span checkbox ng:model="all_selected" ng:change="selectAll(filter)"></span></th>
<th><span checkbox ng:model="all_selected" ng:change="selectAll(query)"></span></th>
<th width="120"> Login</th>
<th> Name </th>
<th ng:show="teachersQuota"> </th>
Expand Down

0 comments on commit e10a5bd

Please sign in to comment.