Make all WM elements inherit from common templates
This commit is contained in:
parent
553d4fd33f
commit
0ccde2af1b
|
@ -1,121 +1,121 @@
|
||||||
|
{% extends 'wm/modal.html' %}
|
||||||
|
|
||||||
{% load index %}
|
{% load index %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<script src="{% static 'modal.js' %}"></script>
|
{% block scripts %}
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("restore-modal-scroll", function(event) {
|
document.addEventListener("restore-modal-scroll", function(event) {
|
||||||
var modalContent = document.getElementsByClassName("modal-content")[0];
|
var modalContent = document.getElementsByClassName("modal-content")[0];
|
||||||
var maxScroll = modalContent.scrollHeight - modalContent.offsetHeight;
|
var maxScroll = modalContent.scrollHeight - modalContent.offsetHeight;
|
||||||
var scrollpos = localStorage.getItem('scrollpos_modal_content');
|
var scrollpos = localStorage.getItem('scrollpos_modal_content');
|
||||||
if (scrollpos == 'BOTTOM') {
|
if (scrollpos == 'BOTTOM') {
|
||||||
modalContent.scrollTop = maxScroll;
|
modalContent.scrollTop = maxScroll;
|
||||||
} else if (scrollpos) {
|
} else if (scrollpos) {
|
||||||
modalContent.scrollTop = scrollpos;
|
modalContent.scrollTop = scrollpos;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener("htmx:beforeSwap", function(event) {
|
document.addEventListener("htmx:beforeSwap", function(event) {
|
||||||
var modalContent = document.getElementsByClassName("modal-content")[0];
|
var modalContent = document.getElementsByClassName("modal-content")[0];
|
||||||
var scrollpos = modalContent.scrollTop;
|
var scrollpos = modalContent.scrollTop;
|
||||||
if(modalContent.scrollTop === (modalContent.scrollHeight - modalContent.offsetHeight)) {
|
if(modalContent.scrollTop === (modalContent.scrollHeight - modalContent.offsetHeight)) {
|
||||||
localStorage.setItem('scrollpos_modal_content', 'BOTTOM');
|
localStorage.setItem('scrollpos_modal_content', 'BOTTOM');
|
||||||
} else {
|
} else {
|
||||||
localStorage.setItem('scrollpos_modal_content', scrollpos);
|
localStorage.setItem('scrollpos_modal_content', scrollpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
<style>
|
||||||
|
#tab-content-{{ unique }} div {
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
#tab-content-{{ unique }} div.is-active {
|
||||||
</script>
|
display: block;
|
||||||
<style>
|
}
|
||||||
#tab-content-{{ unique }} div {
|
</style>
|
||||||
display: none;
|
{% endblock %}
|
||||||
}
|
|
||||||
|
|
||||||
#tab-content-{{ unique }} div.is-active {
|
{% block modal_content %}
|
||||||
display: block;
|
{% include 'partials/notify.html' %}
|
||||||
}
|
<div class="tabs is-toggle is-fullwidth is-info" id="tabs-{{ unique }}">
|
||||||
</style>
|
<ul>
|
||||||
|
<li class="is-active" data-tab="1">
|
||||||
<div id="modal" class="modal is-active is-clipped">
|
<a>
|
||||||
<div class="modal-background"></div>
|
<span class="icon is-small"><i class="fa-solid fa-message-arrow-down"></i></span>
|
||||||
<div class="modal-content">
|
<span>Scrollback</span>
|
||||||
<div class="box">
|
</a>
|
||||||
{% include 'partials/notify.html' %}
|
</li>
|
||||||
<div class="tabs is-toggle is-fullwidth is-info" id="tabs-{{ unique }}">
|
<li data-tab="2">
|
||||||
<ul>
|
<a>
|
||||||
<li class="is-active" data-tab="1">
|
<span class="icon is-small"><i class="fa-solid fa-messages"></i></span>
|
||||||
<a>
|
<span>Context</span>
|
||||||
<span class="icon is-small"><i class="fa-solid fa-message-arrow-down"></i></span>
|
</a>
|
||||||
<span>Scrollback</span>
|
</li>
|
||||||
</a>
|
<li data-tab="3">
|
||||||
</li>
|
<a>
|
||||||
<li data-tab="2">
|
<span class="icon is-small"><i class="fa-solid fa-message"></i></span>
|
||||||
<a>
|
<span>Message</span>
|
||||||
<span class="icon is-small"><i class="fa-solid fa-messages"></i></span>
|
</a>
|
||||||
<span>Context</span>
|
</li>
|
||||||
</a>
|
<li data-tab="4">
|
||||||
</li>
|
<a>
|
||||||
<li data-tab="3">
|
<span class="icon is-small"><i class="fa-solid fa-asterisk"></i></span>
|
||||||
<a>
|
<span>Info</span>
|
||||||
<span class="icon is-small"><i class="fa-solid fa-message"></i></span>
|
</a>
|
||||||
<span>Message</span>
|
</li>
|
||||||
</a>
|
</ul>
|
||||||
</li>
|
|
||||||
<li data-tab="4">
|
|
||||||
<a>
|
|
||||||
<span class="icon is-small"><i class="fa-solid fa-asterisk"></i></span>
|
|
||||||
<span>Info</span>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="tab-content-{{ unique }}">
|
|
||||||
<div class="is-active" data-content="1">
|
|
||||||
<h4 class="subtitle is-4">Scrollback of {{ channel }} on {{ net }}{{ num }}</h4>
|
|
||||||
{% include 'modals/context_table.html' %}
|
|
||||||
{% if user.is_superuser and source == 'irc' %}
|
|
||||||
<form method="PUT">
|
|
||||||
<article class="field has-addons">
|
|
||||||
<article class="control is-expanded has-icons-left">
|
|
||||||
<input id="context-input" name="msg" class="input" type="text" placeholder="Type your message here">
|
|
||||||
<span class="icon is-small is-left">
|
|
||||||
<i class="fas fa-magnifying-glass"></i>
|
|
||||||
</span>
|
|
||||||
</article>
|
|
||||||
<article class="control">
|
|
||||||
<article class="field">
|
|
||||||
<button
|
|
||||||
id="search"
|
|
||||||
class="button is-info is-fullwidth"
|
|
||||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
|
||||||
hx-put="{% url 'threshold_irc_msg' net num %}"
|
|
||||||
hx-vals='{"channel": "{{ channel }}", "nick": "{{ nick }}"}'
|
|
||||||
hx-trigger="click"
|
|
||||||
hx-target="#context-input"
|
|
||||||
hx-swap="outerHTML">
|
|
||||||
Send
|
|
||||||
</button>
|
|
||||||
</article>
|
|
||||||
</article>
|
|
||||||
</article>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div data-content="2">
|
|
||||||
<h4 class="subtitle is-4">Scrollback of {{ channel }} on {{ net }}{{ num }} around {{ ts }}</h4>
|
|
||||||
Context
|
|
||||||
</div>
|
|
||||||
<div data-content="3">
|
|
||||||
<h4 class="subtitle is-4">Message details</h4>
|
|
||||||
Message deetails
|
|
||||||
</div>
|
|
||||||
<div data-content="4">
|
|
||||||
<h4 class="subtitle is-4">Information about {{ channel }} on {{ net }}{{ num }}</h4>
|
|
||||||
info
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>initTabs("{{ unique }}");</script>
|
|
||||||
<button class="modal-close is-large" aria-label="close"></button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="tab-content-{{ unique }}">
|
||||||
|
<div class="is-active" data-content="1">
|
||||||
|
<h4 class="subtitle is-4">Scrollback of {{ channel }} on {{ net }}{{ num }}</h4>
|
||||||
|
{% include 'partials/context_table.html' %}
|
||||||
|
{% if user.is_superuser and source == 'irc' %}
|
||||||
|
<form method="PUT">
|
||||||
|
<article class="field has-addons">
|
||||||
|
<article class="control is-expanded has-icons-left">
|
||||||
|
<input id="context-input" name="msg" class="input" type="text" placeholder="Type your message here">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fas fa-magnifying-glass"></i>
|
||||||
|
</span>
|
||||||
|
</article>
|
||||||
|
<article class="control">
|
||||||
|
<article class="field">
|
||||||
|
<button
|
||||||
|
id="search"
|
||||||
|
class="button is-info is-fullwidth"
|
||||||
|
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||||
|
hx-put="{% url 'threshold_irc_msg' net num %}"
|
||||||
|
hx-vals='{"channel": "{{ channel }}", "nick": "{{ nick }}"}'
|
||||||
|
hx-trigger="click"
|
||||||
|
hx-target="#context-input"
|
||||||
|
hx-swap="outerHTML">
|
||||||
|
Send
|
||||||
|
</button>
|
||||||
|
</article>
|
||||||
|
</article>
|
||||||
|
</article>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div data-content="2">
|
||||||
|
<h4 class="subtitle is-4">Scrollback of {{ channel }} on {{ net }}{{ num }} around {{ ts }}</h4>
|
||||||
|
Context
|
||||||
|
</div>
|
||||||
|
<div data-content="3">
|
||||||
|
<h4 class="subtitle is-4">Message details</h4>
|
||||||
|
Message deetails
|
||||||
|
</div>
|
||||||
|
<div data-content="4">
|
||||||
|
<h4 class="subtitle is-4">Information about {{ channel }} on {{ net }}{{ num }}</h4>
|
||||||
|
info
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>initTabs("{{ unique }}");</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
{% load index %}
|
{% extends 'wm/modal.html' %}
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
<script src="{% static 'modal.js' %}"></script>
|
{% block modal_content %}
|
||||||
<div id="modal" class="modal is-active is-clipped">
|
{% include 'window-content/drilldown.html' %}
|
||||||
<div class="modal-background"></div>
|
{% endblock %}
|
||||||
<div class="modal-content">
|
|
||||||
<div class="box">
|
|
||||||
{% include 'window-content/drilldown.html' %}
|
|
||||||
<button class="modal-close is-large" aria-label="close"></button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,28 +1,19 @@
|
||||||
<div id="drilldown-widget">
|
{% extends 'wm/widget.html' %}
|
||||||
<div id="drilldown-widget-{{ unique }}" class="grid-stack-item" gs-w="5" gs-h="15">
|
|
||||||
<div class="grid-stack-item-content">
|
|
||||||
<div class="panel">
|
|
||||||
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
|
|
||||||
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light ui-move"></i>
|
|
||||||
<i
|
|
||||||
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
|
||||||
onclick='grid.removeWidget("drilldown-widget-{{ unique }}"); grid.compact();'></i>
|
|
||||||
Drilldown
|
|
||||||
</p>
|
|
||||||
<div class="panel-block is-active">
|
|
||||||
<div class="control">
|
|
||||||
{% include 'window-content/drilldown.html' %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
var widget_event = new Event('load-widget');
|
{% block widget_options %}
|
||||||
document.dispatchEvent(widget_event);
|
gs-w="5" gs-h="15"
|
||||||
// because we remove the element the JS runs in
|
{% endblock %}
|
||||||
// so we need to run it again here
|
|
||||||
|
{% block heading %}
|
||||||
|
Drilldown
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block panel_content %}
|
||||||
|
{% include 'window-content/drilldown.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block custom_script_end %}
|
||||||
initTabs("{{ unique }}");
|
initTabs("{{ unique }}");
|
||||||
</script>
|
{% endblock %}
|
|
@ -1,58 +1,54 @@
|
||||||
|
{% extends 'wm/widget.html' %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<div id="drilldown-widget">
|
{% block widget_options %}
|
||||||
<div id="drilldown-widget-results" class="grid-stack-item" gs-w="10" gs-h="30" gs-y="10" gs-x="1">
|
gs-w="10" gs-h="30" gs-y="10" gs-x="1"
|
||||||
<div class="grid-stack-item-content">
|
{% endblock %}
|
||||||
<div class="panel">
|
|
||||||
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
|
|
||||||
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light ui-move"></i>
|
|
||||||
<i
|
|
||||||
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
|
||||||
onclick='grid.removeWidget("drilldown-widget-results"); //grid.compact();'></i>
|
|
||||||
Results
|
|
||||||
</p>
|
|
||||||
<div class="panel-block is-active">
|
|
||||||
<div class="control">
|
|
||||||
<script src="{% static 'js/column-shifter.js' %}"></script>
|
|
||||||
<span class="icon has-tooltip-bottom" data-tooltip="{{ card }} hits total">
|
|
||||||
<i class="fa-solid fa-chart-mixed"></i>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
{{ table.data|length }} hits in {{ took }}ms
|
|
||||||
{% if exemption is not None %}
|
|
||||||
<span class="icon has-tooltip-bottom" data-tooltip="God mode">
|
|
||||||
<i class="fa-solid fa-book-bible"></i>
|
|
||||||
</span>
|
|
||||||
{% else %}
|
|
||||||
{% if redacted is not None %}
|
|
||||||
<span class="icon has-tooltip-bottom" data-tooltip="{{ redacted }} redacted">
|
|
||||||
<i class="fa-solid fa-mask"></i>
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% if delay is not None %}
|
|
||||||
<span class="icon has-tooltip-bottom" data-tooltip="delayed by {{ delay }} days">
|
|
||||||
<i class="fa-solid fa-clock"></i>
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
{% if randomised is True %}
|
|
||||||
<span class="icon has-tooltip-bottom" data-tooltip="integer fields randomised">
|
|
||||||
<i class="fa-solid fa-shuffle"></i>
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'ui/drilldown/table_results_partial.html' %}
|
|
||||||
{% include 'ui/drilldown/sentiment_partial.html' %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
{% block heading %}
|
||||||
|
Results
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block close_button %}
|
||||||
|
<i
|
||||||
|
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
||||||
|
onclick='grid.removeWidget("drilldown-widget-{{ unique }}"); //grid.compact();'></i>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block panel_content %}
|
||||||
|
<script src="{% static 'js/column-shifter.js' %}"></script>
|
||||||
|
<span class="icon has-tooltip-bottom" data-tooltip="{{ card }} hits total">
|
||||||
|
<i class="fa-solid fa-chart-mixed"></i>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{{ table.data|length }} hits in {{ took }}ms
|
||||||
|
{% if exemption is not None %}
|
||||||
|
<span class="icon has-tooltip-bottom" data-tooltip="God mode">
|
||||||
|
<i class="fa-solid fa-book-bible"></i>
|
||||||
|
</span>
|
||||||
|
{% else %}
|
||||||
|
{% if redacted is not None %}
|
||||||
|
<span class="icon has-tooltip-bottom" data-tooltip="{{ redacted }} redacted">
|
||||||
|
<i class="fa-solid fa-mask"></i>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if delay is not None %}
|
||||||
|
<span class="icon has-tooltip-bottom" data-tooltip="delayed by {{ delay }} days">
|
||||||
|
<i class="fa-solid fa-clock"></i>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
{% if randomised is True %}
|
||||||
|
<span class="icon has-tooltip-bottom" data-tooltip="integer fields randomised">
|
||||||
|
<i class="fa-solid fa-shuffle"></i>
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% include 'ui/drilldown/table_results_partial.html' %}
|
||||||
|
{% include 'ui/drilldown/sentiment_partial.html' %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block custom_script %}
|
||||||
grid.removeWidget("drilldown-widget-results");
|
grid.removeWidget("drilldown-widget-results");
|
||||||
var widget_event = new Event('load-widget');
|
{% endblock %}
|
||||||
document.dispatchEvent(widget_event);
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends 'partials/magnet.html' %}
|
{% extends 'wm/magnet.html' %}
|
||||||
|
|
||||||
{% block heading %}
|
{% block heading %}
|
||||||
Drilldown
|
Drilldown
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<magnet-block attract-distance="10" align-to="outer|center" class="floating-window">
|
<magnet-block attract-distance="10" align-to="outer|center" class="floating-window">
|
||||||
{% extends 'partials/panel.html' %}
|
{% extends 'wm/panel.html' %}
|
||||||
{% block heading %}
|
{% block heading %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
|
<script src="{% static 'modal.js' %}"></script>
|
||||||
|
{% block scripts %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
<div id="modal" class="modal is-active is-clipped">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="box">
|
||||||
|
{% block modal_content %}
|
||||||
|
{% endblock %}
|
||||||
|
<button class="modal-close is-large" aria-label="close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -2,9 +2,11 @@
|
||||||
<nav class="panel">
|
<nav class="panel">
|
||||||
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
|
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
|
||||||
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light"></i>
|
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light"></i>
|
||||||
<i
|
{% block close_button %}
|
||||||
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
<i
|
||||||
data-script="on click remove the closest <nav/>"></i>
|
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
||||||
|
data-script="on click remove the closest <nav/>"></i>
|
||||||
|
{% endblock %}
|
||||||
{% block heading %}
|
{% block heading %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</p>
|
</p>
|
|
@ -0,0 +1,35 @@
|
||||||
|
<div id="drilldown-widget">
|
||||||
|
<div id="drilldown-widget-{{ unique }}" class="grid-stack-item" {% block widget_options %}{% endblock %}>
|
||||||
|
<div class="grid-stack-item-content">
|
||||||
|
|
||||||
|
<nav class="panel">
|
||||||
|
<p class="panel-heading" style="padding: .2em; line-height: .5em;">
|
||||||
|
<i class="fa-solid fa-arrows-up-down-left-right has-text-grey-light"></i>
|
||||||
|
{% block close_button %}
|
||||||
|
<i
|
||||||
|
class="fa-solid fa-xmark has-text-grey-light ui-close"
|
||||||
|
onclick='grid.removeWidget("drilldown-widget-{{ unique }}"); grid.compact();'></i>
|
||||||
|
{% endblock %}
|
||||||
|
{% block heading %}
|
||||||
|
{% endblock %}
|
||||||
|
</p>
|
||||||
|
<article class="panel-block is-active">
|
||||||
|
<div class="control">
|
||||||
|
{% block panel_content %}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
{% block custom_script %}
|
||||||
|
{% endblock %}
|
||||||
|
var widget_event = new Event('load-widget');
|
||||||
|
document.dispatchEvent(widget_event);
|
||||||
|
{% block custom_script_end %}
|
||||||
|
{% endblock %}
|
||||||
|
</script>
|
||||||
|
|
|
@ -206,7 +206,8 @@ def drilldown_search(request, return_context=False, template=None):
|
||||||
context["class"] = "warning"
|
context["class"] = "warning"
|
||||||
|
|
||||||
# unique = str(uuid.uuid4())[:8]
|
# unique = str(uuid.uuid4())[:8]
|
||||||
# context["unique"] = unique
|
context["unique"] = "results"
|
||||||
|
context["widget_options"] = ""
|
||||||
|
|
||||||
response = render(request, template_name, context)
|
response = render(request, template_name, context)
|
||||||
if request.GET:
|
if request.GET:
|
||||||
|
@ -289,7 +290,7 @@ class DrilldownContextModal(APIView):
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
if request.resolver_match.url_name == "modal_context_table":
|
if request.resolver_match.url_name == "modal_context_table":
|
||||||
self.template_name = "modals/context_table.html"
|
self.template_name = "partials/context_table.html"
|
||||||
|
|
||||||
size = 20
|
size = 20
|
||||||
nicks_sensitive = None
|
nicks_sensitive = None
|
||||||
|
|
Loading…
Reference in New Issue