summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/sudo_mode/new.js.erb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/views/sudo_mode/new.js.erb b/app/views/sudo_mode/new.js.erb
index ed77b32b1..2eda9b857 100644
--- a/app/views/sudo_mode/new.js.erb
+++ b/app/views/sudo_mode/new.js.erb
@@ -1,4 +1,4 @@
-$("body").append($("<div>", {id: "sudo-modal"}).hide());
-$('#sudo-modal').html('<%= escape_javascript render partial: 'sudo_mode/new_modal' %>');
+var sudo_modal = $('#sudo-modal').length ? $('#sudo-modal') : $("<div>", {id: "sudo-modal"}).appendTo($("body"));
+sudo_modal.hide().html('<%= escape_javascript render partial: 'sudo_mode/new_modal' %>');
showModal('sudo-modal', '400px');
$('#sudo_password').focus();