From 83808dfa52d4136cf0d6991395fe01bfeaffab61 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Fri, 14 Oct 2022 07:20:30 +0100 Subject: [PATCH] Implement a hooks page --- app/urls.py | 9 ++-- core/models.py | 6 +++ core/templates/base.html | 11 +++++ core/templates/index.html | 7 --- core/templates/modals/modal.html | 5 -- core/templates/widgets/widget.html | 20 -------- core/templates/window-content/hooks.html | 47 +++++++++++++++++++ core/templates/window-content/main.html | 6 +-- core/templates/window-content/settings.html | 0 core/templates/windows/window.html | 9 ---- core/templates/wm/modal.html | 1 + core/templates/wm/page.html | 6 +++ core/templates/wm/widget.html | 4 +- .../templates/wm/{magnet.html => window.html} | 2 + core/views/config.py | 34 -------------- core/views/hooks.py | 25 ++++++++++ 16 files changed, 109 insertions(+), 83 deletions(-) delete mode 100644 core/templates/modals/modal.html delete mode 100644 core/templates/widgets/widget.html create mode 100644 core/templates/window-content/hooks.html delete mode 100644 core/templates/window-content/settings.html delete mode 100644 core/templates/windows/window.html create mode 100644 core/templates/wm/page.html rename core/templates/wm/{magnet.html => window.html} (75%) delete mode 100644 core/views/config.py create mode 100644 core/views/hooks.py diff --git a/app/urls.py b/app/urls.py index ec33900..a5808f5 100644 --- a/app/urls.py +++ b/app/urls.py @@ -19,7 +19,7 @@ from django.contrib import admin from django.urls import include, path from django.views.generic import TemplateView -from core.views import base, demo +from core.views import base, hooks from core.views.callbacks import Callback urlpatterns = [ @@ -41,7 +41,8 @@ urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include("django.contrib.auth.urls")), path("accounts/signup/", base.Signup.as_view(), name="signup"), - path("demo/modal/", demo.DemoModal.as_view(), name="modal"), - path("demo/widget/", demo.DemoWidget.as_view(), name="widget"), - path("demo/window/", demo.DemoWindow.as_view(), name="window"), + # path("demo/modal/", demo.DemoModal.as_view(), name="modal"), + # path("demo/widget/", demo.DemoWidget.as_view(), name="widget"), + # path("demo/window/", demo.DemoWindow.as_view(), name="window"), + path("hooks//", hooks.Hooks.as_view(), name="hooks"), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) diff --git a/core/models.py b/core/models.py index a78614f..0330953 100644 --- a/core/models.py +++ b/core/models.py @@ -74,6 +74,12 @@ class Session(models.Model): plan = models.ForeignKey(Plan, null=True, blank=True, on_delete=models.CASCADE) +class Hook(models.Model): + user = user = models.ForeignKey(User, on_delete=models.CASCADE) + hook = models.CharField(max_length=255, null=True, blank=True) + received = models.IntegerField(default=0) + + # class Perms(models.Model): # class Meta: # permissions = ( diff --git a/core/templates/base.html b/core/templates/base.html index 7843324..65b441c 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -201,6 +201,11 @@ Home + {% if user.is_authenticated %} + + Hooks + + {% endif %} {% if settings.STRIPE_ENABLED %} {% if user.is_authenticated %} @@ -285,6 +290,12 @@
{% block content %} {% endblock %} +
+
+
+
+
diff --git a/core/templates/index.html b/core/templates/index.html index 2d0292c..1319b0a 100644 --- a/core/templates/index.html +++ b/core/templates/index.html @@ -81,13 +81,6 @@ } }); - -
-
-
-
- diff --git a/core/templates/modals/modal.html b/core/templates/modals/modal.html deleted file mode 100644 index 1724307..0000000 --- a/core/templates/modals/modal.html +++ /dev/null @@ -1,5 +0,0 @@ -{% extends 'wm/modal.html' %} - -{% block modal_content %} - {% include 'window-content/main.html' %} -{% endblock %} \ No newline at end of file diff --git a/core/templates/widgets/widget.html b/core/templates/widgets/widget.html deleted file mode 100644 index d974590..0000000 --- a/core/templates/widgets/widget.html +++ /dev/null @@ -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 %} - -{% endblock %} - -{% block panel_content %} - {% include 'window-content/main.html' %} -{% endblock %} diff --git a/core/templates/window-content/hooks.html b/core/templates/window-content/hooks.html new file mode 100644 index 0000000..02f4299 --- /dev/null +++ b/core/templates/window-content/hooks.html @@ -0,0 +1,47 @@ +
+ +
+ +{% include 'partials/notify.html' %} + + + + + + + + {% for item in hooks %} + + + + + + + {% endfor %} +
userhookreceived hooksactions
{{ item.user }}{{ item.hook }}{{ item.received }} + +
diff --git a/core/templates/window-content/main.html b/core/templates/window-content/main.html index 84b385e..ca44c02 100644 --- a/core/templates/window-content/main.html +++ b/core/templates/window-content/main.html @@ -3,7 +3,7 @@
diff --git a/core/templates/wm/page.html b/core/templates/wm/page.html new file mode 100644 index 0000000..93ea8c1 --- /dev/null +++ b/core/templates/wm/page.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} + + +{% block content %} + {% include window_content %} +{% endblock %} diff --git a/core/templates/wm/widget.html b/core/templates/wm/widget.html index dafc773..d2c8579 100644 --- a/core/templates/wm/widget.html +++ b/core/templates/wm/widget.html @@ -1,5 +1,5 @@
-
+