Skip to content

Commit c5681f9

Browse files
authored
chore: Updated template to account for real JSON Attributes (#33)
Signed-off-by: Diogo Pereira <diogo.pereira@swirldslabs.com>
1 parent 91adfe4 commit c5681f9

2 files changed

Lines changed: 75 additions & 14 deletions

File tree

commons/static_site_generator.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from jinja2 import Environment, FileSystemLoader
22

3-
def render_kanban_board(data, output_file='./_site/index.html'):
3+
def generate_site(data, output_file='./_site/index.html'):
44
env = Environment(loader=FileSystemLoader('templates'))
55
template = env.get_template('kaban_board.html')
66
output = template.render(data)
@@ -15,23 +15,40 @@ def render_kanban_board(data, output_file='./_site/index.html'):
1515
'team': 'Platform Engineering',
1616
'tasks': {
1717
'Backlog': [
18-
{'title': 'Research competitors', 'description': 'Analyze feature set'},
19-
{'title': 'Set up project repo', 'description': 'Initialize GitHub repo'},
2018
],
2119
'New': [
22-
{'title': 'Design wireframes', 'description': 'Homepage + Dashboard'},
20+
{
21+
"assignees": [
22+
"coolAssignee"
23+
],
24+
"content": {
25+
"body": "https://dummy_url/test#L42\n\nRename from `X` to `Y`",
26+
"number": 241,
27+
"repository": "pandas/coolrepo",
28+
"title": "cool title",
29+
"type": "Issue",
30+
"url": "https://github.com/pandas/coolrepo/issues/241"
31+
},
32+
"id": "PVTI_lADOBgkjhkjhjjh",
33+
"labels": [
34+
"Bug"
35+
],
36+
"linked pull requests": [
37+
"https://github.com/pandas/coolrepo/pull/242"
38+
],
39+
"repository": "https://github.com/pandas/coolrepo",
40+
"status": "Done",
41+
"title": "Cool Pandas Task"
42+
}
2343
],
2444
'In-Progress': [
25-
{'title': 'Implement auth', 'description': 'Login + Register'},
2645
],
2746
'Blocked': [
28-
{'title': 'API integration', 'description': 'Waiting for backend team'},
2947
],
3048
'Done': [
31-
{'title': 'Project kickoff', 'description': 'Team intro & planning'},
3249
]
3350
}
3451
}
3552

3653

37-
render_kanban_board(data)
54+
generate_site(data)

templates/kaban_board.html

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>{{ title }}</title>
6+
<link rel="icon" href="../images/favicon_io/favicon.ico" type="image/x-icon">
67
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
78
<style>
89
body {
@@ -33,27 +34,68 @@ <h1 class="mb-3 text-center">{{ title }}</h1>
3334

3435
<!-- Metadata and search -->
3536
<div class="row mb-4 align-items-center">
36-
<div class="col-md-4">
37-
<p><strong>GitHub User:</strong> {{ github_user }}</p>
37+
<div class="col-md-8">
38+
<p><strong>🧑‍💻 GitHub User:</strong> {{ github_user }}</p>
39+
<p><strong>♣️ Team:</strong> {{ team }}</p>
3840
</div>
39-
<div class="col-md-4">
41+
<!-- <div class="col-md-4">
4042
<p><strong>Team:</strong> {{ team }}</p>
41-
</div>
43+
</div> -->
4244
<div class="col-md-4">
4345
<input type="text" id="searchBox" class="form-control" placeholder="Search tasks...">
4446
</div>
4547
</div>
48+
</div>
4649

50+
<div class="container-fluid py-4">
4751
<!-- Kanban Board -->
4852
<div class="row row-cols-1 row-cols-md-5 g-3">
53+
{% set counter = 0 %}
4954
{% for status in ["Backlog", "New", "In-Progress", "Blocked", "Done"] %}
5055
<div class="col">
5156
<div class="kanban-column">
5257
<div class="kanban-header text-primary text-center">{{ status }}</div>
5358
{% for task in tasks[status] %}
59+
5460
<div class="kanban-card">
55-
<strong>{{ task.title }}</strong><br>
56-
<small>{{ task.description }}</small>
61+
{% set card_id = "card-" ~ counter %}
62+
{% set counter = counter + 1 %}
63+
<div class="d-flex align-items-start gap-2">
64+
<a
65+
href="{{ task.content.url }}"
66+
target="_blank"
67+
class="text-primary text-decoration-none fw-bold"
68+
>
69+
🟢 #{{ task.content.number }}
70+
</a>
71+
<a
72+
class="text-dark text-decoration-none fw-bold flex-grow-1"
73+
data-bs-toggle="collapse"
74+
href="#{{ card_id }}"
75+
role="button"
76+
aria-expanded="false"
77+
aria-controls="{{ card_id }}"
78+
>
79+
{{ task.title }}
80+
</a>
81+
</div>
82+
<div class="collapse mt-2" id="{{ card_id }}">
83+
<!-- <div><small><strong>Issue #:</strong> {{ task.content.number }}</small></div> -->
84+
<div>
85+
<small>
86+
<strong>📦 Repository:</strong>
87+
<a href="{{ task.repository }}" target="_blank">
88+
{{ task.content.repository }}
89+
</a>
90+
</small>
91+
</div>
92+
<div><small><strong>👤 Assignee:</strong> {{ task.assignees | join(', ') }}</small></div>
93+
<div><small><strong>🏷️ Labels:</strong> {{ task.labels | join(', ') }}</small></div>
94+
<div><small><strong>📌 Status:</strong> {{ task.status }}</small></div>
95+
<div class="text-center">
96+
<a href="{{ task.content.url }}" target="_blank" class="btn btn-sm btn-outline-primary mt-2">View Issue</a>
97+
</div>
98+
</div>
5799
</div>
58100
{% endfor %}
59101
</div>
@@ -86,6 +128,8 @@ <h1 class="mb-3 text-center">{{ title }}</h1>
86128
});
87129
});
88130
</script>
131+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
132+
89133

90134
</body>
91135
</html>

0 commit comments

Comments
 (0)