Minor work on frontend generation
Basic status API
This commit is contained in:
parent
7401b8a87c
commit
4d2e04435a
12 changed files with 66 additions and 25 deletions
14
TODO.md
14
TODO.md
|
@ -6,11 +6,6 @@
|
||||||
[_] Allow configuration as single user instance
|
[_] Allow configuration as single user instance
|
||||||
[_] User profiles / names / gateway config / time zone settings
|
[_] User profiles / names / gateway config / time zone settings
|
||||||
|
|
||||||
## mood module
|
|
||||||
|
|
||||||
[_] Missing mood views
|
|
||||||
[_] Statistics / graphs
|
|
||||||
|
|
||||||
## cbt module
|
## cbt module
|
||||||
|
|
||||||
[_] Complete thought record creation
|
[_] Complete thought record creation
|
||||||
|
@ -20,14 +15,7 @@
|
||||||
## msgio module
|
## msgio module
|
||||||
|
|
||||||
[_] Implement Telegram webhooks
|
[_] Implement Telegram webhooks
|
||||||
|
[_] Implement Matrix messaging
|
||||||
## dreams module
|
|
||||||
|
|
||||||
[x] New dream page
|
|
||||||
[x] Edit dream page
|
|
||||||
[x] Delete dream page
|
|
||||||
[x] Statistics / template tags
|
|
||||||
[_] Check for copy-paste errors in pages
|
|
||||||
|
|
||||||
## meds module
|
## meds module
|
||||||
|
|
||||||
|
|
0
api/__init__.py
Normal file
0
api/__init__.py
Normal file
3
api/admin.py
Normal file
3
api/admin.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
6
api/apps.py
Normal file
6
api/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class ApiConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'api'
|
3
api/models.py
Normal file
3
api/models.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
# Create your models here.
|
3
api/tests.py
Normal file
3
api/tests.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
0
api/urls.py
Normal file
0
api/urls.py
Normal file
6
api/views.py
Normal file
6
api/views.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.views.generic import View
|
||||||
|
from django.http import JsonResponse
|
||||||
|
|
||||||
|
class StatusView(View):
|
||||||
|
def get(self, request):
|
||||||
|
return JsonResponse({"status": "OK", "messages": []})
|
15
frontend/classes.py
Normal file
15
frontend/classes.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class NavSection:
|
||||||
|
def __init__(self, name, order=100):
|
||||||
|
self.name = name
|
||||||
|
self.order = order
|
||||||
|
self.items = []
|
||||||
|
|
||||||
|
def add_item(self, item):
|
||||||
|
self.items.append(item)
|
||||||
|
|
||||||
|
class NavItem:
|
||||||
|
def __init__(self, name, url, icon="fas fa-fw fa-smile", title=None):
|
||||||
|
self.name = name
|
||||||
|
self.url = url
|
||||||
|
self.icon = icon
|
||||||
|
self.title = title or name
|
0
frontend/features.py
Normal file
0
frontend/features.py
Normal file
|
@ -1,9 +1,20 @@
|
||||||
from django import template
|
from django import template
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from importlib import import_module
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def sidebar_nav():
|
def sidebar_nav():
|
||||||
|
sections = []
|
||||||
|
|
||||||
|
for module in settings.CORE_MODULES + settings.ENABLED_MODULES:
|
||||||
|
try:
|
||||||
|
features = import_module(f"{module}.features")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<li class="nav-item {% if title == "Dashboard" %}active{% endif %}">
|
<li class="nav-item {% if title == "Dashboard" %}active{% endif %}">
|
||||||
<a class="nav-link" href="{% url "frontend:dashboard" %}">
|
<a class="nav-link" href="{% url "frontend:dashboard" %}">
|
||||||
|
|
|
@ -12,13 +12,23 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
ENABLED_MODULES = [
|
try:
|
||||||
'cbt',
|
ENABLED_MODULES
|
||||||
'dreams',
|
except NameError:
|
||||||
'health',
|
ENABLED_MODULES = [
|
||||||
'friends',
|
'cbt',
|
||||||
'habits',
|
'dreams',
|
||||||
'mood',
|
'health',
|
||||||
|
'friends',
|
||||||
|
'habits',
|
||||||
|
'mood',
|
||||||
|
]
|
||||||
|
|
||||||
|
CORE_MODULES = [
|
||||||
|
'common',
|
||||||
|
'frontend',
|
||||||
|
'msgio',
|
||||||
|
'cronhandler',
|
||||||
]
|
]
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
@ -31,11 +41,7 @@ INSTALLED_APPS = [
|
||||||
'colorfield',
|
'colorfield',
|
||||||
'multiselectfield',
|
'multiselectfield',
|
||||||
'dbsettings',
|
'dbsettings',
|
||||||
'common',
|
] + CORE_MODULES + ENABLED_MODULES
|
||||||
'frontend',
|
|
||||||
'msgio',
|
|
||||||
'cronhandler',
|
|
||||||
] + ENABLED_MODULES
|
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
'django.middleware.security.SecurityMiddleware',
|
'django.middleware.security.SecurityMiddleware',
|
||||||
|
|
Loading…
Reference in a new issue