Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b3c2048
Add beginning of new token game layout page
0xUnicorn May 27, 2025
7612f8f
Add property to camp model, for returning the year of a camp
0xUnicorn May 28, 2025
29bc4b0
Add camp redirect url path for token game. Add camp_slug to token gam…
0xUnicorn May 28, 2025
b60203d
Implement new 'camp.year' property in the example token. Remove all o…
0xUnicorn May 28, 2025
56393e2
Add logic for a token with a datetime range being valid
0xUnicorn May 28, 2025
808b271
Add a 'thead' and move all of the 'th' elements. Make the table a 'da…
0xUnicorn May 28, 2025
7900c25
Remove not used 'textarea' that was commented out
0xUnicorn May 28, 2025
db34a30
Rename 'TokenFindListView' to 'TokenDashbordListView'. Remove the 'Se…
0xUnicorn May 28, 2025
2b538e8
Rename 'tokenfind_list.html' to 'token_dashboard.html'
0xUnicorn May 28, 2025
05505f4
Change menuitem after url name has changed
0xUnicorn May 29, 2025
10fdd16
Implemented new 'SubmitFormView' with migrated logic from previous 'T…
0xUnicorn May 29, 2025
a94ec5d
Add token dashboard stats, first draft for 'total players' and 'token…
0xUnicorn May 30, 2025
c48d4c9
Add unique constraint between 'camp' and 'token'
0xUnicorn Jun 5, 2025
d9b2127
Add users avg find time. Avg find time for all players should be chan…
0xUnicorn Jun 5, 2025
1906dba
Move validation for expired token before validation for an active token
0xUnicorn Jun 5, 2025
f1a42f4
Merge branch 'main' into token-makeover
0xUnicorn Jun 5, 2025
9ade688
Merge branch 'main' into token-makeover
0xUnicorn Jun 5, 2025
c8882bd
Widget styling
0xUnicorn Jun 5, 2025
5d07dfa
Add beginning of new token category
0xUnicorn Jun 6, 2025
542adbc
Rename 'category' to 'hint' and add FK to 'TokenCategory'
0xUnicorn Jun 12, 2025
6d55ed3
Add check for returning 0 minutes if no avg times is found for all pl…
0xUnicorn Jun 17, 2025
131e9e4
Consolidate and clean up code.
0xUnicorn Jun 17, 2025
66dd806
Restructure view functions. Use datetime objects for showing times wi…
0xUnicorn Jun 20, 2025
689d5ca
Add 'apexchart' library. Render pie charts for 2 widgets. Make POC wi…
0xUnicorn Jun 20, 2025
87dea7a
Add widget 'token activity' with a bar chart
0xUnicorn Jun 24, 2025
3432cd8
Add TokenCategory to admin panel. Add task for creating 'TokenCategor…
0xUnicorn Jun 24, 2025
625fcd2
Merge branch 'main' into token-makeover
0xUnicorn Jun 24, 2025
f016cbc
Merge branch 'bornhack:main' into token-makeover
0xUnicorn Jun 24, 2025
abf2881
Fix unpacking of value is missing when bootstrap creates token catego…
0xUnicorn Jun 24, 2025
84e4eac
Merge branch 'token-makeover' of github.com:0xUnicorn/bornhack-websit…
0xUnicorn Jun 24, 2025
3a210da
Change plural naming of 'token category' model
0xUnicorn Jun 24, 2025
8eaa00a
Change 'Avg time' widget for a 'Token categories' widget
0xUnicorn Jun 24, 2025
c92a7dd
Add missing 'Game team' to bootstrap script
0xUnicorn Jun 24, 2025
ce31338
Fix wrong link for 'back' button in 'token_form', now linking back to…
0xUnicorn Jun 24, 2025
91ae425
Fix missing 'list-group list-group-flush' CSS class by adding it to '…
0xUnicorn Jun 24, 2025
a8ca3f4
Integrate 'token category' into backoffice. Add 'created/updated' to …
0xUnicorn Jun 25, 2025
cf1c9fd
Better naming of functions and variables
0xUnicorn Jun 26, 2025
6816d1e
Fix existing tests that broke during refactor and add a single new te…
0xUnicorn Jun 26, 2025
fea12f3
Consolidate widget data parsing from template to JS file in 'extra_he…
0xUnicorn Jun 27, 2025
22f15c1
Fix wrong 'theme' value used for ternary operator logic
0xUnicorn Jun 27, 2025
ff8f7d3
Fix 'typo' for document ready, is now EventListener for 'DOMContentLo…
0xUnicorn Jun 27, 2025
0073476
Implemented fully no-js compatible icons and widgets
0xUnicorn Jun 27, 2025
1abc494
Add regex validator to 'Token' model, with tests
0xUnicorn Jun 29, 2025
d2df54e
Remove the regex from url path and substitute with a 'str:token', so …
0xUnicorn Jun 29, 2025
49e44fb
Fix broken test by adding css class, it broke after adding 'no-js' wi…
0xUnicorn Jun 29, 2025
3ddd709
Add monochrome coloring, using the 'camp_colour' attribute.
0xUnicorn Jul 1, 2025
c4f4159
Added negative space around the page for better mobile view
0xUnicorn Jul 4, 2025
43440bf
Merge main
0xUnicorn Jul 6, 2025
26e7895
Merge branch 'token-makeover' of github.com:0xUnicorn/bornhack-websit…
0xUnicorn Jul 6, 2025
a25bde5
Merge branch 'main' into token-makeover
tykling Jul 6, 2025
d2355ed
Change email column to 'Public credit name' and 'username'
0xUnicorn Jul 6, 2025
a02f2a1
Remove 'camp.year' property again. Apply 'total_players' series and l…
0xUnicorn Jul 6, 2025
12095ce
Merge branch 'token-makeover' of github.com:0xUnicorn/bornhack-websit…
0xUnicorn Jul 6, 2025
f34d88b
Fix reversed lists for 'no_js' widget but not for chart series/labels…
0xUnicorn Jul 6, 2025
ae4ee60
Margin styling for bar chart
0xUnicorn Jul 6, 2025
fefedb4
Add green colored table rows when user has found a token. Reason for …
0xUnicorn Jul 6, 2025
616c75a
Consolidate latest migrations
0xUnicorn Jul 7, 2025
7822dcc
Add custom data migration for adding token categories
0xUnicorn Jul 8, 2025
7122e5d
Add extra categories
0xUnicorn Jul 8, 2025
8ac8a3a
Run pre-commit
0xUnicorn Jul 8, 2025
6b519a8
Merge branch 'main' into token-makeover
tykling Jul 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/backoffice/templates/includes/index_facilities.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% if perms.camps.orga_team_member or facilityfeedback_teams or is_team_facilitator or perms.camps.gis_team_member %}
<h3>Facilities</h3>
<div class="list-group list-group-flush">
{% if perms.camps.orga_team_member or perms.camps.gis_team_member %}
<a href="{% url 'backoffice:facility_type_list' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">
Expand Down Expand Up @@ -35,5 +34,4 @@ <h4 class="list-group-item-heading">
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
9 changes: 6 additions & 3 deletions src/backoffice/templates/includes/index_game.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{% if perms.camps.game_team_member %}
<h3>Secret Tokens</h3>
<h3>Game Team</h3>
<a href="{% url 'backoffice:token_list' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">Tokens</h4>
<p class="list-group-item-text">Use this view to see a list of Tokens, and to create, update and delete them</p>
</a>
<p class="list-group-item-text">Use this view to see a list of Tokens, and to <b>create</b>, <b>update</b> and <b>delete</b> them</p> </a>
<a href="{% url 'backoffice:token_stats' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">Token Stats</h4>
<p class="list-group-item-text">Use this view to see token find stats</p>
</a>
<a href="{% url 'backoffice:token_category_list' camp_slug=camp.slug %}" class="list-group-item list-group-item-action">
<h4 class="list-group-item-heading">Token categories</h4>
<p class="list-group-item-text">Use this view to see a list of Token Categories, and to <b>create</b>, <b>update</b> and <b>delete</b> them</p>
</a>
{% endif %}
2 changes: 2 additions & 0 deletions src/backoffice/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ <h3 class="ms-3">{{ camp.title }} Backoffice</h3>
<div class="tab-content">
{% for item, value in backoffice_tabs.items %}
<div role="tabpanel" class="tab-pane fade{% if forloop.first %} show active{% endif %}" id="{{ item }}">
<div class="list-group list-group-flush">
{% include "includes/index_"|add:item|add:".html" %}
</div>
</div>
{% endfor %}
</div>
Expand Down
18 changes: 18 additions & 0 deletions src/backoffice/templates/token_category_delete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'base.html' %}
{% load django_bootstrap5 %}

