Fix callback windows
This commit is contained in:
parent
cfeb570bf8
commit
7779cb8d0e
|
@ -25,7 +25,7 @@
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
hx-get="{% url 'hook_action' type=type hook_id=item.hook.id %}"
|
hx-get="{% url 'hook_action' type=type hook_id=item.hook.id %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#modals-here">{{ item.hook.name }}
|
hx-target="#{{ type }}s-here">{{ item.hook.name }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.title }}</td>
|
<td>{{ item.title }}</td>
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
hx-get="{% url 'callbacks' type='window' %}"
|
hx-get="{% url 'callbacks' type='window' %}"
|
||||||
hx-trigger="click"
|
hx-trigger="click"
|
||||||
hx-target="#items-here"
|
hx-target="#windows-here"
|
||||||
hx-swap="afterend"
|
hx-swap="afterend"
|
||||||
class="button is-info">
|
class="button is-info">
|
||||||
<span class="icon-text">
|
<span class="icon-text">
|
||||||
|
|
|
@ -41,6 +41,8 @@ class Callbacks(LoginRequiredMixin, View):
|
||||||
callbacks = get_callbacks(hook)
|
callbacks = get_callbacks(hook)
|
||||||
else:
|
else:
|
||||||
callbacks = get_callbacks(user=request.user)
|
callbacks = get_callbacks(user=request.user)
|
||||||
|
if type == "page":
|
||||||
|
type = "modal"
|
||||||
|
|
||||||
context = {
|
context = {
|
||||||
"title": f"Callbacks ({type})",
|
"title": f"Callbacks ({type})",
|
||||||
|
|
|
@ -127,6 +127,8 @@ class HookAction(LoginRequiredMixin, APIView):
|
||||||
return render(request, template_name, context)
|
return render(request, template_name, context)
|
||||||
else:
|
else:
|
||||||
form = HookForm()
|
form = HookForm()
|
||||||
|
if type == "page":
|
||||||
|
type = "modal"
|
||||||
context = {
|
context = {
|
||||||
"form": form,
|
"form": form,
|
||||||
"hook_id": hook_id,
|
"hook_id": hook_id,
|
||||||
|
@ -142,6 +144,8 @@ class HookAction(LoginRequiredMixin, APIView):
|
||||||
Add or edit a hook.
|
Add or edit a hook.
|
||||||
:param hook_id: The id of the hook to edit. Optional.
|
:param hook_id: The id of the hook to edit. Optional.
|
||||||
"""
|
"""
|
||||||
|
if type not in self.allowed_types:
|
||||||
|
return HttpResponseBadRequest
|
||||||
message = None
|
message = None
|
||||||
message_class = "success"
|
message_class = "success"
|
||||||
|
|
||||||
|
@ -187,6 +191,8 @@ class HookAction(LoginRequiredMixin, APIView):
|
||||||
Delete a hook.
|
Delete a hook.
|
||||||
:param hook_id: The id of the hook to delete.
|
:param hook_id: The id of the hook to delete.
|
||||||
"""
|
"""
|
||||||
|
if type not in self.allowed_types:
|
||||||
|
return HttpResponseBadRequest
|
||||||
message = None
|
message = None
|
||||||
message_class = "success"
|
message_class = "success"
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue