Skip to content

Commit

Permalink
Link access code create in restricted track view
Browse files Browse the repository at this point in the history
closes #820
  • Loading branch information
rixx committed Feb 12, 2024
1 parent 62aeaac commit bf9864c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Release Notes
=============

- :feature:`orga,820` Restricted tracks now link to the page where you can create access codes for that track.
- :announcement`admin,1678` Due to its incomplete and complex nature, the ``import_schedule`` admin command has been removed. If you want to import a schedule, despite all the complexities, please use the pretalx-downstream plugin instead.
- :feature:`orga,1672` The organiser area now has a search box located in the side bar, opened after clicking the event name. It searches all events the current user has full access to (that is, not a limited reviewer account) for events, sessions and speakers.
- :feature:`orga:review,1633` Resources uploaded or linked by speakers are now shown in the review view (unless anonymous reviews are used, as resources can currently not be anonymised).
Expand Down
5 changes: 5 additions & 0 deletions src/pretalx/orga/forms/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ def __init__(self, *args, event=None, **kwargs):
self.event = event
super().__init__(*args, **kwargs)
self.fields["color"].widget.attrs["class"] = "colorpickerfield"
if self.instance.pk:
url = f"{event.cfp.urls.new_access_code}?track={self.instance.pk}"
self.fields["requires_access_code"].help_text += " " + _(
'You can create an access code <a href="{url}">here</a>.'
).format(url=url)

def clean_name(self):
name = self.cleaned_data["name"]
Expand Down
6 changes: 3 additions & 3 deletions src/pretalx/orga/templates/orga/cfp/track_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ <h2>{% translate "Tracks" %}</h2>
{% for track in tracks %}
<tr>
<td>
{% if track.requires_access_code %}
<i class="fa fa-lock" title="{% translate "Requires access code" %}"></i>
{% endif %}
<a href="{{ track.urls.edit }}">
{{ track.name }}
</a>
{% if track.requires_access_code %}
<i class="fa fa-lock ml-1" title="{% translate "Requires access code" %}"></i>
{% endif %}
</td>
<td><div class="color-square" style="background: {{ track.color }}"></div></td>
<td class="numeric">
Expand Down
6 changes: 6 additions & 0 deletions src/pretalx/orga/views/cfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,12 @@ def get_object(self):
def get_form_kwargs(self):
result = super().get_form_kwargs()
result["event"] = self.request.event
if result.get("instance"):
return result
if track := self.request.GET.get("track"):
track = self.request.event.tracks.filter(pk=track).first()
if track:
result["initial"]["track"] = track
return result

def get_permission_object(self):
Expand Down

0 comments on commit bf9864c

Please sign in to comment.