mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-13 14:25:48 +00:00
Allow multi select of users in group page
This commit is contained in:
parent
cc522f5d07
commit
31f39dada1
2 changed files with 24 additions and 13 deletions
|
@ -15,6 +15,7 @@ block content
|
|||
thead
|
||||
tr
|
||||
th
|
||||
input(type="checkbox").select-all
|
||||
th email
|
||||
th Name
|
||||
th Registered
|
||||
|
@ -23,7 +24,7 @@ block content
|
|||
-each user in users
|
||||
tr
|
||||
td
|
||||
input(type="checkbox")
|
||||
input(type="checkbox").select-one
|
||||
td #{user.email}
|
||||
td #{user.first_name} #{user.last_name}
|
||||
td #{!user.holdingAccount}
|
||||
|
|
|
@ -7,12 +7,12 @@ require [
|
|||
|
||||
tableRowTemplate = '''
|
||||
<tr>
|
||||
<td> <input type="checkbox"></td>
|
||||
<td> <input type="checkbox" class="select-one"></td>
|
||||
<td> {{ email }} </td>
|
||||
<td> {{ first_name }} {{ last_name }} </td>
|
||||
<td> {{ !holdingAccount }} </td>
|
||||
<td>
|
||||
<input type="hidden" name="user_id" value="{{user_id}}" class="user_id">
|
||||
<input type="hidden" name="user_id" value="{{_id}}" class="user_id">
|
||||
</td>
|
||||
</tr>
|
||||
'''
|
||||
|
@ -58,16 +58,19 @@ require [
|
|||
$form.find("input").val('')
|
||||
|
||||
removeUsers = (e)->
|
||||
selectedUserRows = $('td input:checked').closest('tr').find(".user_id")
|
||||
selectedUserRows.each (index, userRow)->
|
||||
user_id = $(userRow).val()
|
||||
$.ajax
|
||||
url: "/subscription/group/user/#{user_id}"
|
||||
type: 'DELETE'
|
||||
data:
|
||||
_csrf: csrfToken
|
||||
success: ->
|
||||
$(userRow).parents("tr").fadeOut(250)
|
||||
selectedUserRows = $('td input.select-one:checked').closest('tr').find(".user_id").toArray()
|
||||
do deleteNext = () ->
|
||||
row = selectedUserRows.pop()
|
||||
if row?
|
||||
user_id = $(row).val()
|
||||
$.ajax
|
||||
url: "/subscription/group/user/#{user_id}"
|
||||
type: 'DELETE'
|
||||
data:
|
||||
_csrf: csrfToken
|
||||
success: ->
|
||||
$(row).parents("tr").fadeOut(250)
|
||||
deleteNext()
|
||||
|
||||
$form.on 'keypress', (e)->
|
||||
if(e.keyCode == 13)
|
||||
|
@ -76,3 +79,10 @@ require [
|
|||
$form.find(".addUser").on 'click', addUser
|
||||
|
||||
$('#deleteUsers').on 'click', removeUsers
|
||||
|
||||
$('input.select-all').on "change", () ->
|
||||
if $(@).is(":checked")
|
||||
$("input.select-one").prop( "checked", true )
|
||||
else
|
||||
$("input.select-one").prop( "checked", false )
|
||||
|
||||
|
|
Loading…
Reference in a new issue