Skip to content
Snippets Groups Projects
Commit 62fa1f25 authored by Alexander Pace's avatar Alexander Pace
Browse files

Adding confirmation for making superevent public.

Adding a javascript 'confirm' dialog box that comes up before
exposing/hiding superevents from the public.
parent 8f527f91
No related branches found
No related tags found
1 merge request!29Python3
Pipeline #88347 failed
......@@ -178,18 +178,23 @@ class ExposeHideMixin(ContextMixin):
# Object is hidden and user can expose
can_modify_permissions = True
button_text = 'Make this superevent publicly visible'
confirmation_text = 'Warning: You are attempting to make this \
event publicly visible. Continue?'
action = 'expose'
elif (self.request.user.has_perm(self.hide_perm_name) and
self.object.is_exposed):
# Object is visible and user can hide
can_modify_permissions = True
button_text = 'Make this superevent internal-only'
confirmation_text = 'Warning: You are attempting to make this \
event internal only. Continue?'
action = 'hide'
# Update context
context['can_modify_permissions'] = can_modify_permissions
if can_modify_permissions:
context['permissions_form_button_text'] = button_text
context['confirmation_dialog_text'] = confirmation_text
context['permissions_action'] = action
return context
......
......@@ -35,6 +35,12 @@
{% include "superevents/superevent_detail_script.js" %}
</script>
<script>
function clickConfirm() {
return confirm(" {{confirmation_dialog_text}} ");
}
</script>
{% endblock %}
{% block content %}
......@@ -68,9 +74,11 @@
{#-- XXX This next bit is super hacky. #}
{% if can_modify_permissions %}
<div class="content-area">
<form action="{% url "legacy_apiweb:default:superevents:superevent-permission-modify" superevent.superevent_id %}" method="POST" id="permissions_form">
<form action="{% url "legacy_apiweb:default:superevents:superevent-permission-modify" superevent.superevent_id %}"
method="POST"
id="permissions_form">
<input type="hidden" name="action" value="{{ permissions_action }}">
<input type="submit" value="{{ permissions_form_button_text }}" class="permButtonClass" disabled>
<input type="submit" value="{{ permissions_form_button_text }}" class="permButtonClass" id="permissions_submit_link" onclick="return clickConfirm()">
</form>
</div>
{% endif %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment