forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnassignedGroupUserCollection.coffee
More file actions
34 lines (27 loc) · 1.06 KB
/
Copy pathUnassignedGroupUserCollection.coffee
File metadata and controls
34 lines (27 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
define [
'compiled/collections/GroupUserCollection'
'compiled/models/GroupUser'
], (GroupUserCollection, GroupUser) ->
class UnassignedGroupUserCollection extends GroupUserCollection
url: ->
_url = "/api/v1/group_categories/#{@category.id}/users?per_page=50&include[]=sections&exclude[]=pseudonym"
_url += "&unassigned=true" unless @category.get('allows_multiple_memberships')
@url = _url
# don't add/remove people in the "Everyone" collection (this collection)
# if the category supports multiple memberships
membershipsLocked: ->
@category.get('allows_multiple_memberships')
increment: (amount) ->
@category.increment 'unassigned_users_count', amount
search: (filter, options) ->
options = options || {}
options.reset = true
if filter && filter.length >= 3
options.url = @url + "&search_term=" + filter
@filtered = true
return @fetch(options)
else if @filtered
@filtered = false
options.url = @url
return @fetch(options)
# do nothing