{% block content %}
<div class="card">
<div class="card-header">
<h2 class="card-title">Delete Token category {{ object.name }}?</h2>
</div>
<div class="card-body">
<p class="lead">This Category has <b>{{ object.token_set.count }}</b> Tokens related</p>
<form method="POST">
{% csrf_token %}
<button type="submit" name="Delete" class="btn btn-danger"><i class="fas fa-times"></i> Yes, Delete it</button>
<a href="{% url 'backoffice:token_category_list' camp_slug=camp.slug %}" class="btn btn-secondary"><i class="fas fa-undo"></i> Cancel</a>
</form>
</div>
</div>
{% endblock content %}
65 changes: 65 additions & 0 deletions src/backoffice/templates/token_category_detail.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% extends 'base.html' %}

{% block title %}
Token Category Details | BackOffice | {{ block.super }}
{% endblock %}

{% block content %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Token Category Details | BackOffice</h3>
</div>
<div class="card-body">
<p>
<a href="{% url 'backoffice:token_category_update' camp_slug=camp.slug pk=object.pk %}" class="btn btn-primary"><i class="fas fa-edit"></i> Update Category</a>
<a href="{% url 'backoffice:token_category_delete' camp_slug=camp.slug pk=object.pk %}" class="btn btn-danger"><i class="fas fa-times"></i> Delete Category</a>
<a href="{% url 'backoffice:token_category_list' camp_slug=camp.slug %}" class="btn btn-secondary"><i class="fas fa-undo"></i> Category List</a>
</p>
<table class="table">
<tbody>
<tr>
<th>Category:</th>
<td>{{ object.name }}</p>
</tr>
<tr>
<th>Description:</th>
<td>{{ object.description }}</p>
</tr>
<tr>
<th>Used by:</th>
<td>{{ object.token_set.count }}</td>
</tr>
<tr>
<th>Created:</th>
<td>{{ object.created }}</p>
</tr>
<tr>
<th>Last updated:</th>
<td>{{ object.updated }}</p>
</tr>
</tbody>
</table>
<h3>Related tokens</h3>
<table class="table table-striped{% if not nodatatable %} datatable{% endif %}">
<thead>
<tr>
<th>Token</th>
<th>Camp</th>
<th>Hint</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for token in object.token_set.all %}
<tr>
<td><a href="{% url 'backoffice:token_detail' camp_slug=token.camp.slug pk=token.pk %}">{{ token.token }}</a></td>
<td>{{ token.camp }}</td>
<td>{{ token.hint }}</td>
<td>{{ token.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
21 changes: 21 additions & 0 deletions src/backoffice/templates/token_category_form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% extends 'base.html' %}
{% load django_bootstrap5 %}
{% load static %}

{% block content %}
<div class="card">
<div class="card-header">
<h3 class="card-title">{% if form.instance.pk %}Update{% else %}Create new{% endif %} Token Category</h3>
</div>
<div class="card-body">
<form method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" class="btn btn-success"><i class="fas fa-check"></i> Save</button>
<button type="submit" class="btn btn-success" name="_addanother"><i class="fas fa-check"></i> Save and add another</button>
<button type="submit" class="btn btn-success" name="_addtoken"><i class="fas fa-check"></i> Save and add token</button>
<a href="{% url 'backoffice:token_category_list' camp_slug=camp.slug %}" class="btn btn-secondary"><i class="fas fa-undo"></i> Cancel</a>
</form>
</div>
</div>
{% endblock content %}
53 changes: 53 additions & 0 deletions src/backoffice/templates/token_category_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{% extends 'base.html' %}
{% load bornhack %}

{% block title %}
Token Category List | Backoffice | {{ block.super }}
{% endblock %}

{% block content %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Token Category List - BackOffice</h3>
</div>
<div class="card-body">
<p>This is a list of all token categories.</p>
{% if not object_list %}
<p class="lead">No categories found.</p>
{% else %}
<p>
<a class="btn btn-success" href="{% url 'backoffice:token_category_create' camp_slug=camp.slug %}"><i class="fas fa-plus"></i> Create category</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
<table class="table table-striped{% if not nodatatable %} datatable{% endif %}">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th class="text-start">Used by</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for category in object_list %}
<tr>
<td><a href="{% url 'backoffice:token_category_detail' camp_slug=camp.slug pk=category.pk %}">{{ category.name }}</a></td>
<td>{{ category.description }}</td>
<td class="text-start">{{ category.token_set.count }}</td>
<td>
<a href="{% url 'backoffice:token_create' camp_slug=camp.slug %}" class="me-1"><i class="fas fa-add text-success"></i></a>
<a href="{% url 'backoffice:token_category_detail' camp_slug=camp.slug pk=category.pk %}" class="me-1"><i class="fas fa-search text-info"></i></a>
<a href="{% url 'backoffice:token_category_update' camp_slug=camp.slug pk=category.pk %}" class="me-1"><i class="fas fa-edit"></i></a>
<a href="{% url 'backoffice:token_category_delete' camp_slug=camp.slug pk=category.pk %}" class="me-1"><i class="fas fa-trash text-danger"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
<p>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
</p>
</div>
</div>
{% endblock content %}
30 changes: 22 additions & 8 deletions src/backoffice/templates/token_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,49 @@ <h3 class="card-title">Token Details | Tokens | BackOffice</h3>
<table class="table">
<tbody>
<tr>
<th>Token</th>
<td>{{ token.tokene }}</td>
<th>Token:</th>
<td>{{ token.token }}</td>
</tr>
<tr>
<th>Category</th>
<td>{{ token.category }}</p>
<th>Category:</th>
<td><a href="{% url 'backoffice:token_category_detail' camp_slug=camp.slug pk=token.category.pk %}">{{ token.category.name }}</a></p>
</tr>
<tr>
<th>Description</th>
<th>Hint:</th>
<td>{{ token.hint }}</p>
</tr>
<tr>
<th>Description:</th>
<td>{{ token.description }}</p>
</tr>
<tr>
<th>Finds</th>
<th>Finds:</th>
<td>{{ token.tokenfind_set.count }} times</p>
</tr>
<tr>
<th>Created:</th>
<td>{{ token.created }}</p>
</tr>
<tr>
<th>Last updated:</th>
<td>{{ token.updated }}</p>
</tr>
</tbody>
</table>
<h3>Token Finds</h3>
<table class="table table-striped{% if not nodatatable %} datatable{% endif %}">
<thead>
<tr>
<th>Email</th>
<th>Public credit name</th>
<th>Username</th>
<th>Timestamp</th>
</tr>
</thead>
<tbody>
{% for tf in token.tokenfind_set.all %}
<tr>
<td>{{ tf.user.email }}</td>
<td>{{ tf.user.profile.public_credit_name }}</td>
<td>{{ tf.user.username }}</td>
<td>{{ tf.created }}</td>
</tr>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion src/backoffice/templates/token_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3 class="card-title">{% if request.resolver_match.url_name == "token_update" %
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" class="btn btn-success"><i class="fas fa-check"></i> Save</button>
<a href="{% url 'backoffice:pos_list' camp_slug=camp.slug %}" class="btn btn-secondary"><i class="fas fa-undo"></i> Cancel</a>
<a href="{% url 'backoffice:token_list' camp_slug=camp.slug %}" class="btn btn-secondary"><i class="fas fa-undo"></i> Cancel</a>
</form>
</div>
</div>
Expand Down
34 changes: 23 additions & 11 deletions src/backoffice/templates/token_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
<p class="lead">No tokens found.</p>
{% else %}
<p>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Backoffice</a>
<a class="btn btn-success" href="{% url 'backoffice:token_create' camp_slug=camp.slug %}"><i class="fas fa-plus"></i> Create Token</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
<table class="table table-striped{% if not nodatatable %} datatable{% endif %}">
<thead>
<tr>
<th>Category</th>
<th>Token</th>
<th>Active</th>
<th>Category</th>
<th>Time Limits</th>
<th>Hint</th>
<th>Description</th>
<th>Finds</th>
<th>Actions</th>
Expand All @@ -29,6 +32,7 @@
<tbody>
{% for token in token_list %}
<tr>
<td><a href="{% url 'backoffice:token_category_detail' camp_slug=camp.slug pk=token.category.pk %}">{{ token.category.name }}</a></td>
<td><a href="{% url 'backoffice:token_detail' camp_slug=camp.slug pk=token.pk %}">{{ token.token }}</a></td>
<td>
{% if token.active %}
Expand All @@ -42,25 +46,33 @@
</span>
{% endif %}
</td>
<td>{{ token.category }}</td>
<td>
{% if token.valid_when.lower %}
From {{ token.valid_when.lower }}<br>
{% endif %}
{% if token.valid_when.upper %}
To {{ token.valid_when.upper }}
{% endif %}
{% if not token.valid_when %}
-
{% endif %}
</td>
<td>{{ token.hint }}</td>
<td>{{ token.description }}</td>
<td>{{ token.tokenfind_set.count }}</td>
<td>
<div class="btn-group-vertical">
<a href="{% url 'backoffice:token_detail' camp_slug=camp.slug pk=token.pk %}" class="btn btn-primary"><i class="fas fa-search"></i> Details</a>
<a href="{% url 'backoffice:token_update' camp_slug=camp.slug pk=token.pk %}" class="btn btn-primary"><i class="fas fa-edit"></i> Update</a>
<a href="{% url 'backoffice:token_delete' camp_slug=camp.slug pk=token.pk %}" class="btn btn-danger"><i class="fas fa-times"></i> Delete</a>
</div>
</td>
<a href="{% url 'backoffice:token_detail' camp_slug=camp.slug pk=token.pk %}"><i class="fas fa-search text-info"></i></a>
<a href="{% url 'backoffice:token_update' camp_slug=camp.slug pk=token.pk %}"><i class="fas fa-edit"></i></a>
<a href="{% url 'backoffice:token_delete' camp_slug=camp.slug pk=token.pk %}"<i class="fas fa-trash text-danger"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</p>
{% endif %}
<p>
<a class="btn btn-success" href="{% url 'backoffice:token_create' camp_slug=camp.slug %}"><i class="fas fa-plus"></i> Create Token</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Backoffice</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
</p>
</div>
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/backoffice/templates/token_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
<div class="card-body">
<p>A list of users and the number of tokens they found</p>
<p>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Backoffice</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
<table class="table table-striped{% if not nodatatable %} datatable{% endif %}">
<thead>
<tr>
<th>Name</th>
<th>Public credit name</th>
<th>Username</th>
<th>Finds</th>
<th>Last token found</th>
</tr>
</thead>
<tbody>
{% for user in user_list %}
<tr>
<td>{{ user.profile.public_credit_name|default:user.username }}</td>
<td>{{ user.profile.public_credit_name }}</td>
<td>{{ user.username }}</td>
<td>{{ user.token_find_count }}</td>
<td>{{ user.last_token_find }}</td>
</tr>
Expand All @@ -32,7 +34,7 @@
</table>
</p>
<p>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}"><i class="fas fa-undo"></i> Backoffice</a>
<a class="btn btn-secondary" href="{% url 'backoffice:index' camp_slug=camp.slug %}#game"><i class="fas fa-undo"></i> Backoffice</a>
</p>
</div>
</div>
Expand Down
Loading
Loading