From acbfbb07ce9c34cd2f158eebb6d3371ab6d78874 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 8 Oct 2022 08:06:46 +0200 Subject: [PATCH] rework "are you sure?" and make it work on subscribing to posts and reverting admin actions --- files/assets/js/award_modal.js | 14 -------------- files/assets/js/bootstrap.js | 15 +++++++++++++++ files/classes/submission.py | 2 +- files/templates/award_modal.html | 6 ++---- files/templates/comments.html | 6 +++--- files/templates/hats.html | 8 ++------ files/templates/live.html | 9 ++++----- files/templates/post_actions.html | 2 +- files/templates/post_actions_mobile.html | 6 +++--- files/templates/shop.html | 6 ++---- files/templates/userpage.html | 4 ++-- 11 files changed, 35 insertions(+), 43 deletions(-) diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index 79ab1457c..a597d0a21 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -97,30 +97,16 @@ function vote(type, id, dir) { function pick(kind, canbuy1, canbuy2) { const buy1 = document.getElementById('buy1') - const buy1go = document.getElementById('buy1-go') if (canbuy1 && kind != "grass") - { buy1.disabled=false; - buy1go.disabled=false; - } else - { buy1.disabled=true; - buy1go.disabled=true; - } const buy2 = document.getElementById('buy2') - const buy2go = document.getElementById('buy2-go') if (canbuy2 && kind != "benefactor") - { buy2.disabled=false; - buy2go.disabled=false; - } else - { buy2.disabled=true; - buy2go.disabled=true; - } let ownednum = Number(document.getElementById(`${kind}-owned`).textContent); document.getElementById('giveaward').disabled = (ownednum == 0); diff --git a/files/assets/js/bootstrap.js b/files/assets/js/bootstrap.js index f783981f4..36b2bf97d 100644 --- a/files/assets/js/bootstrap.js +++ b/files/assets/js/bootstrap.js @@ -338,3 +338,18 @@ function timestamp(str, ti) { const date = new Date(ti*1000); document.getElementById(str).setAttribute("data-bs-original-title", formatDate(date)); }; + +function areyousure(t) { + if (t.value) { + t.type = 'submit'; + t.value = 'Are you sure?' + } + else + { + t.innerHTML = t.innerHTML.replace(t.textContent, 'Are you sure?') + } + t.setAttribute("onclick", t.dataset.click); + + if (t.dataset.dismiss) + t.setAttribute("data-bs-dismiss", t.dataset.dismiss); +} diff --git a/files/classes/submission.py b/files/classes/submission.py index 4d10ce8e7..e00e0e154 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -374,7 +374,7 @@ class Submission(Base): body += " - WINNER!" if not winner and v and v.admin_level >= PERMS['POST_BETS_DISTRIBUTE']: - body += f'''''' + body += f'''''' body += "" else: input_type = 'radio' if o.exclusive else 'checkbox' diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 93f6b9a1a..1a549f3b6 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -32,11 +32,9 @@ - - + - - +
 				
diff --git a/files/templates/comments.html b/files/templates/comments.html index 73759a15d..6b6ae7803 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -642,9 +642,9 @@ {% endif %} {% if not c.ghost %} - Unblock user - Are you sure? - Block user + Unblock user + + Block user {% endif %} {% endif %} diff --git a/files/templates/hats.html b/files/templates/hats.html index 38fd23166..99a9d9409 100644 --- a/files/templates/hats.html +++ b/files/templates/hats.html @@ -124,14 +124,10 @@ {% if hat.id not in owned_hat_ids %}
- Buy - - Are you sure? + Buy {% if FEATURES['PROCOINS'] %} - MBux - - Are you sure? + MBux {% endif %}
{% endif %} diff --git a/files/templates/live.html b/files/templates/live.html index 0688078d9..ae5077f0f 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -59,8 +59,8 @@
- - + +
{% endif %} @@ -85,8 +85,7 @@
- - +
{% endif %} @@ -108,4 +107,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/files/templates/post_actions.html b/files/templates/post_actions.html index f0cc40d39..e7457391c 100644 --- a/files/templates/post_actions.html +++ b/files/templates/post_actions.html @@ -15,7 +15,7 @@ Copy link {% if v %} - Subscribe + Subscribe Unsubscribe {% endif %} diff --git a/files/templates/post_actions_mobile.html b/files/templates/post_actions_mobile.html index 4048c6784..cfb22f8db 100644 --- a/files/templates/post_actions_mobile.html +++ b/files/templates/post_actions_mobile.html @@ -16,7 +16,8 @@ {%- endif %} - + + @@ -46,8 +47,7 @@ {% else %} {% if not p.ghost %} - - + {% endif %} {% endif %} diff --git a/files/templates/shop.html b/files/templates/shop.html index 13bfdfe79..3b0653e84 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -102,13 +102,11 @@ {% set kind = a['kind'] %} {% if kind != "benefactor" %} - Buy - Are you sure? + Buy {% endif %} {% if FEATURES['PROCOINS'] %} {% if kind != "grass" %} - Buy with MBux - Are you sure? + Buy with MBux {% endif %} {% endif %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 79e22bdb5..e62b22c5a 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -227,7 +227,7 @@ Remove admin {% endif %} {% if v.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %} - Revert admin actions + Revert admin actions {% endif %} @@ -498,7 +498,7 @@ {% endif %} {% if v.admin_level >= PERMS['ADMIN_ACTIONS_REVERT'] %} - Revert admin actions + Revert admin actions {% endif %}