Skip to content

Commit 14d55a4

Browse files
authored
Merge pull request #9 from hackclub/heliodex/templates
Template formatting
2 parents e729c75 + ef7d483 commit 14d55a4

48 files changed

Lines changed: 2815 additions & 3125 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

twisted/common/templates/base.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
{% load tailwind_tags static %}
2-
<html>
3-
<head>
4-
{% tailwind_css %}
5-
{% block head %}{% endblock head %}
6-
<link rel="icon" href="{% static 'favicon.png' %}" />
7-
<title>Twisted</title>
8-
</head>
9-
<body class="font-vintage os">
10-
{% block body %}
11-
meow :3
12-
{% endblock body %}
13-
</body>
14-
<script>
15-
// Timezone settings
16-
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; // e.g. "America/New_York"
17-
document.cookie = "django_timezone=" + timezone;
18-
</script>
19-
</html>
2+
<!DOCTYPE html>
3+
<html lang="en">
4+
<head>
5+
{% tailwind_css %}
6+
{% block head %}
7+
{% endblock head %}
8+
<link rel="icon" href="{% static 'favicon.png' %}">
9+
<title>Twisted</title>
10+
</head>
11+
<body class="font-vintage os">
12+
{% block body %}
13+
meow :3
14+
{% endblock body %}
15+
</body>
16+
<script>
17+
// Timezone settings
18+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; // e.g. "America/New_York"
19+
document.cookie = `django_timezone=${timezone}`;
20+
</script>
21+
</html>

twisted/tailwindcsstheme/static_src/src/cotton-ui.sources.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

twisted/twisted_site/slack.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any
2+
13
from django.conf import settings
24
from slack_sdk import WebClient
35

@@ -7,6 +9,18 @@
79
slack_bot = WebClient(token=SLACK_TOKEN)
810

911

