Skip to content

Commit 3e378ff

Browse files
committed
Merged master
2 parents 052e606 + c9ce0fd commit 3e378ff

37 files changed

+785
-82
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ staticfiles/
1414

1515
/db/*
1616
!db/.keep
17+
18+
/tmp/

app/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
'friends',
7373
'event',
7474
'event.messages',
75+
'event.meals',
7576
]
7677

7778
MIDDLEWARE = [
@@ -393,6 +394,7 @@
393394
# Content-Security-Policy
394395
CSP_DEFAULT_SRC = ["'self'", "www.w3.org", "data:", "cdn.jsdelivr.net", "cdnjs.cloudflare.com"]
395396
CSP_FRAME_SRC = ['www.google.com']
397+
CSP_WORKER_SRC = ['blob:']
396398
CSP_SCRIPT_SRC = ["'self'", "cdn.jsdelivr.net", "cdnjs.cloudflare.com", "code.jquery.com", "d3js.org",
397399
"www.google.com", "www.gstatic.com", "'unsafe-inline'"]
398400
CSP_STYLE_SRC = ["'self'", "'unsafe-inline'", "cdnjs.cloudflare.com", "cdn.jsdelivr.net"]

app/static/js/scanner.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ function Scanner(videoId, scanFunction=null, extraOpts={}) {
7474
}
7575

7676
Scanner.prototype.start = function () {
77-
console.log(this)
7877
this.scanner.hasFlash().then((response) => {
7978
let flash = $('#toggle-flash')
8079
if (response) flash.show()

app/static/js/toasts.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
let ToastManager = {
2+
add_toast: function (message, type, delay=null) {
3+
let toast = $(
4+
`<div class="toast align-items-center fade show bg-${type}" role="alert" aria-live="assertive" aria-atomic="true">
5+
<div class="d-flex">
6+
<div class="toast-body">${message}</div>
7+
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
8+
</div>
9+
</div>`
10+
)
11+
$('#toasts').append(toast)
12+
if (delay !== null) {
13+
setTimeout(this.clear, delay, toast.get(0));
14+
}
15+
},
16+
success: function (message, delay=null) {
17+
this.add_toast(message, 'success', delay)
18+
},
19+
info: function (message, delay=null) {
20+
this.add_toast(message, 'info', delay)
21+
},
22+
warning: function (message, delay=null) {
23+
this.add_toast(message, 'warning', delay)
24+
},
25+
error: function (message, delay=null) {
26+
this.add_toast(message, 'danger', delay)
27+
},
28+
primary: function (message, delay=null) {
29+
this.add_toast(message, 'primary', delay)
30+
},
31+
secondary: function (message, delay=null) {
32+
this.add_toast(message, 'secondary', delay)
33+
},
34+
clear: function (item) {
35+
bootstrap.Toast.getOrCreateInstance(item).hide()
36+
},
37+
clearAll: function () {
38+
$('#toasts > div').each((_, item) => {
39+
this.clear(item)
40+
})
41+
}
42+
}

app/template.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def get_main_nav(request):
3838
nav.append(('Checkin', reverse('checkin_list')))
3939
if is_installed('event.messages') and request.user.has_perm('event_messages.view_announcement'):
4040
nav.append(('Announcements', reverse('announcement_list')))
41+
if is_installed('event.meals') and request.user.has_perm('meals.can_checkin_meals'):
42+
nav.append(('Meals', reverse('meals_list')))
4143
if request.user.is_organizer():
4244
nav.extend([('Stats', reverse('stats_home'))])
4345
return nav

app/templates/components/bootstrap5_form.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
field.fadeIn()
207207
} else {
208208
field.fadeOut()
209+
field.find('input,textarea,select').val('')
209210
}
210211
})
211212
if (!{{ values|safe }}.includes(objectifyForm(form)['{{ cond_field_name }}'])) {

app/templates/components/imports.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@
3535

3636
<!-- Our WebPage style -->
3737
<link href="{% static 'css/main.css' %}" rel="stylesheet">
38+
39+
<!-- ToastManager -->
40+
<script src="{% static 'js/toasts.js' %}"></script>

app/templates/components/toast.html

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
{% if messages %}
2-
<div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
3-
{% for message in messages %}
4-
<div class="toast align-items-center show bg-{{ message.tags }}" role="alert" aria-live="assertive" aria-atomic="true">
5-
<div class="d-flex">
6-
<div class="toast-body">{{ message|capfirst }}</div>
7-
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
8-
</div>
1+
<div id="toasts" class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
2+
{% for message in messages %}
3+
<div class="toast align-items-center fade show bg-{{ message.tags }}" role="alert" aria-live="assertive" aria-atomic="true">
4+
<div class="d-flex">
5+
<div class="toast-body">{{ message|capfirst }}</div>
6+
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
97
</div>
10-
{% endfor %}
11-
</div>
12-
{% endif %}
8+
</div>
9+
{% endfor %}
10+
</div>

application/forms/mentor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MentorForm(ApplicationForm):
3232
study_work = forms.TypedChoiceField(
3333
required=True,
3434
label='Are you studying or working?',
35-
choices=(('Study', _('Study')), ('Study', _('Work'))),
35+
choices=(('Study', _('Study')), ('Work', _('Work'))),
3636
widget=forms.RadioSelect(attrs={'class': 'inline'})
3737
)
3838

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Generated by Django 4.0.8 on 2022-12-29 12:07
2+
3+
from django.conf import settings
4+
from django.db import migrations, models
5+
import django.db.models.deletion
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12+
('application', '0029_applicationtypeconfig_spots'),
13+
]
14+
15+
operations = [
16+
migrations.CreateModel(
17+
name='DraftApplication',
18+
fields=[
19+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20+
('data', models.TextField(blank=True)),
21+
('user', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.AUTH_USER_MODEL)),
22+
],
23+
),
24+
]

0 commit comments

Comments
 (0)