diff --git a/core/templates/core/_edit_form.html b/core/templates/core/_edit_form.html index 505968b..4966eaa 100644 --- a/core/templates/core/_edit_form.html +++ b/core/templates/core/_edit_form.html @@ -2,6 +2,13 @@ {% csrf_token %}
Typ: {{ item.get_kind_display }}
+
+ +
+
+
Tag auswählen
{% for tag in tags %}{% endfor %}
+
+
diff --git a/core/templates/core/_item.html b/core/templates/core/_item.html index 64728e0..9a47e77 100644 --- a/core/templates/core/_item.html +++ b/core/templates/core/_item.html @@ -1,8 +1,8 @@ {% load markdown_extras %}
-
-
+
+
{{ item.get_kind_display }} {{ item.get_visibility_display }} @@ -24,7 +24,7 @@
{% endif %}
-
+
{% if item.kind == 'todo' %}{% endif %} {% if request.resolver_match.url_name == 'item_detail' %} ✎ diff --git a/core/templates/core/base.html b/core/templates/core/base.html index d8f6fa4..1a2fcb2 100644 --- a/core/templates/core/base.html +++ b/core/templates/core/base.html @@ -5,22 +5,29 @@ my2dos + + + + + + + - +
{% for message in messages %}
{{ message }}
{% endfor %}{% block content %}{% endblock %}
diff --git a/core/templates/core/index.html b/core/templates/core/index.html index 1a5555e..e7bbd5c 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,6 +1,12 @@ {% extends 'core/base.html' %} {% load querystring %} {% block content %} +
-
+ {% csrf_token %} +
+ + + + +
+
Tags hinzufügen
{% for tag in tags %}{% endfor %}
{{ form.content }}
-
- +
+ +
Editor
diff --git a/core/templates/core/item_editor.html b/core/templates/core/item_editor.html index fc36dd6..5beab57 100644 --- a/core/templates/core/item_editor.html +++ b/core/templates/core/item_editor.html @@ -6,6 +6,13 @@

Eintrag #{{ item.id }} im Editor bearbeiten

Typ: {{ item.get_kind_display }}
+
+ +
+
+
Tag auswählen
{% for tag in tags %}{% endfor %}
+
+
diff --git a/core/templates/core/journal.html b/core/templates/core/journal.html index d49fa05..36a5535 100644 --- a/core/templates/core/journal.html +++ b/core/templates/core/journal.html @@ -20,9 +20,16 @@

Journal {{ selected_day }}

{% csrf_token %} +
+ + + + +
+
Tags hinzufügen
{% for tag in tags %}{% endfor %}
{{ form.content }}
-
+
{% for item in items %}{% include 'core/_item.html' %}{% empty %}
Keine Journal-Aktivität an diesem Tag.
{% endfor %} diff --git a/core/templates/core/new_item.html b/core/templates/core/new_item.html index 449b741..9501f04 100644 --- a/core/templates/core/new_item.html +++ b/core/templates/core/new_item.html @@ -1,18 +1,27 @@ {% extends 'core/base.html' %} {% block content %} -← zurück +← zurück
{% csrf_token %} +
-

Erweiterter Editor

- +

{% if requested_kind == 'todo' %}Aufgabe erstellen{% elif requested_kind == 'link' %}Link erstellen{% elif requested_kind == 'journal' %}Journal-Eintrag erstellen{% else %}Notiz erstellen{% endif %}

+
+ +
+
+
Tag auswählen
{% for tag in tags %}{% endfor %}
+
+
+
- - -
Mit ![[ können hochgeladene oder gepastete Bilder im Text eingefügt werden.
+ + +
+
Mit ![[ können Bilder im Text eingefügt werden.
diff --git a/core/views.py b/core/views.py index 2c1788d..005998a 100644 --- a/core/views.py +++ b/core/views.py @@ -162,15 +162,22 @@ def index(request): @login_required def new_item(request): + requested_kind = request.GET.get('kind', '') + next_url = request.GET.get('next') or request.POST.get('next') or 'index' if request.method == 'POST': form = QuickItemForm(request.POST, request.FILES) if form.is_valid(): - kind, visibility, content, url = parse_quick_content(form.cleaned_data['content']) + raw = form.cleaned_data['content'] + if requested_kind in {'todo', 'link', 'journal'} and not re.search(r'/(todo|note|link|journal)\b', raw, re.I): + raw = f'/{requested_kind} {raw}' + kind, visibility, content, url = parse_quick_content(raw) item = Item.objects.create(owner=request.user, kind=kind, visibility=visibility, content=content, url=url) attach_files_and_replace_tokens(item, request.FILES.getlist('files')) item.sync_metadata() - return redirect(item.get_absolute_url()) - return render(request, 'core/new_item.html', {'form': QuickItemForm(), 'tags': Tag.objects.all()}) + return redirect(next_url) + return render(request, 'core/new_item.html', { + 'form': QuickItemForm(), 'tags': Tag.objects.all(), 'requested_kind': requested_kind, 'next_url': next_url, + }) @login_required diff --git a/static/icon.svg b/static/icon.svg new file mode 100644 index 0000000..0a18025 --- /dev/null +++ b/static/icon.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/static/manifest.webmanifest b/static/manifest.webmanifest new file mode 100644 index 0000000..0bb8614 --- /dev/null +++ b/static/manifest.webmanifest @@ -0,0 +1,18 @@ +{ + "name": "my2dos", + "short_name": "my2dos", + "description": "Notizen, Aufgaben, Links und Journal", + "start_url": "/", + "scope": "/", + "display": "standalone", + "background_color": "#f7f7f4", + "theme_color": "#212529", + "icons": [ + { + "src": "/static/icon.svg", + "sizes": "any", + "type": "image/svg+xml", + "purpose": "any maskable" + } + ] +} diff --git a/static/sw.js b/static/sw.js new file mode 100644 index 0000000..e14c404 --- /dev/null +++ b/static/sw.js @@ -0,0 +1,6 @@ +self.addEventListener('install', event => self.skipWaiting()); +self.addEventListener('activate', event => event.waitUntil(self.clients.claim())); + +// Minimaler Service Worker für Installierbarkeit als PWA. +// Offline-Funktionalität ist bewusst nicht implementiert. +self.addEventListener('fetch', () => {});