Add resend email button to admin user form

Fixes https://github.com/openfoodfoundation/openfoodnetwork/issues/1589
This commit is contained in:
Maikel Linke
2018-06-07 18:09:35 +10:00
parent 6a58deb436
commit 60b66540df
4 changed files with 35 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
angular.module("admin.users").directive "resendUserEmailConfirmation", ($http) ->
scope:
email: "@resendUserEmailConfirmation"
link: (scope, element, attrs) ->
sent = false
text = element.text()
sending = " " + t "js.admin.resend_user_email_confirmation.sending"
done = " " + t "js.admin.resend_user_email_confirmation.done"
failed = " " + t "js.admin.resend_user_email_confirmation.failed"
element.bind "click", ->
return if sent
element.text(text + sending)
$http.post("/user/spree_user/confirmation", {spree_user: {email: scope.email}}).success (data) ->
sent = true
element.addClass "action--disabled"
element.text text + done
.error (data) ->
element.text text + failed