Ghost/ghost/admin/app/templates/components/modal-invite-new-user.hbs
Kevin Ansfield 63b8127cfa Fixed "Send invitation" button needing to be clicked twice
refs https://github.com/TryGhost/Ghost/issues/7131
- adds `disableMouseDown` flag to `{{gh-task-button}}`
- uses flag for the send invite button so that the focus-out validation on the e-mail input is not triggered before the click event is triggered
2019-03-18 17:56:32 +00:00

60 lines
2.1 KiB
Handlebars

<header class="modal-header">
<h1>Invite a New User</h1>
</header>
{{!-- disable mouseDown so it doesn't trigger focus-out validations --}}
<a class="close" href="" title="Close" {{action "closeModal"}} {{action (optional noop) on="mouseDown"}}>
{{svg-jar "close"}}<span class="hidden">Close</span>
</a>
<div class="modal-body">
<fieldset>
{{#gh-form-group errors=errors hasValidated=hasValidated property="email"}}
<label for="new-user-email">Email Address</label>
{{gh-text-input
class="email"
id="new-user-email"
type="email"
placeholder="Email Address"
name="email"
autofocus="autofocus"
autocapitalize="off"
autocorrect="off"
value=(readonly email)
input=(action (mut email) value="target.value")
keyEvents=(hash
Enter=(action "confirm")
)
focus-out=(action "validate" "email")
}}
{{gh-error-message errors=errors property="email"}}
{{/gh-form-group}}
{{#gh-form-group class="for-select" errors=errors hasValidated=hasValidated property="role"}}
<label for="new-user-role">Role</label>
<span class="gh-select">
{{one-way-select
id="new-user-role"
name="role"
options=(readonly roles)
optionValuePath="id"
optionLabelPath="name"
value=role
update=(action "setRole")
}}
{{svg-jar "arrow-down-small"}}
</span>
{{gh-error-message errors=errors property="role"}}
{{/gh-form-group}}
</fieldset>
</div>
<div class="modal-footer">
{{gh-task-button "Send invitation now"
successText="Sent"
task=sendInvitation
class="gh-btn gh-btn-green gh-btn-icon"
disabled=fetchRoles.isRunning
disableMouseDown=true}}
</div>