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
|
||||
[_] User profiles / names / gateway config / time zone settings
|
||||
|
||||
## mood module
|
||||
|
||||
[_] Missing mood views
|
||||
[_] Statistics / graphs
|
||||
|
||||
## cbt module
|
||||
|
||||
[_] Complete thought record creation
|
||||
|
@ -20,14 +15,7 @@
|
|||
## msgio module
|
||||
|
||||
[_] Implement Telegram webhooks
|
||||
|
||||
## 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
|
||||
[_] Implement Matrix messaging
|
||||
|
||||
## 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.conf import settings
|
||||
|
||||
from importlib import import_module
|
||||
|
||||
register = template.Library()
|
||||
|
||||
@register.simple_tag
|
||||
def sidebar_nav():
|
||||
sections = []
|
||||
|
||||
for module in settings.CORE_MODULES + settings.ENABLED_MODULES:
|
||||
try:
|
||||
features = import_module(f"{module}.features")
|
||||
except:
|
||||
pass
|
||||
|
||||
return """
|
||||
<li class="nav-item {% if title == "Dashboard" %}active{% endif %}">
|
||||
<a class="nav-link" href="{% url "frontend:dashboard" %}">
|
||||
|
|
|
@ -12,13 +12,23 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
|
||||
# Application definition
|
||||
|
||||
ENABLED_MODULES = [
|
||||
'cbt',
|
||||
'dreams',
|
||||
'health',
|
||||
'friends',
|
||||
'habits',
|
||||
'mood',
|
||||
try:
|
||||
ENABLED_MODULES
|
||||
except NameError:
|
||||
ENABLED_MODULES = [
|
||||
'cbt',
|
||||
'dreams',
|
||||
'health',
|
||||
'friends',
|
||||
'habits',
|
||||
'mood',
|
||||
]
|
||||
|
||||
CORE_MODULES = [
|
||||
'common',
|
||||
'frontend',
|
||||
'msgio',
|
||||
'cronhandler',
|
||||
]
|
||||
|
||||
INSTALLED_APPS = [
|
||||
|
@ -31,11 +41,7 @@ INSTALLED_APPS = [
|
|||
'colorfield',
|
||||
'multiselectfield',
|
||||
'dbsettings',
|
||||
'common',
|
||||
'frontend',
|
||||
'msgio',
|
||||
'cronhandler',
|
||||
] + ENABLED_MODULES
|
||||
] + CORE_MODULES + ENABLED_MODULES
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
|
|
Loading…
Reference in a new issue