Skip to content

Commit bc48e99

Browse files
Manuel Sanchezdi
Manuel Sanchez
authored andcommitted
Add cancel action to ConfirmController (#3160)
* Clean input value
1 parent 3ebb445 commit bc48e99

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

warehouse/static/js/warehouse/controllers/confirm_controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ export default class extends Controller {
77
this.buttonTarget.disabled = true;
88
}
99

10+
cancel() {
11+
this.inputTarget.value = "";
12+
}
13+
1014
check() {
1115
if (this.inputTarget.value == this.buttonTarget.dataset.expected) {
1216
this.buttonTarget.disabled = false;

warehouse/templates/manage/manage_base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ <h3 class="sidebar-section__title">Your Account</h3>
6464
<form method="POST" class="modal__form" action="{{ action or request.current_route_path() }}">
6565
<input name="csrf_token" type="hidden" value="{{ request.session.get_csrf_token() }}">
6666
{{ extra_fields if extra_fields else '' }}
67-
<a href="#modal-close" title="Close" class="modal__close">
67+
<a href="#modal-close" data-action="click->confirm#cancel" title="Close" class="modal__close">
6868
<i class="fa fa-times" aria-hidden="true"></i>
6969
<span class="sr-only">close</span>
7070
</a>
@@ -79,7 +79,7 @@ <h3 class="modal__title">{{ title }} {{ confirm_string }}?</h3>
7979
<input name="{{ name }}" data-action="input->confirm#check" data-target="confirm.input" type="text" placeholder="{{ confirm_string }}" autocomplete="off" autocorrect="off" autocapitalize="off">
8080
</div>
8181
<div class="modal__footer">
82-
<a href="#modal-close" class="button modal__action">Cancel</a>
82+
<a href="#modal-close" data-action="click->confirm#cancel" class="button modal__action">Cancel</a>
8383
<button class="button button--primary modal__action" data-target="confirm.button" data-expected="{{ confirm_string }}" type="submit">
8484
{{ title }}
8585
</button>

0 commit comments

Comments
 (0)