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

View File

@@ -71,6 +71,14 @@ a {
cursor:pointer;
}
a.action--disabled {
cursor: default;
&:hover {
color: #5498da;
}
}
form.order_cycle {
h2 {
margin-top: 2em;

View File

@@ -1,2 +1,4 @@
%p.alert-box
%p.alert-box{"ng-app" => "admin.users"}
= t(".confirmation_pending", address: @user.email)
%a{"resend-user-email-confirmation" => @user.email}
= t(".resend")

View File

@@ -2435,6 +2435,10 @@ See the %{link} to find out more about %{sitename}'s features and to start using
resolve: Resolve
new_tag_rule_dialog:
select_rule_type: "Select a rule type:"
resend_user_email_confirmation:
sending: "..."
done: "done ✓"
failed: "failed ✗"
out_of_stock:
reduced_stock_available: Reduced stock available
out_of_stock_text: >
@@ -2588,6 +2592,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
users:
email_confirmation:
confirmation_pending: "Email confirmation is pending. We've sent a confirmation email to %{address}."
resend: "Resend"
variants:
autocomplete:
producer_name: Producer