Skip to content

Commit 1b95c01

Browse files
chore: fixed featured sessions and 500 errors on sessions and reviews (#1331)
* fixed featured sessions and 500 errors on sessions and reviews * implemented suggestions --------- Co-authored-by: Mario Behling <mb@mariobehling.de>
1 parent 11ab1d9 commit 1b95c01

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

app/eventyay/base/models/event.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
from .organizer import Organizer, OrganizerBillingModel, Team
7272

7373
TALK_HOSTNAME = settings.TALK_HOSTNAME
74-
LANGUAGE_NAMES = {code: name for code, name in settings.LANGUAGES}
7574

7675
def event_css_path(instance, filename):
7776
return path_with_hash(filename, base_path=f"{instance.slug}/css/")
@@ -2149,15 +2148,16 @@ def available_content_locales(self) -> list:
21492148
# Content locales can be anything eventyay knows as a language, merged with
21502149
# this event's plugin locales.
21512150

2152-
locale_names = dict(default_django_settings.LANGUAGES)
2151+
locale_names = dict(settings.LANGUAGES)
21532152
locale_names.update(self.named_plugin_locales)
21542153
return sorted([(key, value) for key, value in locale_names.items()])
21552154

21562155
@cached_property
21572156
def named_content_locales(self) -> list:
21582157
locale_names = dict(self.available_content_locales)
21592158
# locale_names['en-us'] = locale_names['en']
2160-
return [(code, locale_names[code]) for code in self.content_locales]
2159+
locale_names |= LANGUAGE_NAMES
2160+
return [(code, locale_names.get(code, code)) for code in self.content_locales]
21612161

21622162
@cached_property
21632163
def named_plugin_locales(self) -> list:

app/eventyay/orga/templates/orga/submission/list.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ <h2 class="d-flex align-items-center">
9494
<a href="{% querystring sort="-state" %}"><i class="fa fa-caret-up" title="{% translate "Sort (z-a)" %}"></i></a>
9595
</th>
9696
{% if can_change_submission %}
97-
<th>
97+
<th class="text-center">
9898
{% translate "Featured" %} <i class="fa fa-question-circle" data-toggle="tooltip" title="{% translate "Show this session on the list of featured sessions, once it was accepted" %}"></i>
9999
<a href="{% querystring sort="-is_featured" %}"><i class="fa fa-caret-down"></i></a>
100100
<a href="{% querystring sort="is_featured" %}"><i class="fa fa-caret-up"></i></a>
@@ -149,12 +149,13 @@ <h2 class="d-flex align-items-center">
149149

150150
</td>
151151
{% if can_change_submission %}
152-
<td class="submission_featured">
153-
<div class="mt-1 form-check" title="{% translate "Show this proposal in the list of featured sessions." %}">
152+
<td class="submission_featured text-center">
153+
<div class="form-check d-inline-block" title="{% translate "Show this proposal in the list of featured sessions." %}">
154154
<input
155155
type="checkbox"
156156
id="featured_{{ submission.code }}"
157157
data-id="{{ submission.code }}"
158+
data-url="{{ submission.orga_urls.toggle_featured }}"
158159
class="submission_featured"
159160
{% if submission.is_featured %}checked{% endif %}
160161
>

app/eventyay/static/orga/css/_layout.css

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,22 @@ body {
5656
}
5757
}
5858

59-
.submission_featured {
59+
td.submission_featured {
6060
position: relative;
61+
vertical-align: middle !important;
6162
text-align: center;
6263

64+
.form-check {
65+
display: inline-flex;
66+
align-items: center;
67+
margin: 0;
68+
}
69+
6370
i {
6471
position: absolute;
6572
right: 30%;
66-
top: 12px;
67-
}
68-
69-
input[type="checkbox"] {
70-
margin-right: 16px;
73+
top: 50%;
74+
transform: translateY(-50%);
7175
}
7276

7377
.done {

app/eventyay/static/orga/js/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ const handleFeaturedChange = (element) => {
1818
const statusWrapper = element.parentElement.parentElement
1919
setStatus("working")
2020

21-
const url = window.location.pathname + id + "/toggle_featured"
21+
// Use the URL from the data-url attribute if available, otherwise construct it
22+
const url = element.dataset.url || (window.location.pathname + (window.location.pathname.endsWith('/') ? '' : '/') + id + "/toggle_featured")
2223
const options = {
2324
method: "POST",
2425
headers: {
2526
"Content-Type": "application/json",
26-
"X-CSRFToken": getCookie("pretalx_csrftoken"),
27+
"X-CSRFToken": getCookie("eventyay_csrftoken"),
2728
},
2829
credentials: "include",
2930
}

0 commit comments

Comments
 (0)