2026-04-22 04:02:14 -04:00
|
|
|
import json
|
|
|
|
|
|
2026-03-19 15:48:59 -04:00
|
|
|
from django.contrib.auth.decorators import login_required
|
2026-04-28 01:30:02 -04:00
|
|
|
from django.utils.html import mark_safe
|
2026-03-24 16:46:46 -04:00
|
|
|
from django.db.models import Max, Q
|
2026-04-22 04:02:14 -04:00
|
|
|
from django.http import JsonResponse
|
2026-03-24 16:46:46 -04:00
|
|
|
from django.shortcuts import redirect, render
|
2026-03-19 15:48:59 -04:00
|
|
|
|
2026-04-21 15:46:30 -04:00
|
|
|
from apps.applets.utils import applet_context, apply_applet_toggle
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
from apps.dashboard.forms import LineForm
|
|
|
|
|
from apps.dashboard.models import Post
|
2026-04-23 01:31:19 -04:00
|
|
|
from apps.dashboard.views import _PALETTE_DEFS
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
from apps.drama.models import GameEvent, Note, ScrollPosition
|
2026-04-21 15:46:30 -04:00
|
|
|
from apps.epic.models import Room
|
|
|
|
|
from apps.epic.utils import rooms_for_user
|
2026-03-19 15:48:59 -04:00
|
|
|
|
2026-04-23 01:31:19 -04:00
|
|
|
_PALETTE_LABELS = {p["name"]: p["label"] for p in _PALETTE_DEFS}
|
|
|
|
|
|
2026-03-19 15:48:59 -04:00
|
|
|
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
def _recent_posts(user, limit=3):
|
|
|
|
|
return (
|
|
|
|
|
Post
|
|
|
|
|
.objects
|
|
|
|
|
.filter(Q(owner=user) | Q(shared_with=user))
|
|
|
|
|
.annotate(last_line=Max('lines__id'))
|
|
|
|
|
.order_by('-last_line')
|
|
|
|
|
.distinct()[:limit]
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2026-05-03 17:15:26 -04:00
|
|
|
def _billboard_context(user):
|
|
|
|
|
my_rooms = rooms_for_user(user).order_by("-created_at")
|
2026-03-24 16:46:46 -04:00
|
|
|
|
|
|
|
|
recent_room = (
|
|
|
|
|
Room.objects.filter(
|
2026-05-03 17:15:26 -04:00
|
|
|
Q(owner=user) | Q(gate_slots__gamer=user)
|
2026-03-24 16:46:46 -04:00
|
|
|
)
|
|
|
|
|
.annotate(last_event=Max("events__timestamp"))
|
|
|
|
|
.filter(last_event__isnull=False)
|
|
|
|
|
.order_by("-last_event")
|
|
|
|
|
.distinct()
|
|
|
|
|
.first()
|
|
|
|
|
)
|
billboard Most Recent Scroll: fix SQLite NULL drop on SIG_READY exclude; pronouns flow FT; Blades middle reversal Nervous → Fickle — TDD
- billboard/views.py _billboard_context: `.exclude(verb=SIG_READY, data__retracted=True)` was silently dropping every SIG_READY event whose data had no `retracted` key — `WHERE NOT (NULL AND verb='sig_ready')` evaluates to NULL via JSON_EXTRACT, which the SQL engine treats as "row not satisfying WHERE", so the row was excluded. Fix: pull a 100-row buffer w. only the SIG_UNREADY exclude at the SQL level, then post-filter retracted SIG_READY in Python before slicing to 36; PostgreSQL handles the lookup correctly so this is a SQLite-only manifestation that explained intermittent "No events yet" in Most Recent Scroll
- CLAUDE.md gotchas: new entry warning that `.exclude(data__key=value)` / `.filter(data__key=value)` on SQLite JSONField bites on missing keys; if the predicate must require key existence, post-filter in Python
- functional_tests/test_game_kit.py PronounsAppletFlowTest: end-to-end profile-wide pronoun flip — start on per-room billscroll seeing "their" cognates, navigate to Game Kit, click bawlmorese card, assert guard portal active w. "yo/yo/yos" preview, click OK, navigate to billboard + see Most Recent Scroll re-rendered w. "yos", navigate back to billscroll + see same flip; covers the whole render-time-pronoun-resolution path on real DOM
- epic/0008_blades_reversal_fickle.py: rename Middle Arcana Blades reversal_qualifier "Nervous" → "Fickle" (RunPython forward+reverse on arcana=MIDDLE, suit=BLADES, number ∈ {11,12,13,14}); SigSelectSpec.js hardcoded "Nervous" updated to "Fickle" + collected static
Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 01:27:17 -04:00
|
|
|
# SIG_READY+retracted exclusion is done in Python because SQLite's NULL
|
|
|
|
|
# semantics drop ALL SIG_READY events whose data has no `retracted` key:
|
|
|
|
|
# `data__retracted=True` resolves to NULL via JSON_EXTRACT for missing keys,
|
|
|
|
|
# and `WHERE NOT (NULL AND verb='sig_ready')` evaluates to NULL → row
|
|
|
|
|
# filtered out. We pull a buffer (100) to absorb any retracted prefix and
|
|
|
|
|
# then slice to 36 after Python filtering.
|
|
|
|
|
if recent_room:
|
|
|
|
|
candidates = list(
|
2026-04-13 00:34:05 -04:00
|
|
|
recent_room.events
|
|
|
|
|
.select_related("actor")
|
|
|
|
|
.exclude(verb=GameEvent.SIG_UNREADY)
|
billboard Most Recent Scroll: fix SQLite NULL drop on SIG_READY exclude; pronouns flow FT; Blades middle reversal Nervous → Fickle — TDD
- billboard/views.py _billboard_context: `.exclude(verb=SIG_READY, data__retracted=True)` was silently dropping every SIG_READY event whose data had no `retracted` key — `WHERE NOT (NULL AND verb='sig_ready')` evaluates to NULL via JSON_EXTRACT, which the SQL engine treats as "row not satisfying WHERE", so the row was excluded. Fix: pull a 100-row buffer w. only the SIG_UNREADY exclude at the SQL level, then post-filter retracted SIG_READY in Python before slicing to 36; PostgreSQL handles the lookup correctly so this is a SQLite-only manifestation that explained intermittent "No events yet" in Most Recent Scroll
- CLAUDE.md gotchas: new entry warning that `.exclude(data__key=value)` / `.filter(data__key=value)` on SQLite JSONField bites on missing keys; if the predicate must require key existence, post-filter in Python
- functional_tests/test_game_kit.py PronounsAppletFlowTest: end-to-end profile-wide pronoun flip — start on per-room billscroll seeing "their" cognates, navigate to Game Kit, click bawlmorese card, assert guard portal active w. "yo/yo/yos" preview, click OK, navigate to billboard + see Most Recent Scroll re-rendered w. "yos", navigate back to billscroll + see same flip; covers the whole render-time-pronoun-resolution path on real DOM
- epic/0008_blades_reversal_fickle.py: rename Middle Arcana Blades reversal_qualifier "Nervous" → "Fickle" (RunPython forward+reverse on arcana=MIDDLE, suit=BLADES, number ∈ {11,12,13,14}); SigSelectSpec.js hardcoded "Nervous" updated to "Fickle" + collected static
Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-04 01:27:17 -04:00
|
|
|
.order_by("-timestamp")[:100]
|
|
|
|
|
)
|
|
|
|
|
visible = [
|
|
|
|
|
e for e in candidates
|
|
|
|
|
if not (e.verb == GameEvent.SIG_READY and e.data.get("retracted"))
|
|
|
|
|
]
|
|
|
|
|
recent_events = visible[:36][::-1]
|
|
|
|
|
else:
|
|
|
|
|
recent_events = []
|
2026-03-24 16:46:46 -04:00
|
|
|
|
2026-05-03 17:15:26 -04:00
|
|
|
return {
|
2026-03-19 15:48:59 -04:00
|
|
|
"my_rooms": my_rooms,
|
2026-03-24 16:46:46 -04:00
|
|
|
"recent_room": recent_room,
|
|
|
|
|
"recent_events": recent_events,
|
2026-05-03 17:15:26 -04:00
|
|
|
"viewer": user,
|
|
|
|
|
"applets": applet_context(user, "billboard"),
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
"form": LineForm(),
|
2026-05-03 17:15:26 -04:00
|
|
|
"recent_posts": _recent_posts(user),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required(login_url="/")
|
|
|
|
|
def billboard(request):
|
|
|
|
|
return render(request, "apps/billboard/billboard.html", {
|
|
|
|
|
**_billboard_context(request.user),
|
2026-03-19 15:48:59 -04:00
|
|
|
"page_class": "page-billboard",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2026-03-24 16:46:46 -04:00
|
|
|
@login_required(login_url="/")
|
|
|
|
|
def toggle_billboard_applets(request):
|
|
|
|
|
checked = request.POST.getlist("applets")
|
2026-04-21 15:46:30 -04:00
|
|
|
apply_applet_toggle(request.user, "billboard", checked)
|
2026-03-24 16:46:46 -04:00
|
|
|
if request.headers.get("HX-Request"):
|
2026-05-03 17:15:26 -04:00
|
|
|
return render(
|
|
|
|
|
request,
|
|
|
|
|
"apps/billboard/_partials/_applets.html",
|
|
|
|
|
_billboard_context(request.user),
|
|
|
|
|
)
|
2026-03-24 16:46:46 -04:00
|
|
|
return redirect("billboard:billboard")
|
|
|
|
|
|
|
|
|
|
|
2026-03-19 15:48:59 -04:00
|
|
|
@login_required(login_url="/")
|
2026-05-03 23:22:01 -04:00
|
|
|
def scroll(request, room_id):
|
2026-03-19 15:48:59 -04:00
|
|
|
room = Room.objects.get(id=room_id)
|
|
|
|
|
events = room.events.select_related("actor").all()
|
2026-03-24 17:44:34 -04:00
|
|
|
sp = ScrollPosition.objects.filter(user=request.user, room=room).first()
|
2026-05-03 23:22:01 -04:00
|
|
|
return render(request, "apps/billboard/scroll.html", {
|
2026-03-19 15:48:59 -04:00
|
|
|
"room": room,
|
|
|
|
|
"events": events,
|
|
|
|
|
"viewer": request.user,
|
2026-03-24 17:44:34 -04:00
|
|
|
"scroll_position": sp.position if sp else 0,
|
2026-03-24 16:46:46 -04:00
|
|
|
"page_class": "page-billscroll",
|
2026-03-19 15:48:59 -04:00
|
|
|
})
|
2026-03-24 17:44:34 -04:00
|
|
|
|
|
|
|
|
|
2026-04-23 01:31:19 -04:00
|
|
|
def _palette_opts(names):
|
|
|
|
|
return [{"name": n, "label": _PALETTE_LABELS.get(n, n)} for n in names]
|
|
|
|
|
|
|
|
|
|
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
_NOTE_META = {
|
2026-04-22 04:02:14 -04:00
|
|
|
"stargazer": {
|
|
|
|
|
"title": "Stargazer",
|
|
|
|
|
"description": "You saved your first personal sky chart.",
|
2026-04-23 01:31:19 -04:00
|
|
|
"palette_options": _palette_opts(["palette-bardo", "palette-sheol"]),
|
2026-04-28 01:30:02 -04:00
|
|
|
"swatch_label": None,
|
2026-04-22 04:02:14 -04:00
|
|
|
},
|
|
|
|
|
"schizo": {
|
|
|
|
|
"title": "Schizo",
|
|
|
|
|
"description": "The socius recognizes the line of flight.",
|
|
|
|
|
"palette_options": [],
|
2026-04-28 01:30:02 -04:00
|
|
|
"swatch_label": None,
|
2026-04-22 04:02:14 -04:00
|
|
|
},
|
|
|
|
|
"nomad": {
|
|
|
|
|
"title": "Nomad",
|
|
|
|
|
"description": "The socius recognizes the smooth space.",
|
|
|
|
|
"palette_options": [],
|
2026-04-28 01:30:02 -04:00
|
|
|
"swatch_label": None,
|
|
|
|
|
},
|
|
|
|
|
"super-schizo": {
|
2026-04-28 01:54:57 -04:00
|
|
|
"title": "Super-Schizo",
|
2026-04-28 01:30:02 -04:00
|
|
|
"description": mark_safe('Admin access granted to <span class="card-ref">I. The Schizo</span> as Significator'),
|
|
|
|
|
"palette_options": [],
|
|
|
|
|
"swatch_label": "I",
|
|
|
|
|
},
|
|
|
|
|
"super-nomad": {
|
2026-04-28 01:54:57 -04:00
|
|
|
"title": "Super-Nomad",
|
2026-04-28 01:30:02 -04:00
|
|
|
"description": mark_safe('Admin access granted to <span class="card-ref">0. The Nomad</span> as Significator'),
|
|
|
|
|
"palette_options": [],
|
|
|
|
|
"swatch_label": "0",
|
2026-04-22 04:02:14 -04:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required(login_url="/")
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
def note_set_palette(request, slug):
|
2026-04-22 04:02:14 -04:00
|
|
|
from django.http import Http404
|
2026-04-22 23:54:05 -04:00
|
|
|
from apps.dashboard.views import _unlocked_palettes_for_user
|
2026-04-22 04:02:14 -04:00
|
|
|
try:
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
note = Note.objects.get(user=request.user, slug=slug)
|
|
|
|
|
except Note.DoesNotExist:
|
2026-04-22 04:02:14 -04:00
|
|
|
raise Http404
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
body = json.loads(request.body)
|
2026-04-22 23:54:05 -04:00
|
|
|
palette = body.get("palette", "")
|
|
|
|
|
note.palette = palette
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
note.save(update_fields=["palette"])
|
2026-04-22 23:54:05 -04:00
|
|
|
# Commit as the user's active sitewide palette now that the Note unlocks it.
|
|
|
|
|
if palette in _unlocked_palettes_for_user(request.user):
|
|
|
|
|
request.user.palette = palette
|
|
|
|
|
request.user.save(update_fields=["palette"])
|
2026-04-22 04:02:14 -04:00
|
|
|
return JsonResponse({"ok": True})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required(login_url="/")
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
def my_notes(request):
|
|
|
|
|
qs = Note.objects.filter(user=request.user)
|
2026-04-23 01:44:58 -04:00
|
|
|
active_title = request.user.active_title
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
note_items = [
|
2026-04-22 04:02:14 -04:00
|
|
|
{
|
2026-04-28 01:54:57 -04:00
|
|
|
"obj": n,
|
|
|
|
|
"title": _NOTE_META.get(n.slug, {}).get("title", n.slug),
|
|
|
|
|
"recognition_title": n.display_title,
|
|
|
|
|
"description": _NOTE_META.get(n.slug, {}).get("description", ""),
|
|
|
|
|
"palette_options": _NOTE_META.get(n.slug, {}).get("palette_options", []),
|
|
|
|
|
"swatch_label": _NOTE_META.get(n.slug, {}).get("swatch_label"),
|
|
|
|
|
"palette_label": _PALETTE_LABELS.get(n.palette, "") if n.palette else "",
|
|
|
|
|
"is_equipped": active_title is not None and active_title.pk == n.pk,
|
2026-04-22 04:02:14 -04:00
|
|
|
}
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
for n in qs
|
2026-04-22 04:02:14 -04:00
|
|
|
]
|
rename: Note→Post/Line (dashboard); Recognition→Note (drama); new-post/my-posts to billboard
- dashboard: Note→Post, Item→Line across models, forms, views, API, urls & tests
- new-post (9×3) & my-posts (3×3) applets migrate from dashboard→billboard context; billboard view passes form & recent_posts
- drama: Recognition→Note, related_name notes; billboard URL /recognition/→/my-notes/, set-palette at /note/<slug>/set-palette
- recognition.js→note.js (module Note, data.note key); recognition-page.js→note-page.js; .recog-*→.note-*
- _recognition.scss→_note.scss; BillNotes page header; applet slug billboard-recognition→billboard-notes (My Notes)
- NoteSpec.js replaces RecognitionSpec.js; test_recognition.py→test_applet_my_notes.py
- 4 migrations applied: dashboard 0004, applets 0011+0012, drama 0005; 683 ITs green
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:32:34 -04:00
|
|
|
return render(request, "apps/billboard/my_notes.html", {
|
|
|
|
|
"notes": qs,
|
|
|
|
|
"note_items": note_items,
|
|
|
|
|
"page_class": "page-notes",
|
2026-04-22 04:02:14 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
2026-04-23 01:44:58 -04:00
|
|
|
@login_required(login_url="/")
|
|
|
|
|
def don_title(request, slug):
|
|
|
|
|
from django.http import Http404
|
|
|
|
|
try:
|
|
|
|
|
note = Note.objects.get(user=request.user, slug=slug)
|
|
|
|
|
except Note.DoesNotExist:
|
|
|
|
|
raise Http404
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
request.user.active_title = note
|
|
|
|
|
request.user.save(update_fields=["active_title"])
|
2026-04-28 01:54:57 -04:00
|
|
|
return JsonResponse({"title": note.display_title, "greeting": note.display_greeting})
|
2026-04-23 01:44:58 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@login_required(login_url="/")
|
|
|
|
|
def doff_title(request, slug):
|
|
|
|
|
if request.method == "POST":
|
|
|
|
|
request.user.active_title = None
|
|
|
|
|
request.user.save(update_fields=["active_title"])
|
2026-04-28 01:54:57 -04:00
|
|
|
return JsonResponse({"ok": True, "greeting": "Welcome,", "title": "Earthman"})
|
2026-04-23 01:44:58 -04:00
|
|
|
|
|
|
|
|
|
2026-03-24 17:44:34 -04:00
|
|
|
@login_required(login_url="/")
|
|
|
|
|
def save_scroll_position(request, room_id):
|
|
|
|
|
if request.method != "POST":
|
|
|
|
|
from django.http import HttpResponseNotAllowed
|
|
|
|
|
return HttpResponseNotAllowed(["POST"])
|
|
|
|
|
room = Room.objects.get(id=room_id)
|
|
|
|
|
position = int(request.POST.get("position", 0))
|
|
|
|
|
ScrollPosition.objects.update_or_create(
|
|
|
|
|
user=request.user, room=room,
|
|
|
|
|
defaults={"position": position},
|
|
|
|
|
)
|
|
|
|
|
from django.http import HttpResponse
|
|
|
|
|
return HttpResponse(status=204)
|