Skip to content

Commit

Permalink
add enable button
Browse files Browse the repository at this point in the history
  • Loading branch information
kritzl committed Apr 1, 2024
1 parent 35e2f27 commit d4fc4a6
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 54 deletions.
24 changes: 12 additions & 12 deletions locale/de_DE/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-01 02:11+0200\n"
"POT-Creation-Date: 2024-04-01 02:42+0200\n"
"PO-Revision-Date: 2024-01-18 22:42+0100\n"
"Last-Translator: Markus Neblung <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -39,51 +39,51 @@ msgstr ""
"Bitte versuche es später nochmal. Falls das Problem bestehen bleibt, schaue "
"auf unsere <a href=\"%(problems_url)s\">Fehlermeldeseite</a>."

#: mafiasi/base/templates/base.html:42
#: mafiasi/base/templates/base.html:46
msgid "Disable surprise"
msgstr "Überraschung abschalten"

#: mafiasi/base/templates/base.html:52
#: mafiasi/base/templates/base.html:56
msgid "Groups"
msgstr "Gruppen"

#: mafiasi/base/templates/base.html:60
#: mafiasi/base/templates/base.html:64
#: mafiasi/mailinglist/templates/mailinglist/show_list.html:46
msgid "Settings"
msgstr "Einstellungen"

#: mafiasi/base/templates/base.html:63
#: mafiasi/base/templates/base.html:67
#, python-format
msgid "Logged in as %(username)s"
msgstr "Angemeldet als %(username)s"

#: mafiasi/base/templates/base.html:66
#: mafiasi/base/templates/base.html:70
msgid "Logout"
msgstr "Abmelden"

#: mafiasi/base/templates/base.html:72
#: mafiasi/base/templates/base.html:76
#: mafiasi/registration/templates/registration/request_account.html:38
#: mafiasi/registration/templates/registration/request_account.html:77
msgid "Register"
msgstr "Registrieren"

#: mafiasi/base/templates/base.html:74
#: mafiasi/base/templates/base.html:78
msgid "Login"
msgstr "Login"

#: mafiasi/base/templates/base.html:103
#: mafiasi/base/templates/base.html:107
msgid "Imprint"
msgstr "Impressum"

#: mafiasi/base/templates/base.html:105
#: mafiasi/base/templates/base.html:109
msgid "Data privacy statement"
msgstr "Datenschutzerklärung"

#: mafiasi/base/templates/base.html:107
#: mafiasi/base/templates/base.html:111
msgid "Technical info"
msgstr "Technik"

#: mafiasi/base/templates/base.html:109
#: mafiasi/base/templates/base.html:113
#: mafiasi/base/templates/base/problems.html:4
msgid "Problems?"
msgstr "Probleme?"
Expand Down
24 changes: 12 additions & 12 deletions locale/en_US/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-01 02:11+0200\n"
"POT-Creation-Date: 2024-04-01 02:42+0200\n"
"PO-Revision-Date: 2024-01-18 22:42+0100\n"
"Last-Translator: Markus Neblung <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -31,51 +31,51 @@ msgid ""
"href=\"%(problems_url)s\">problem reporting page</a>."
msgstr ""

#: mafiasi/base/templates/base.html:42
#: mafiasi/base/templates/base.html:46
msgid "Disable surprise"
msgstr ""

#: mafiasi/base/templates/base.html:52
#: mafiasi/base/templates/base.html:56
msgid "Groups"
msgstr ""

#: mafiasi/base/templates/base.html:60
#: mafiasi/base/templates/base.html:64
#: mafiasi/mailinglist/templates/mailinglist/show_list.html:46
msgid "Settings"
msgstr ""

#: mafiasi/base/templates/base.html:63
#: mafiasi/base/templates/base.html:67
#, python-format
msgid "Logged in as %(username)s"
msgstr ""

#: mafiasi/base/templates/base.html:66
#: mafiasi/base/templates/base.html:70
msgid "Logout"
msgstr ""

#: mafiasi/base/templates/base.html:72
#: mafiasi/base/templates/base.html:76
#: mafiasi/registration/templates/registration/request_account.html:38
#: mafiasi/registration/templates/registration/request_account.html:77
msgid "Register"
msgstr ""

#: mafiasi/base/templates/base.html:74
#: mafiasi/base/templates/base.html:78
msgid "Login"
msgstr ""

#: mafiasi/base/templates/base.html:103
#: mafiasi/base/templates/base.html:107
msgid "Imprint"
msgstr ""

#: mafiasi/base/templates/base.html:105
#: mafiasi/base/templates/base.html:109
msgid "Data privacy statement"
msgstr ""

#: mafiasi/base/templates/base.html:107
#: mafiasi/base/templates/base.html:111
msgid "Technical info"
msgstr ""

#: mafiasi/base/templates/base.html:109
#: mafiasi/base/templates/base.html:113
#: mafiasi/base/templates/base/problems.html:4
msgid "Problems?"
msgstr ""
Expand Down
24 changes: 12 additions & 12 deletions locale/en_Uwu/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-01 02:11+0200\n"
"POT-Creation-Date: 2024-04-01 02:42+0200\n"
"PO-Revision-Date: 2024-01-09 22:14+0000\n"
"Last-Translator: kritzl <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -42,51 +42,51 @@ msgstr ""
"again later. If the problem persists, see our <a "
"href=\"%(problems_url)s\">problem reporting page</a>."

#: mafiasi/base/templates/base.html:42
#: mafiasi/base/templates/base.html:46
msgid "Disable surprise"
msgstr "Me no like this mess ._."

#: mafiasi/base/templates/base.html:52
#: mafiasi/base/templates/base.html:56
msgid "Groups"
msgstr "frens"

#: mafiasi/base/templates/base.html:60
#: mafiasi/base/templates/base.html:64
#: mafiasi/mailinglist/templates/mailinglist/show_list.html:46
msgid "Settings"
msgstr "Change me >﹏<"

#: mafiasi/base/templates/base.html:63
#: mafiasi/base/templates/base.html:67
#, python-format
msgid "Logged in as %(username)s"
msgstr "U is %(username)s"

#: mafiasi/base/templates/base.html:66
#: mafiasi/base/templates/base.html:70
msgid "Logout"
msgstr "Bye bye 👋"

#: mafiasi/base/templates/base.html:72
#: mafiasi/base/templates/base.html:76
#: mafiasi/registration/templates/registration/request_account.html:38
#: mafiasi/registration/templates/registration/request_account.html:77
msgid "Register"
msgstr "Become fren <3"

#: mafiasi/base/templates/base.html:74
#: mafiasi/base/templates/base.html:78
msgid "Login"
msgstr "Get inside"

#: mafiasi/base/templates/base.html:103
#: mafiasi/base/templates/base.html:107
msgid "Imprint"
msgstr "Pawprint"

#: mafiasi/base/templates/base.html:105
#: mafiasi/base/templates/base.html:109
msgid "Data privacy statement"
msgstr "How me uses ur data"

#: mafiasi/base/templates/base.html:107
#: mafiasi/base/templates/base.html:111
msgid "Technical info"
msgstr "Complicated thingies"

#: mafiasi/base/templates/base.html:109
#: mafiasi/base/templates/base.html:113
#: mafiasi/base/templates/base/problems.html:4
msgid "Problems?"
msgstr "Problems?"
Expand Down
24 changes: 12 additions & 12 deletions locale/fr_FR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Mafiasi\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-01 02:11+0200\n"
"POT-Creation-Date: 2024-04-01 02:42+0200\n"
"PO-Revision-Date: 2024-01-18 22:41+0100\n"
"Last-Translator: Markus Neblung <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -39,51 +39,51 @@ msgstr ""
"problème persiste, consultez notre <a href=\"%(problems_url)s\"> page de "
"rapports d'incidents </a>."

#: mafiasi/base/templates/base.html:42
#: mafiasi/base/templates/base.html:46
msgid "Disable surprise"
msgstr "Désactiver la surprise"

#: mafiasi/base/templates/base.html:52
#: mafiasi/base/templates/base.html:56
msgid "Groups"
msgstr "Groupes"

