Add vue component for confirmation popover
Have the confirmation popover in a separate Vue component fixes a bug in IE that was causing the `form` element in the popover to be ignored. Since `form`s cannot be nested, the `form` element in the popover was being discarded by IE and the revoke/resend invitation buttons did nothing. Breaking the functionality into a Vue component moves the `form` into a separate template. When the popover is displayed, the component is added to the DOM at the end, so the `form` is properly not-nested.
This commit is contained in:
@@ -1,19 +1,10 @@
|
||||
{% macro ConfirmationButton(btn_text, action, csrf_token, confirm_msg="Are you sure?", confirm_btn="Confirm", cancel_btn="Cancel") -%}
|
||||
<v-popover placement='top-start'>
|
||||
<template slot="popover">
|
||||
<p>{{ confirm_msg }}</p>
|
||||
<div class='action-group'>
|
||||
<form method="POST" action="{{ action }}">
|
||||
{{ csrf_token }}
|
||||
<button class='usa-button usa-button-primary' type='submit'>
|
||||
{{ confirm_btn }}
|
||||
</button>
|
||||
</form>
|
||||
<button class='usa-button usa-button-secondary' v-close-popover>
|
||||
{{ cancel_btn }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<button class="tooltip-target" type="button">{{ btn_text }}</button>
|
||||
</v-popover>
|
||||
{% macro ConfirmationButton(btn_text, action, confirm_msg="Are you sure?", confirm_btn="Confirm", cancel_btn="Cancel") -%}
|
||||
<confirmation-popover
|
||||
btn_text='{{ btn_text }}'
|
||||
action='{{ action }}'
|
||||
csrf_token='{{ csrf_token() }}'
|
||||
confirm_msg='{{ confirm_msg }}'
|
||||
confirm_btn_text='{{ confirm_btn }}'
|
||||
cancel_btn_text='{{ cancel_btn }}'>
|
||||
</confirmation-popover>
|
||||
{%- endmacro %}
|
||||
|
@@ -44,14 +44,12 @@
|
||||
{{ ConfirmationButton(
|
||||
"Revoke Invitation",
|
||||
url_for("workspaces.revoke_invitation", workspace_id=workspace.id, token=member.latest_invitation.token),
|
||||
form.csrf_token
|
||||
) }}
|
||||
{% endif %}
|
||||
{% if member.can_resend_invitation %}
|
||||
{{ ConfirmationButton (
|
||||
"Resend Invitation",
|
||||
url_for("workspaces.resend_invitation", workspace_id=workspace.id, token=member.latest_invitation.token),
|
||||
form.csrf_token,
|
||||
confirm_msg="Are you sure? This will send an email to invite the user to join this workspace."
|
||||
)}}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user