mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-22 18:41:59 +00:00
added bulk removing of users to group admin panel
This commit is contained in:
parent
c991625a27
commit
a0805f97e0
2 changed files with 34 additions and 20 deletions
|
@ -14,6 +14,7 @@ block content
|
|||
table.table-striped.table.table-striped
|
||||
thead
|
||||
tr
|
||||
th
|
||||
th email
|
||||
th Name
|
||||
th Registered
|
||||
|
@ -21,20 +22,27 @@ block content
|
|||
tbody#userList
|
||||
-each user in users
|
||||
tr
|
||||
td
|
||||
input(type="checkbox")
|
||||
td #{user.email}
|
||||
td #{user.first_name} #{user.last_name}
|
||||
td #{!user.holdingAccount}
|
||||
td
|
||||
button.btn.btn-danger(id=user._id) Remove
|
||||
input(type="hidden", name="user_id", value=user._id).user_id {{user._id}}
|
||||
|
||||
|
||||
form.well.form-inline#addUserToGroup
|
||||
div
|
||||
input(name="_csrf", type="hidden", value=csrfToken)
|
||||
input(name="email", type="email", placeholder="someone@email.com")#newEmail.email.input-large
|
||||
button.btn.btn-primary.addUser Add
|
||||
div
|
||||
div Add multiple emails seperated with commas or space.
|
||||
div
|
||||
button.btn.btn-danger#deleteUsers Delete Selected
|
||||
div
|
||||
div
|
||||
form.well.form-inline#addUserToGroup
|
||||
div
|
||||
input(name="_csrf", type="hidden", value=csrfToken)
|
||||
input(name="email", type="email", placeholder="someone@email.com")#newEmail.email.input-large
|
||||
button.btn.btn-primary.addUser Add
|
||||
div
|
||||
div Add multiple emails seperated with commas or space.
|
||||
|
||||
|
||||
- locals.supressDefaultJs = true
|
||||
script(data-main='/js/SubscriptionGroupsManager.js', src='/js/libs/require.js')
|
||||
|
|
|
@ -7,10 +7,13 @@ require [
|
|||
|
||||
tableRowTemplate = '''
|
||||
<tr>
|
||||
<td> <input type="checkbox"></td>
|
||||
<td> {{ email }} </td>
|
||||
<td> {{ first_name }} {{ last_name }} </td>
|
||||
<td> {{ !holdingAccount }} </td>
|
||||
<td><button id="{{_id}}"" class="btn btn-danger">Remove</button></td>
|
||||
<td>
|
||||
<input type="hidden" name="user_id" value="{{user_id}}" class="user_id">
|
||||
</td>
|
||||
</tr>
|
||||
'''
|
||||
|
||||
|
@ -54,16 +57,19 @@ require [
|
|||
sendNewUserToServer(email)
|
||||
$form.find("input").val('')
|
||||
|
||||
removeUser = (e)->
|
||||
button = $(e.target)
|
||||
user_id = button.attr("id")
|
||||
$.ajax
|
||||
url: "/subscription/group/user/#{user_id}"
|
||||
type: 'DELETE'
|
||||
data:
|
||||
_csrf: csrfToken
|
||||
success: ->
|
||||
button.parents("tr").fadeOut(250)
|
||||
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)
|
||||
|
||||
|
||||
|
||||
$form.on 'keypress', (e)->
|
||||
if(e.keyCode == 13)
|
||||
|
@ -71,4 +77,4 @@ require [
|
|||
|
||||
$form.find(".addUser").on 'click', addUser
|
||||
|
||||
$('table').on 'click', '.btn-danger', removeUser
|
||||
$('#deleteUsers').on 'click', removeUsers
|
||||
|
|
Loading…
Reference in a new issue