forked from CGM_Public/pretix_original
Improve organizer page and tabs
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% for title, content in tabs %}
|
{% for title, content in tabs %}
|
||||||
<li>
|
<li>
|
||||||
<a href="#tab-{{ forloop.index }}" data-toggle="tab">
|
<a href="#tab-{{ forloop.counter }}" data-toggle="tab">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -149,7 +149,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for title, content in tabs %}
|
{% for title, content in tabs %}
|
||||||
<div class="tab-pane" id="tab-{{ forloop.index }}">
|
<div class="tab-pane" id="tab-{{ forloop.counter }}">
|
||||||
<div class="tab-inner">
|
<div class="tab-inner">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -61,14 +61,26 @@ class OrganizerDetail(OrganizerPermissionRequiredMixin, DetailView):
|
|||||||
form=OrganizerPermissionForm,
|
form=OrganizerPermissionForm,
|
||||||
can_delete=True, can_order=False, extra=0
|
can_delete=True, can_order=False, extra=0
|
||||||
)
|
)
|
||||||
return fs(data=self.request.POST if self.request.method == "POST" else None,
|
return fs(
|
||||||
prefix="formset",
|
data=(
|
||||||
queryset=OrganizerPermission.objects.filter(organizer=self.request.organizer))
|
self.request.POST
|
||||||
|
if self.request.method == "POST" and 'id_formset-TOTAL_FORMS' in self.request.POST
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
prefix="formset",
|
||||||
|
queryset=OrganizerPermission.objects.filter(organizer=self.request.organizer)
|
||||||
|
)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def add_form(self):
|
def add_form(self):
|
||||||
return OrganizerPermissionCreateForm(data=self.request.POST if self.request.method == "POST" else None,
|
return OrganizerPermissionCreateForm(
|
||||||
prefix="add")
|
data=(
|
||||||
|
self.request.POST
|
||||||
|
if self.request.method == "POST" and 'id_formset-TOTAL_FORMS' in self.request.POST
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
prefix="add"
|
||||||
|
)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
ctx = super().get_context_data(**kwargs)
|
ctx = super().get_context_data(**kwargs)
|
||||||
@@ -107,6 +119,9 @@ class OrganizerDetail(OrganizerPermissionRequiredMixin, DetailView):
|
|||||||
if not self.request.orgaperm.can_change_permissions:
|
if not self.request.orgaperm.can_change_permissions:
|
||||||
raise PermissionDenied(_("You have no permission to do this."))
|
raise PermissionDenied(_("You have no permission to do this."))
|
||||||
|
|
||||||
|
if 'id_formset-TOTAL_FORMS' not in self.request.POST:
|
||||||
|
return self.get(*args, **kwargs)
|
||||||
|
|
||||||
if self.formset.is_valid() and self.add_form.is_valid():
|
if self.formset.is_valid() and self.add_form.is_valid():
|
||||||
if self.add_form.has_changed():
|
if self.add_form.has_changed():
|
||||||
logdata = {
|
logdata = {
|
||||||
|
|||||||
@@ -84,7 +84,15 @@ $(function () {
|
|||||||
|
|
||||||
$('.collapsible').collapse();
|
$('.collapsible').collapse();
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
|
|
||||||
|
var url = document.location.toString();
|
||||||
|
if (url.match('#')) {
|
||||||
|
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
|
||||||
|
}
|
||||||
|
$('a[data-toggle="tab"]').on('click', function (e) {
|
||||||
|
window.location.hash = e.target.hash;
|
||||||
|
});
|
||||||
|
|
||||||
// Question editor
|
// Question editor
|
||||||
if ($("#answer-options").length) {
|
if ($("#answer-options").length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user