Implement a hooks page
parent
5c67a3a707
commit
83808dfa52
@ -1,5 +0,0 @@
|
||||
{% extends 'wm/modal.html' %}
|
||||
|
||||
{% block modal_content %}
|
||||
{% include 'window-content/main.html' %}
|
||||
{% endblock %}
|
@ -1,20 +0,0 @@
|
||||
{% extends 'wm/widget.html' %}
|
||||
{% load static %}
|
||||
|
||||
{% block widget_options %}
|
||||
gs-w="10" gs-h="1" gs-y="10" gs-x="1"
|
||||
{% endblock %}
|
||||
|
||||
{% block heading %}
|
||||
Widget
|
||||
{% endblock %}
|
||||
|
||||
{% block close_button %}
|
||||
<i
|
||||
class="fa-solid fa-xmark has-text-grey-light float-right"
|
||||
onclick='grid.removeWidget("widget-{{ unique }}"); //grid.compact();'></i>
|
||||
{% endblock %}
|
||||
|
||||
{% block panel_content %}
|
||||
{% include 'window-content/main.html' %}
|
||||
{% endblock %}
|
@ -0,0 +1,47 @@
|
||||
<div class="buttons">
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="#"
|
||||
hx-trigger="click"
|
||||
hx-target="#modals-here"
|
||||
class="button is-info">
|
||||
<span class="icon-text">
|
||||
<span class="icon">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
</span>
|
||||
<span>Hook</span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% include 'partials/notify.html' %}
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<th>user</th>
|
||||
<th>hook</th>
|
||||
<th>received hooks</th>
|
||||
<th>actions</th>
|
||||
</thead>
|
||||
{% for item in hooks %}
|
||||
<tr>
|
||||
<td>{{ item.user }}</td>
|
||||
<td>{{ item.hook }}</td>
|
||||
<td>{{ item.received }}</td>
|
||||
<td>
|
||||
<button
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-get="#"
|
||||
hx-trigger="click"
|
||||
hx-target="#modals-here"
|
||||
class="button is-info">
|
||||
<span class="icon-text">
|
||||
<span class="icon">
|
||||
<i class="fa-solid fa-pencil"></i>
|
||||
</span>
|
||||
<span>Hook</span>
|
||||
</span>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
@ -1,9 +0,0 @@
|
||||
{% extends 'wm/magnet.html' %}
|
||||
|
||||
{% block heading %}
|
||||
Window
|
||||
{% endblock %}
|
||||
|
||||
{% block panel_content %}
|
||||
{% include 'window-content/main.html' %}
|
||||
{% endblock %}
|
@ -0,0 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
{% include window_content %}
|
||||
{% endblock %}
|
@ -1,8 +1,10 @@
|
||||
<magnet-block attract-distance="10" align-to="outer|center" class="floating-window">
|
||||
{% extends 'wm/panel.html' %}
|
||||
{% block heading %}
|
||||
{{ title }}
|
||||
{% endblock %}
|
||||
|
||||
{% block panel_content %}
|
||||
{% include window_content %}
|
||||
{% endblock %}
|
||||
</magnet-block>
|
@ -1,34 +0,0 @@
|
||||
import uuid
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.views import View
|
||||
from django.http import HttpResponseBadRequest
|
||||
|
||||
class OpenSettings(View):
|
||||
allowed_types = ["modal", "widget", "window"]
|
||||
|
||||
async def get(self, request, type):
|
||||
if type not in self.allowed_types:
|
||||
return HttpResponseBadRequest
|
||||
#template_name =
|
||||
|
||||
class DemoModal(View):
|
||||
template_name = "modals/modal.html"
|
||||
|
||||
async def get(self, request):
|
||||
return render(request, self.template_name)
|
||||
|
||||
|
||||
class DemoWidget(View):
|
||||
template_name = "widgets/widget.html"
|
||||
|
||||
async def get(self, request):
|
||||
unique = str(uuid.uuid4())[:8]
|
||||
return render(request, self.template_name, {"unique": unique})
|
||||
|
||||
|
||||
class DemoWindow(View):
|
||||
template_name = "windows/window.html"
|
||||
|
||||
async def get(self, request):
|
||||
return render(request, self.template_name)
|
@ -0,0 +1,25 @@
|
||||
import uuid
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.shortcuts import render
|
||||
from django.views import View
|
||||
|
||||
|
||||
class Hooks(LoginRequiredMixin, View):
|
||||
allowed_types = ["modal", "widget", "window", "page"]
|
||||
window_content = "window-content/hooks.html"
|
||||
|
||||
async def get(self, request, type):
|
||||
if type not in self.allowed_types:
|
||||
return HttpResponseBadRequest
|
||||
template_name = f"wm/{type}.html"
|
||||
unique = str(uuid.uuid4())[:8]
|
||||
hooks = [{"user": "test", "hook": "/help22", "received": "40"}]
|
||||
context = {
|
||||
"title": f"{type} Demo",
|
||||
"unique": unique,
|
||||
"window_content": self.window_content,
|
||||
"hooks": hooks,
|
||||
}
|
||||
return render(request, template_name, context)
|
Loading…
Reference in New Issue