mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 22:53:31 -05:00
Merge pull request #2435 from overleaf/ta-group-invite-form-fix
Add UI Feedback To Group Invite Form GitOrigin-RevId: aec05d586c4ccfc7739b6b94d1f49763ea229c6e
This commit is contained in:
parent
5783f99fbd
commit
2705aea54c
2 changed files with 12 additions and 5 deletions
|
@ -89,7 +89,9 @@ block content
|
||||||
aria-describedby="add-members-description"
|
aria-describedby="add-members-description"
|
||||||
)
|
)
|
||||||
.col-xs-4
|
.col-xs-4
|
||||||
button.btn.btn-primary(ng-click="addMembers()") #{translate("add")}
|
button.btn.btn-primary(ng-click="addMembers()", ng-disabled="inputs.addMembers.inflightCount > 0")
|
||||||
|
span(ng-show="inputs.addMembers.inflightCount === 0") #{translate("add")}
|
||||||
|
span(ng-show="inputs.addMembers.inflightCount > 0") #{translate("adding")}...
|
||||||
.col-xs-2(ng-if="paths.exportMembers", ng-cloak)
|
.col-xs-2(ng-if="paths.exportMembers", ng-cloak)
|
||||||
a(href=paths.exportMembers) #{translate('export_csv')}
|
a(href=paths.exportMembers) #{translate('export_csv')}
|
||||||
.row
|
.row
|
||||||
|
|
|
@ -23,7 +23,8 @@ define(['base'], function(App) {
|
||||||
addMembers: {
|
addMembers: {
|
||||||
content: '',
|
content: '',
|
||||||
error: false,
|
error: false,
|
||||||
errorMessage: null
|
errorMessage: null,
|
||||||
|
inflightCount: 0
|
||||||
},
|
},
|
||||||
removeMembers: {
|
removeMembers: {
|
||||||
error: false,
|
error: false,
|
||||||
|
@ -42,14 +43,17 @@ define(['base'], function(App) {
|
||||||
$scope.addMembers = function() {
|
$scope.addMembers = function() {
|
||||||
$scope.inputs.addMembers.error = false
|
$scope.inputs.addMembers.error = false
|
||||||
$scope.inputs.addMembers.errorMessage = null
|
$scope.inputs.addMembers.errorMessage = null
|
||||||
|
$scope.inputs.addMembers.inflightCount = 0
|
||||||
const emails = parseEmails($scope.inputs.addMembers.content)
|
const emails = parseEmails($scope.inputs.addMembers.content)
|
||||||
return Array.from(emails).map(email =>
|
return Array.from(emails).map(email => {
|
||||||
queuedHttp
|
$scope.inputs.addMembers.inflightCount += 1
|
||||||
|
return queuedHttp
|
||||||
.post(paths.addMember, {
|
.post(paths.addMember, {
|
||||||
email,
|
email,
|
||||||
_csrf: window.csrfToken
|
_csrf: window.csrfToken
|
||||||
})
|
})
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
|
$scope.inputs.addMembers.inflightCount -= 1
|
||||||
const { data } = response
|
const { data } = response
|
||||||
if (data.user != null) {
|
if (data.user != null) {
|
||||||
$scope.users.push(data.user)
|
$scope.users.push(data.user)
|
||||||
|
@ -57,12 +61,13 @@ define(['base'], function(App) {
|
||||||
return ($scope.inputs.addMembers.content = '')
|
return ($scope.inputs.addMembers.content = '')
|
||||||
})
|
})
|
||||||
.catch(function(response) {
|
.catch(function(response) {
|
||||||
|
$scope.inputs.addMembers.inflightCount -= 1
|
||||||
const { data } = response
|
const { data } = response
|
||||||
$scope.inputs.addMembers.error = true
|
$scope.inputs.addMembers.error = true
|
||||||
return ($scope.inputs.addMembers.errorMessage =
|
return ($scope.inputs.addMembers.errorMessage =
|
||||||
data.error != null ? data.error.message : undefined)
|
data.error != null ? data.error.message : undefined)
|
||||||
})
|
})
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.removeMembers = function() {
|
$scope.removeMembers = function() {
|
||||||
|
|
Loading…
Reference in a new issue