diff --git a/thinks/static/thinks/thinks.css b/thinks/static/thinks/thinks.css index 53b2582..0780663 100644 --- a/thinks/static/thinks/thinks.css +++ b/thinks/static/thinks/thinks.css @@ -1,5 +1,6 @@ :root { --spacing: 1em; + --half-spacing: calc(0.5 * var(--spacing)); } * { @@ -20,7 +21,7 @@ body.index { display: flex; flex-direction: column; gap: var(--spacing); - + & > .think { & .readme { max-width: 80ch; @@ -41,23 +42,23 @@ body.thing-editor { ; gap: var(--spacing); /*! overflow: hidden; */ - + & main { display: grid; gap: var(--spacing); grid-template: "nav editor preview" / auto 3fr 2fr; height: 100%; - + & > nav { display: flex; flex-direction: column; gap: var(--spacing); - + & #file-tree { margin: 0; overflow: auto; } - + & form { display: grid; grid-template-columns: 1fr 6em; @@ -65,20 +66,32 @@ body.thing-editor { align-items: start; } } - + & #editor { & #editor-controls { display: flex; gap: var(--spacing); justify-content: space-between; + + & > details { + text-align: right; + + & > summary { + user-select: none; + } + + & button { + margin: var(--half-spacing) 0; + } + } } & #code-editor { display: block; max-width: 50vw; - } + } } - + & #preview { display: flex; flex-direction: column; @@ -90,7 +103,7 @@ body.thing-editor { } } } - + #file-form { overflow: auto; /*! max-height: 100%; */ @@ -104,13 +117,13 @@ body.thing-editor { & main { grid-template: "nav" min-content "editor" 40vh "preview"; - + & nav { flex-direction: row; flex-wrap: wrap; & form { flex-grow: 1; - + } } } diff --git a/thinks/views.py b/thinks/views.py index 3843a72..327d6e7 100644 --- a/thinks/views.py +++ b/thinks/views.py @@ -1,4 +1,5 @@ from django.conf import settings +from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponse, JsonResponse from django.shortcuts import render, redirect from django.views import generic @@ -11,7 +12,7 @@ from . import forms from .models import Think from .random_slug import random_slug -class ThinkMixin: +class ThinkMixin(LoginRequiredMixin): model = Think context_object_name = 'think' diff --git a/thinkserver/settings.py b/thinkserver/settings.py index e3b5974..c73faf3 100644 --- a/thinkserver/settings.py +++ b/thinkserver/settings.py @@ -117,6 +117,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/5.0/howto/static-files/ STATIC_URL = 'static/' +STATIC_ROOT = '/srv/think.somethingorotherwhatever.com/public/static' # Default primary key field type # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field @@ -126,4 +127,4 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' THINKS_DIR = Path('think_data') THINKS_DIR.mkdir(parents=True, exist_ok=True) -THINKS_STATIC_URL = 'http://{slug}.thinks.localhost' +THINKS_STATIC_URL = 'http://{slug}.think.somethingorotherwhatever.com' diff --git a/thinkserver/urls.py b/thinkserver/urls.py index 49d843e..36afe45 100644 --- a/thinkserver/urls.py +++ b/thinkserver/urls.py @@ -19,5 +19,6 @@ from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), + path("accounts/", include("django.contrib.auth.urls")), path("", include('thinks.urls')), ]