my-buds async add: render full row (anchor + the <Title> + data-tt-* attrs) so the appended entry's tooltip isn't empty — TDD
Adding a bud appended a stripped `@handle`-only <li> — no `applet-list-entry` class, no bud-page anchor, no ` the <Title>` span, no data-tt-* attrs — so the new row rendered without its title and its tooltip came up empty next to the server-rendered rows above it. - add_bud (billboard/views.py) — bud payload now carries `at_handle` (server- computed; the client can't replicate at_handle's truncate_email fallback for username-less buds) + `title` (active_title_display). IT asserts both. - _bud_add_panel.html `_appendBudEntry` — rebuilt to mirror _my_buds_item.html exactly: both classes, data-tt-title/description/email/shoptalk, the bud-name anchor into /billboard/buds/<id>/, and the trailing ` the <Title>`. New FT pins the regression: appended row carries the attrs + anchor + title and its portal populates non-empty on row-lock. AddBudViewTest + append FT green. Code architected by Disco DeDisco <discodedisco@outlook.com> Git commit message Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -19,18 +19,41 @@
|
||||
var empty = list.querySelector('.applet-list-entry--empty');
|
||||
if (empty) empty.remove();
|
||||
|
||||
// Mirror _my_buds_item.html EXACTLY so the async row behaves like a
|
||||
// server-rendered one: both classes (styling + tooltip-lock key on
|
||||
// them), the data-tt-* attrs the portal reads on row-lock, the
|
||||
// bud-page anchor, and the trailing ` the <Title>`. Earlier this
|
||||
// built a bare `@handle` <li> → empty tooltip + dead row.
|
||||
// `at_handle` comes from the server (the client can't replicate the
|
||||
// truncate_email fallback for username-less buds); fall back to a
|
||||
// naive `@`-prefix only if the payload predates that field.
|
||||
var handle = bud.at_handle || (function () {
|
||||
var d = bud.username || '';
|
||||
return d.indexOf('@') >= 0 ? d : '@' + d;
|
||||
}());
|
||||
var title = bud.title || '';
|
||||
|
||||
var li = document.createElement('li');
|
||||
li.className = 'bud-entry';
|
||||
li.className = 'applet-list-entry bud-entry';
|
||||
li.dataset.budId = bud.id;
|
||||
li.dataset.ttTitle = handle;
|
||||
li.dataset.ttDescription = title;
|
||||
li.dataset.ttEmail = bud.email || '';
|
||||
li.dataset.ttShoptalk = ''; // fresh bud — no BudshipNote yet
|
||||
|
||||
var name = document.createElement('span');
|
||||
name.className = 'bud-name';
|
||||
// Mirror the `at_handle` template filter: prefix `@` on plain
|
||||
// usernames; leave the value untouched if it already contains
|
||||
// `@` (the server falls back to email when username is unset,
|
||||
// and emails don't take the prefix).
|
||||
var display = bud.username || '';
|
||||
name.textContent = display.indexOf('@') >= 0 ? display : '@' + display;
|
||||
var a = document.createElement('a');
|
||||
a.href = '/billboard/buds/' + bud.id + '/';
|
||||
a.textContent = handle;
|
||||
name.appendChild(a);
|
||||
li.appendChild(name);
|
||||
|
||||
var rowTitle = document.createElement('span');
|
||||
rowTitle.className = 'bud-row-title';
|
||||
rowTitle.textContent = ' the ' + title;
|
||||
li.appendChild(rowTitle);
|
||||
|
||||
var buffer = list.querySelector('.bud-entry-buffer');
|
||||
if (buffer) list.insertBefore(li, buffer);
|
||||
else list.appendChild(li);
|
||||
|
||||
Reference in New Issue
Block a user