Fix issues with POST/GET arguments and the modal
This commit is contained in:
parent
e7b7695efd
commit
8b7dffa1b4
|
@ -13,7 +13,10 @@
|
||||||
"channel": "{{ params.channel|escapejs }}",
|
"channel": "{{ params.channel|escapejs }}",
|
||||||
"time": "{{ params.time|escapejs }}",
|
"time": "{{ params.time|escapejs }}",
|
||||||
"date": "{{ params.date|escapejs }}",
|
"date": "{{ params.date|escapejs }}",
|
||||||
"index": "{{ params.index }}"}'
|
"index": "{{ params.index }}",
|
||||||
|
"type": "{{ params.type|escapejs }}",
|
||||||
|
"mtype": "{{ params.mtype|escapejs }}",
|
||||||
|
"nick": "{{ params.nick|escapejs }}",}'
|
||||||
hx-target="#modals-here"
|
hx-target="#modals-here"
|
||||||
hx-trigger="load">
|
hx-trigger="load">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
{% load django_tables2_bulma_template %}
|
{% load django_tables2_bulma_template %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load joinsep %}
|
{% load joinsep %}
|
||||||
|
{% load urlsafe %}
|
||||||
{% block table-wrapper %}
|
{% block table-wrapper %}
|
||||||
<div id="drilldown-table" class="container box column-shifter-container" style="position:relative; z-index:1;">
|
<div id="drilldown-table" class="container box column-shifter-container" style="position:relative; z-index:1;">
|
||||||
{% block table %}
|
{% block table %}
|
||||||
|
@ -233,7 +234,8 @@
|
||||||
"mtype": "{{ row.cells.mtype }}",
|
"mtype": "{{ row.cells.mtype }}",
|
||||||
"nick": "{{ row.cells.nick|escapejs }}"}'
|
"nick": "{{ row.cells.nick|escapejs }}"}'
|
||||||
hx-target="#modals-here"
|
hx-target="#modals-here"
|
||||||
hx-trigger="click">
|
hx-trigger="click"
|
||||||
|
href="/?modal=context&net={{row.cells.net|escapejs}}&num={{row.cells.num|escapejs}}&src={{row.cells.src|escapejs}}&channel={{row.cells.channel|urlsafe}}&time={{row.cells.time|escapejs}}&date={{row.cells.date|escapejs}}&index={{params.index}}&type={{row.cells.type}}&mtype={{row.cells.mtype}}&nick={{row.cells.mtype|escapejs}}">
|
||||||
{{ row.cells.msg }}
|
{{ row.cells.msg }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import urllib.parse
|
||||||
|
from django import template
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def urlsafe(h):
|
||||||
|
return urllib.parse.quote(h, safe="")
|
|
@ -438,12 +438,15 @@ class ThresholdIRCActionsRegistration(SuperUserRequiredMixin, APIView):
|
||||||
if not updated["success"]:
|
if not updated["success"]:
|
||||||
message = updated["reason"]
|
message = updated["reason"]
|
||||||
message_class = "danger"
|
message_class = "danger"
|
||||||
|
unreg = threshold.irc_get_unreg(net)
|
||||||
context = {
|
context = {
|
||||||
"net": net,
|
"unreg": unreg,
|
||||||
"message": message,
|
"message": message,
|
||||||
"class": message_class,
|
"class": message_class,
|
||||||
}
|
}
|
||||||
|
if net:
|
||||||
|
if net != "None":
|
||||||
|
context["net"] = net
|
||||||
return render(request, template_name, context)
|
return render(request, template_name, context)
|
||||||
|
|
||||||
|
|
||||||
|
@ -463,12 +466,18 @@ class ThresholdIRCActionsRegistrationAuth(SuperUserRequiredMixin, APIView):
|
||||||
if not updated["success"]:
|
if not updated["success"]:
|
||||||
message = updated["reason"]
|
message = updated["reason"]
|
||||||
message_class = "danger"
|
message_class = "danger"
|
||||||
|
if "net" in request.data:
|
||||||
|
net = request.data["net"]
|
||||||
|
else:
|
||||||
|
net = None
|
||||||
|
unreg = threshold.irc_get_unreg(net)
|
||||||
context = {
|
context = {
|
||||||
|
"unreg": unreg,
|
||||||
"message": message,
|
"message": message,
|
||||||
"class": message_class,
|
"class": message_class,
|
||||||
}
|
}
|
||||||
if "net" in request.data:
|
if "net" in request.data:
|
||||||
|
if request.data["net"] != "None":
|
||||||
context["net"] = request.data["net"]
|
context["net"] = request.data["net"]
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,13 @@ def drilldown_search(request, return_context=False, template=None):
|
||||||
context = {"sizes": sizes}
|
context = {"sizes": sizes}
|
||||||
return render(request, template_name, context)
|
return render(request, template_name, context)
|
||||||
|
|
||||||
|
tmp_post = request.POST.dict()
|
||||||
|
tmp_get = request.GET.dict()
|
||||||
|
tmp_post = {k: v for k, v in tmp_post.items() if v and not v == "None"}
|
||||||
|
tmp_get = {k: v for k, v in tmp_get.items() if v and not v == "None"}
|
||||||
|
query_params.update(tmp_post)
|
||||||
|
query_params.update(tmp_get)
|
||||||
|
|
||||||
if "index" in query_params:
|
if "index" in query_params:
|
||||||
if not request.user.is_superuser:
|
if not request.user.is_superuser:
|
||||||
message = "You can't use the index parameter"
|
message = "You can't use the index parameter"
|
||||||
|
|
Loading…
Reference in New Issue