#: mafiasi/base/templates/base.html:60
#: mafiasi/base/templates/base.html:64
#: mafiasi/mailinglist/templates/mailinglist/show_list.html:46
msgid "Settings"
msgstr "Paramètres"

#: mafiasi/base/templates/base.html:63
#: mafiasi/base/templates/base.html:67
#, python-format
msgid "Logged in as %(username)s"
msgstr "Connecté en tant que %(username)s"

#: mafiasi/base/templates/base.html:66
#: mafiasi/base/templates/base.html:70
msgid "Logout"
msgstr "Déconnecter"

#: mafiasi/base/templates/base.html:72
#: mafiasi/base/templates/base.html:76
#: mafiasi/registration/templates/registration/request_account.html:38
#: mafiasi/registration/templates/registration/request_account.html:77
msgid "Register"
msgstr "Enregistrez-Vous"

#: mafiasi/base/templates/base.html:74
#: mafiasi/base/templates/base.html:78
msgid "Login"
msgstr "Connectez-Vouz"

#: mafiasi/base/templates/base.html:103
#: mafiasi/base/templates/base.html:107
msgid "Imprint"
msgstr "Empreinte"

#: mafiasi/base/templates/base.html:105
#: mafiasi/base/templates/base.html:109
msgid "Data privacy statement"
msgstr "Politique de confidentialité"

#: mafiasi/base/templates/base.html:107
#: mafiasi/base/templates/base.html:111
msgid "Technical info"
msgstr "Information technique"

#: mafiasi/base/templates/base.html:109
#: mafiasi/base/templates/base.html:113
#: mafiasi/base/templates/base/problems.html:4
msgid "Problems?"
msgstr "Problèmes?"
Expand Down
4 changes: 3 additions & 1 deletion mafiasi/base/special_day_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def __call__(self, request):
n = localdate(now(), get_current_timezone())

# check if user disabled special day surprises via cookie
if not request.COOKIES.get("disable-special", False):
if request.COOKIES.get("disable-special", False):
request.session["specialFeature"] = "DISABLED"
else:
# first of april (april fools)
if n.day == 1 and n.month == 4:
request.session["specialDay"] = "April Fools"
Expand Down
2 changes: 1 addition & 1 deletion mafiasi/base/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ body {
cursor: pointer;
}

#specialfeature-off {
.special-toggle {
margin-top: 14px;
}
10 changes: 9 additions & 1 deletion mafiasi/base/static/js/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ function disableSpecialFeature() {
window.location.reload()
}

document.querySelector('#specialfeature-off').addEventListener('click', disableSpecialFeature)
function enableSpecialFeature() {
document.cookie = `disable-special=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure`;
window.location.reload()
}

const specialOff = document.querySelector('#special-off');
const specialOn = document.querySelector('#special-on');
if(specialOff) specialOff.addEventListener('click', disableSpecialFeature)
if(specialOn) specialOn.addEventListener('click', enableSpecialFeature)
10 changes: 7 additions & 3 deletions mafiasi/base/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
{% block headJS %}
{% endblock %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="{% static 'css/darkmode.css' %}" />
<link rel="stylesheet" href="{% static 'css/darkmode.css' %}" preload/>
<script>
if (localStorage.mafiasi_theme) document.documentElement.dataset.theme = localStorage.mafiasi_theme;
</script>
Expand All @@ -37,8 +37,12 @@
{% endif %}
<div class="container">
<a href="/" class="navbar-brand">{% value_from_settings PROJECT_BANNER %}</a>
{% if request.session.specialFeature %}
<a class="btn btn-danger btn-xs" href="#" id="specialfeature-off">
{% if request.session.specialFeature == 'DISABLED' %}
<a class="btn btn-success btn-xs special-toggle" href="#" id="special-on">
<span class="glyphicon glyphicon-gift"></span>
</a>
{% else %}
<a class="btn btn-danger btn-xs special-toggle" href="#" id="special-off">
<span class="glyphicon glyphicon-gift"></span> {% trans "Disable surprise" %}
</a>
{% endif %}
Expand Down

0 comments on commit d4fc4a6

Please sign in to comment.