diff --git a/core/templates/window-content/callbacks.html b/core/templates/window-content/callbacks.html
index 6b0fda8..6b5c477 100644
--- a/core/templates/window-content/callbacks.html
+++ b/core/templates/window-content/callbacks.html
@@ -25,7 +25,7 @@
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'hook_action' type=type hook_id=item.hook.id %}"
hx-trigger="click"
- hx-target="#modals-here">{{ item.hook.name }}
+ hx-target="#{{ type }}s-here">{{ item.hook.name }}
{{ item.title }} |
diff --git a/core/templates/window-content/main.html b/core/templates/window-content/main.html
index c1930de..51db51a 100644
--- a/core/templates/window-content/main.html
+++ b/core/templates/window-content/main.html
@@ -79,7 +79,7 @@
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-get="{% url 'callbacks' type='window' %}"
hx-trigger="click"
- hx-target="#items-here"
+ hx-target="#windows-here"
hx-swap="afterend"
class="button is-info">
diff --git a/core/views/callbacks.py b/core/views/callbacks.py
index baa0bd2..7cc5b6e 100644
--- a/core/views/callbacks.py
+++ b/core/views/callbacks.py
@@ -41,6 +41,8 @@ class Callbacks(LoginRequiredMixin, View):
callbacks = get_callbacks(hook)
else:
callbacks = get_callbacks(user=request.user)
+ if type == "page":
+ type = "modal"
context = {
"title": f"Callbacks ({type})",
diff --git a/core/views/hooks.py b/core/views/hooks.py
index a86b870..d08d845 100644
--- a/core/views/hooks.py
+++ b/core/views/hooks.py
@@ -127,6 +127,8 @@ class HookAction(LoginRequiredMixin, APIView):
return render(request, template_name, context)
else:
form = HookForm()
+ if type == "page":
+ type = "modal"
context = {
"form": form,
"hook_id": hook_id,
@@ -142,6 +144,8 @@ class HookAction(LoginRequiredMixin, APIView):
Add or edit a hook.
:param hook_id: The id of the hook to edit. Optional.
"""
+ if type not in self.allowed_types:
+ return HttpResponseBadRequest
message = None
message_class = "success"
@@ -187,6 +191,8 @@ class HookAction(LoginRequiredMixin, APIView):
Delete a hook.
:param hook_id: The id of the hook to delete.
"""
+ if type not in self.allowed_types:
+ return HttpResponseBadRequest
message = None
message_class = "success"
try: