diff --git a/instances/templates/create_instance_w2.html b/instances/templates/create_instance_w2.html
index 22876f10..8b38749f 100644
--- a/instances/templates/create_instance_w2.html
+++ b/instances/templates/create_instance_w2.html
@@ -323,7 +323,7 @@
diff --git a/instances/templates/instances/edit_instance_volume.html b/instances/templates/instances/edit_instance_volume.html
index 7e93cff1..d4aff411 100644
--- a/instances/templates/instances/edit_instance_volume.html
+++ b/instances/templates/instances/edit_instance_volume.html
@@ -109,7 +109,7 @@
diff --git a/instances/templates/instances/settings_tab.html b/instances/templates/instances/settings_tab.html
index 09dd4f7d..e8ebf056 100644
--- a/instances/templates/instances/settings_tab.html
+++ b/instances/templates/instances/settings_tab.html
@@ -312,11 +312,11 @@
{% if instance.status == 5 %}
- |
diff --git a/nwfilters/templates/nwfilter.html b/nwfilters/templates/nwfilter.html
index e073a96b..aeb29594 100644
--- a/nwfilters/templates/nwfilter.html
+++ b/nwfilters/templates/nwfilter.html
@@ -104,7 +104,7 @@
@@ -148,7 +148,7 @@
-
+
{% bs_icon 'trash' %}
diff --git a/nwfilters/templates/nwfilters.html b/nwfilters/templates/nwfilters.html
index 7f3e08a1..9e56c140 100644
--- a/nwfilters/templates/nwfilters.html
+++ b/nwfilters/templates/nwfilters.html
@@ -116,7 +116,7 @@
|
diff --git a/storages/templates/storage.html b/storages/templates/storage.html
index 214eaace..65dc4ee6 100644
--- a/storages/templates/storage.html
+++ b/storages/templates/storage.html
@@ -59,24 +59,27 @@
{{ used|filesizeformat }}
{% trans "State" %}
-
{% trans "Autostart" %}
-
@@ -172,9 +175,10 @@
{% endif %}
|
-
@@ -221,12 +225,6 @@
});
$(document).ready(function() {
- $('.confirm-form').on('submit', function(e) {
- if (!confirm('{% trans "Are you sure?"|escapejs %}')) {
- e.preventDefault();
- }
- });
-
var pendingUpload = null;
var uploadInProgress = false;
// the browser sends the file: leaving the page stops the upload
diff --git a/virtsecrets/templates/secrets.html b/virtsecrets/templates/secrets.html
index 40d235e4..3648c5ad 100644
--- a/virtsecrets/templates/secrets.html
+++ b/virtsecrets/templates/secrets.html
@@ -76,7 +76,7 @@
{% bs_icon 'pencil' %}
-
+
{% bs_icon 'trash' %}
diff --git a/webvirtcloud/tests/test_confirm_prompts.py b/webvirtcloud/tests/test_confirm_prompts.py
new file mode 100644
index 00000000..7595488a
--- /dev/null
+++ b/webvirtcloud/tests/test_confirm_prompts.py
@@ -0,0 +1,29 @@
+"""A confirmation says what its action does: every prompt in a template is the
+button's own data-confirm text, shown by return confirm(this.dataset.confirm)."""
+
+from pathlib import Path
+
+from django.conf import settings
+from django.test import SimpleTestCase
+
+ONCLICK = 'onclick="return confirm(this.dataset.confirm)"'
+
+
+class ConfirmPromptTests(SimpleTestCase):
+ def test_every_prompt_is_the_buttons_own_text(self):
+ base = Path(settings.BASE_DIR)
+ templates = [*base.glob("*/templates/**/*.html"), *base.glob("templates/**/*.html")]
+ self.assertTrue(templates)
+ for path in templates:
+ text = path.read_text()
+ at = text.find("confirm(")
+ while at != -1:
+ # the tag around it: prompt texts and template tags hold no < or >
+ tag = text[text.rfind("<", 0, at):text.find(">", at) + 1]
+ with self.subTest(template=str(path.relative_to(base)), tag=tag[:60]):
+ self.assertRegex(tag, r"^<(button|input|a)\b")
+ self.assertIn(ONCLICK, tag)
+ self.assertIn('data-confirm="', tag)
+ self.assertNotIn('data-confirm=""', tag)
+ self.assertNotIn("Are you sure", tag)
+ at = text.find("confirm(", at + 1)
| |