Use ConfirmationPopover rather than custom form
This commit is contained in:
parent
8ca0e04402
commit
c3cb46873e
@ -109,8 +109,7 @@ def ko_review(portfolio_id, task_order_id):
|
|||||||
methods=["POST"],
|
methods=["POST"],
|
||||||
)
|
)
|
||||||
def resend_invite(portfolio_id, task_order_id, form=None):
|
def resend_invite(portfolio_id, task_order_id, form=None):
|
||||||
form_data = {**http_request.form}
|
invite_type = http_request.args.get("invite_type")
|
||||||
invite_type = form_data["invite_type"][0]
|
|
||||||
|
|
||||||
if invite_type not in OFFICER_INVITATIONS:
|
if invite_type not in OFFICER_INVITATIONS:
|
||||||
raise NotFoundError("invite_type")
|
raise NotFoundError("invite_type")
|
||||||
|
@ -4,10 +4,13 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
action: String,
|
action: String,
|
||||||
btn_text: String,
|
btn_text: String,
|
||||||
|
btn_icon: String,
|
||||||
|
btn_class: String,
|
||||||
cancel_btn_text: String,
|
cancel_btn_text: String,
|
||||||
confirm_btn_text: String,
|
confirm_btn_text: String,
|
||||||
confirm_msg: String,
|
confirm_msg: String,
|
||||||
csrf_token: String,
|
csrf_token: String,
|
||||||
|
name: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
template: `
|
template: `
|
||||||
@ -26,7 +29,10 @@ export default {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<button class="tooltip-target" type="button">{{ btn_text }}</button>
|
<button class="tooltip-target" v-bind:class="[btn_class]" type="button">
|
||||||
|
<div v-html="btn_icon" />
|
||||||
|
{{ btn_text }}
|
||||||
|
</button>
|
||||||
</v-popover>
|
</v-popover>
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import FormMixin from '../../mixins/form'
|
import FormMixin from '../../mixins/form'
|
||||||
import checkboxinput from '../checkbox_input'
|
import checkboxinput from '../checkbox_input'
|
||||||
import textinput from '../text_input'
|
import textinput from '../text_input'
|
||||||
|
import ConfirmationPopover from '../confirmation_popover'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'edit-officer-form',
|
name: 'edit-officer-form',
|
||||||
@ -10,6 +11,7 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
checkboxinput,
|
checkboxinput,
|
||||||
textinput,
|
textinput,
|
||||||
|
ConfirmationPopover,
|
||||||
},
|
},
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
@ -171,6 +171,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.inline-form {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
@ -510,6 +510,10 @@
|
|||||||
margin: 0 $gap;
|
margin: 0 $gap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.v-popover {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
.remove {
|
.remove {
|
||||||
color: $color-red;
|
color: $color-red;
|
||||||
.icon {
|
.icon {
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
{% macro ConfirmationButton(btn_text, action, confirm_msg="Are you sure?", confirm_btn="Confirm", cancel_btn="Cancel") -%}
|
{% macro ConfirmationButton(
|
||||||
|
btn_text,
|
||||||
|
action,
|
||||||
|
btn_icon=None,
|
||||||
|
btn_class=None,
|
||||||
|
confirm_msg="Are you sure?",
|
||||||
|
confirm_btn="Confirm",
|
||||||
|
cancel_btn="Cancel")
|
||||||
|
-%}
|
||||||
<confirmation-popover
|
<confirmation-popover
|
||||||
btn_text='{{ btn_text }}'
|
btn_text='{{ btn_text }}'
|
||||||
|
btn_icon='{{ btn_icon }}'
|
||||||
|
btn_class='{{ btn_class }}'
|
||||||
action='{{ action }}'
|
action='{{ action }}'
|
||||||
csrf_token='{{ csrf_token() }}'
|
csrf_token='{{ csrf_token() }}'
|
||||||
confirm_msg='{{ confirm_msg }}'
|
confirm_msg='{{ confirm_msg }}'
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
{% from "components/checkbox_input.html" import CheckboxInput %}
|
{% from "components/checkbox_input.html" import CheckboxInput %}
|
||||||
{% from "components/icon.html" import Icon %}
|
{% from "components/icon.html" import Icon %}
|
||||||
{% from "components/text_input.html" import TextInput %}
|
{% from "components/text_input.html" import TextInput %}
|
||||||
|
{% from "components/confirmation_button.html" import ConfirmationButton %}
|
||||||
|
|
||||||
|
|
||||||
{% macro Link(text, icon_name, onClick=None, url='#', classes='') %}
|
{% macro Link(text, icon_name, onClick=None, url='#', classes='') %}
|
||||||
@ -96,15 +97,21 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="officer__actions">
|
<div class="officer__actions">
|
||||||
{{ Link("Update", "edit", onClick="edit") }}
|
{{ Link("Update", "edit", onClick="edit") }}
|
||||||
|
{% set invite_type = [prefix + "_invite"] %}
|
||||||
|
|
||||||
<form method='POST' action="{{ url_for("portfolios.resend_invite", portfolio_id=portfolio.id, task_order_id=task_order.id) }}" class="inline-form">
|
{{
|
||||||
{{ form.csrf_token }}
|
ConfirmationButton(
|
||||||
<input name="invite_type" value="{{ prefix }}_invite" type="hidden" />
|
btn_text="Resend Invitation",
|
||||||
<button class="icon-link">
|
action=url_for(
|
||||||
{{ Icon('avatar') }}
|
"portfolios.resend_invite",
|
||||||
Resend Invitation
|
portfolio_id=portfolio.id,
|
||||||
</button>
|
task_order_id=task_order.id,
|
||||||
</form>
|
invite_type=invite_type,
|
||||||
|
),
|
||||||
|
btn_icon=Icon('avatar'),
|
||||||
|
btn_class="icon-link",
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
{{ Link("Remove", "trash", classes="remove") }}
|
{{ Link("Remove", "trash", classes="remove") }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -627,9 +627,9 @@ def test_resend_invite_when_ko(app, client, user_session, portfolio, user):
|
|||||||
"portfolios.resend_invite",
|
"portfolios.resend_invite",
|
||||||
portfolio_id=portfolio.id,
|
portfolio_id=portfolio.id,
|
||||||
task_order_id=task_order.id,
|
task_order_id=task_order.id,
|
||||||
|
invite_type="ko_invite",
|
||||||
_external=True,
|
_external=True,
|
||||||
),
|
)
|
||||||
data={"invite_type": "ko_invite"},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert original_invitation.status == InvitationStatus.REVOKED
|
assert original_invitation.status == InvitationStatus.REVOKED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user