Skip to content

Commit

Permalink
add stabile political message to dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
lilioid committed Nov 18, 2024
1 parent 656440d commit 3521360
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mafiasi/base/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ body {
border-radius: 10px;
}

/* ------- Stabile Message ------*/
#stabile-message {
position: fixed;
bottom: 1vw;
left: auto;
right: 1vw;
margin: 0;
cursor: pointer;
user-select: none;

border: none;
padding: 10px 16px;
background: #23527c;
color: white;
border-radius: 4px;
letter-spacing: 0ch;
font-size: large;
font-style: normal;
}

/* ------- MISC -------*/
.clickable {
cursor: pointer;
Expand Down
10 changes: 10 additions & 0 deletions mafiasi/base/static/js/stabile_message.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
document.addEventListener("DOMContentLoaded", () => {
const dialog = document.getElementById("stabile-message");

// close dialog when clicked
const close = () => dialog.style.display = "none";
dialog.addEventListener("click", close);

// alternatively, also close dialog after 20 seconds
setTimeout(close, 20 * 1000);
})
6 changes: 6 additions & 0 deletions mafiasi/base/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% load group_tags %}
{% load settings_value %}
{% load static %}
{% load stabile_message %}
{% value_from_settings BANNER_IMG as banner_img %}
{% value_from_settings FAVICON_PATH as favicon_path %}
<!DOCTYPE html>
Expand Down Expand Up @@ -129,11 +130,16 @@ <h2>{% block ptitle %}{% endblock %}</h2>
<script src="{% static 'js/snow.js' %}" type="module"></script>
{% endif %}

<aside id="stabile-message">
<span>{% stabile_message %}</span>
</aside>

<script src="{% static 'js/jquery-2.0.3.js' %}" type="text/javascript"></script>
<script src="{% static 'js/jquery-ui-1.12.1.custom.js' %}" type="text/javascript"></script>
<script src="{% static 'js/common.js' %}" type="text/javascript"></script>
<script src="{% static 'js/bootstrap.js' %}" type="text/javascript"></script>
<script src="{% static 'js/misc.js' %}" type="text/javascript"></script>
<script src="{% static 'js/stabile_message.mjs' %}" type="module"></script>
{% block js %}
{% endblock js %}
</body>
Expand Down
31 changes: 31 additions & 0 deletions mafiasi/base/templatetags/stabile_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import random

from django import template

register = template.Library()


possible_texts = [
"Du bist die Brandmauer gegen Rechts",
"„Unpolitisch“ ist politisch",
"Die AfD ist die mit Abstand größte Gefahr für unsere Gesellschaft! #AfDVerbotJetzt",
"Sich an Antifaschismus stören ist so 1933",
"Dieser Service wird nicht von Faschisten betrieben",
"Menschenrechte statt rechte Menschen",
"Kein Mensch ist illegal",
"„Nie wieder“ ist immer, nicht nur alle 4 Jahre beim Kreuzchen machen",
"Kein Platz für Rassismus",
"Trans rights are human rights",
"Trans rights or riot nights",
"Die Brandmauer ist überall. Auch im Studium!",
"Nazis morden, der Staat schiebt ab – das ist das gleiche Rassistenpack",
"AfDler verpisst euch – keiner vermisst euch",
"Seenotrettung ist kein Verbrechen",
"Nein heißt Nein, No means No, wer das sagt der meints auch so",
]


@register.simple_tag
def stabile_message() -> str:
print("Hi")
return random.choice(possible_texts)

0 comments on commit 3521360

Please sign in to comment.