12+
def send_blocks(
13+
*,
14+
channel: str,
15+
blocks: list[dict[str, Any]],
16+
text: str = " ",
17+
**kwargs: Any,
18+
):
19+
return slack_bot.chat_postMessage(
20+
channel=channel, text=text, blocks=blocks, **kwargs
21+
)
22+
23+
1024
def log_to_channel(message):
1125
if settings.DEBUG:
1226
slack_bot.chat_postMessage(
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<c-base>
2-
<c-ui.button variant="primary">Primary Button</c-ui.button>
3-
<c-ui.button variant="default">Default Button</c-ui.button>
4-
5-
</c-base>
2+
<c-ui.button variant="primary">
3+
Primary Button
4+
</c-ui.button>
5+
<c-ui.button variant="default">
6+
Default Button
7+
</c-ui.button>
8+
</c-base>
Lines changed: 92 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
<c-base>
22
<c-slot name="head">
3-
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
3+
<script src="https://www.gstatic.com/charts/loader.js"></script>
44
</c-slot>
55
<c-ui.card class="bg-zinc-900 mb-4">
66
<h3 class="text-lg font-semibold mb-2">Welcome back, {{ user.profile.slack_username }}!</h3>
77
<p class="text-ink-400">
8-
<c-ui.button onclick="alert('weh, you are looking at them right now >:(')">See statistics</c-ui.button>
8+
<c-ui.button onclick="alert('weh, you are looking at them right now >:(')">
9+
See statistics
10+
</c-ui.button>
911
<a href="{% url 'admin.users' %}">
10-
<c-ui.button>Manage Users</c-ui.button>
12+
<c-ui.button>
13+
Manage Users
14+
</c-ui.button>
1115
</a>
12-
<c-ui.button>Edit Pathways</c-ui.button>
13-
<c-ui.button>Fulfill orders</c-ui.button>
14-
<c-ui.button>Edit shop</c-ui.button>
15-
<c-ui.button>Review projects</c-ui.button>
16-
<c-ui.button>Announce stuff</c-ui.button>
16+
<c-ui.button>
17+
Edit Pathways
18+
</c-ui.button>
19+
<c-ui.button>
20+
Fulfill orders
21+
</c-ui.button>
22+
<c-ui.button>
23+
Edit shop
24+
</c-ui.button>
25+
<c-ui.button>
26+
Review projects
27+
</c-ui.button>
28+
<c-ui.button>
29+
Announce stuff
30+
</c-ui.button>
1731
</p>
1832
</c-ui.card>
1933
<c-ui.tabs variant="segmented">
@@ -22,29 +36,32 @@ <h3 class="text-lg font-semibold mb-2">Welcome back, {{ user.profile.slack_usern
2236
<div class="flex flex-col md:flex-row text-center md:text-left gap-4">
2337
<div class="md:w-fit">
2438
<div>
25-
<div class="text-center">
26-
Hours logged
27-
</div>
28-
<div class="text-center text-lg font-bold">
29-
{{ hours_logged }}h
30-
</div>
39+
<div class="text-center">Hours logged</div>
40+
<div class="text-center text-lg font-bold">{{ hours_logged }}h</div>
3141
<div id="hours_logged_chart" class="mx-auto md:mx-0">
32-
<div class="text-center py-4">
33-
Loading chart...
34-
</div>
42+
<div class="text-center py-4">Loading chart...</div>
3543
</div>
3644
</div>
37-
<script type="text/javascript">
38-
google.charts.load('current', {'packages':['corechart']});
45+
<script>
46+
google.charts.load('current', {
47+
'packages': ['corechart']
48+
});
3949
google.charts.setOnLoadCallback(drawChart);
4050

4151
function drawChart() {
4252
var data = google.visualization.arrayToDataTable({{ hours_logged_chart|safe }});
4353

4454
var options = {
45-
vAxis: {minValue: 0},
46-
animation: {duration: 250, startup: true},
47-
backgroundColor: {fill: 'transparent'},
55+
vAxis: {
56+
minValue: 0
57+
},
58+
animation: {
59+
duration: 250,
60+
startup: true
61+
},
62+
backgroundColor: {
63+
fill: 'transparent'
64+
},
4865
theme: "maximized",
4966
width: 240,
5067
height: 160
@@ -57,26 +74,31 @@ <h3 class="text-lg font-semibold mb-2">Welcome back, {{ user.profile.slack_usern
5774
</div>
5875
<div class="md:w-fit flex flex-row">
5976
<div>
60-
<div class="text-center">
61-
Project type
62-
</div>
77+
<div class="text-center">Project type</div>
6378
<div id="logged_project_type" class="mx-auto md:mx-0 mt-6">
64-
<div class="text-center py-4">
65-
Loading chart...
66-
</div>
79+
<div class="text-center py-4">Loading chart...</div>
6780
</div>
6881
</div>
69-
<script type="text/javascript">
70-
google.charts.load('current', {'packages':['corechart']});
82+
<script>
83+
google.charts.load('current', {
84+
'packages': ['corechart']
85+
});
7186
google.charts.setOnLoadCallback(drawChart);
7287

7388
function drawChart() {
7489
var data = google.visualization.arrayToDataTable({{ logged_project_type|safe }});
7590

7691
var options = {
77-
vAxis: {minValue: 0},
78-
animation: {duration: 250, startup: true},
79-
backgroundColor: {fill: 'transparent'},
92+
vAxis: {
93+
minValue: 0
94+
},
95+
animation: {
96+
duration: 250,
97+
startup: true
98+
},
99+
backgroundColor: {
100+
fill: 'transparent'
101+
},
80102
theme: "maximized",
81103
width: 240,
82104
height: 160
@@ -94,60 +116,68 @@ <h3 class="text-lg font-semibold mb-2">Welcome back, {{ user.profile.slack_usern
94116
<c-ui.card class="bg-zinc-900">
95117
<div class="flex flex-col md:flex-row text-center md:text-left gap-4">
96118
<div class="md:w-fit">
97-
<div class="text-center">
98-
Hours shipped
99-
</div>
100-
<div class="text-center text-lg font-bold">
101-
{{ hours_shipped }}h
102-
</div>
119+
<div class="text-center">Hours shipped</div>
120+
<div class="text-center text-lg font-bold">{{ hours_shipped }}h</div>
103121
<div id="hours_shipped_chart" class="mx-auto md:mx-0">
104-
<div class="text-center py-4">
105-
Loading chart...
106-
</div>
122+
<div class="text-center py-4">Loading chart...</div>
107123
</div>
108-
<script type="text/javascript">
109-
google.charts.load('current', {'packages':['corechart']});
124+
<script>
125+
google.charts.load('current', {
126+
'packages': ['corechart']
127+
});
110128
google.charts.setOnLoadCallback(drawChart);
111-
129+
112130
function drawChart() {
113131
var data = google.visualization.arrayToDataTable({{ hours_shipped_chart|safe }});
114-
132+
115133
var options = {
116-
vAxis: {minValue: 0},
117-
animation: {duration: 250, startup: true},
118-
backgroundColor: {fill: 'transparent'},
134+
vAxis: {
135+
minValue: 0
136+
},
137+
animation: {
138+
duration: 250,
139+
startup: true
140+
},
141+
backgroundColor: {
142+
fill: 'transparent'
143+
},
119144
theme: "maximized",
120145
width: 240,
121146
height: 160
122147
};
123-
148+
124149
var chart = new google.visualization.AreaChart(document.getElementById('hours_shipped_chart'));
125150
chart.draw(data, options);
126151
}
127152
</script>
128153
</div>
129154
<div class="md:w-fit flex flex-row">
130155
<div>
131-
<div class="text-center">
132-
Project type
133-
</div>
156+
<div class="text-center">Project type</div>
134157
<div id="shipped_project_type" class="mx-auto md:mx-0 mt-6">
135-
<div class="text-center py-4">
136-
Loading chart...
137-
</div>
158+
<div class="text-center py-4">Loading chart...</div>
138159
</div>
139160
</div>
140-
<script type="text/javascript">
141-
google.charts.load('current', {'packages':['corechart']});
161+
<script>
162+
google.charts.load('current', {
163+
'packages': ['corechart']
164+
});
142165
google.charts.setOnLoadCallback(drawChart);
143166

144167
function drawChart() {
145168
var data = google.visualization.arrayToDataTable({{ shipped_project_type|safe }});
146169

147170
var options = {
148-
vAxis: {minValue: 0},
149-
animation: {duration: 250, startup: true},
150-
backgroundColor: {fill: 'transparent'},
171+
vAxis: {
172+
minValue: 0
173+
},
174+
animation: {
175+
duration: 250,
176+
startup: true
177+
},
178+
backgroundColor: {
179+
fill: 'transparent'
180+
},
151181
theme: "maximized",
152182
width: 240,
153183
height: 160
@@ -165,4 +195,4 @@ <h3 class="text-lg font-semibold mb-2">Welcome back, {{ user.profile.slack_usern
165195
This is still WIP! (annoy @kavyansh. to fix if you see this after the YSWS has started!)
166196
</c-ui.tabs.tab>
167197
</c-ui.tabs>
168-
</c-base>
198+
</c-base>

0 commit comments

Comments
 (0)