tracker
All repositories: gitoria
4.6 KB
// components/franchiseedit.hl — `/franchises/edit` (tracker.worldapi.org#19, mission 066): the creator's editor, step 1 —// a new franchise (name + summary → its index), a new timeline (name → its own editor, /timelines/<slug>/edit, where titles// are added and ordered and the franchise is attached), and a finder for the timelines that exist (by name → their editor).// Only the creator (franchises.hl isEditorSession: ident id az5b2, TRACKER_EDITORS) sees the forms; every face checks it again.//// HYBRIEL TRAPS (as components/search.hl): no member reads both a route param and `session`; every list is replaced whole.parent './main.hl'import { navigate } from 'hl:web'import { appTitle } from '../lib/app.hl'import { isEditorSession, createFranchise, createTimeline, findTimelines } from '../lib/franchises.hl'import { warmReady, warmText } from '../lib/warm.hl'static editorOf = (&session) => { return isEditorSession(&session) }session = nullisEditor = editorOf(&session)notEditor = isEditor == falsemessage = ''hasMessage = message != ''franchiseName = ''franchiseSummary = ''timelineName = ''findText = ''found = []hasFound = found.length > 0__title = 'Edit franchises — ' + appTitle// mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'// stage is there this page says so instead of showing half a mapwarming = !warmReady('all')warmNote = warming ? warmText() : ''// Component styles use the shared theme variables.Style {franchiseEditPage {display = 'block'}}View {franchiseEditPage {if (warming) { p { id = "warming" class = "message banner" warmNote } }h1 { "Edit franchises" }if (notEditor) { p { id = "edit-refused" class = "muted" "Only the creator can edit franchises and timelines." } }if (isEditor) {if (hasMessage) { p { id = "edit-message" class = "message" message } }editSection {h2 { class = "film-heading" "New franchise" }input { id = "fe-name" value = franchiseName on input(e) { franchiseName = e.target.value } type = "text" placeholder = "Name, e.g. Star Trek" autocomplete = "off" "aria-label" = "Franchise name" }textarea { id = "fe-summary" value = franchiseSummary on input(e) { franchiseSummary = e.target.value } rows = "3" placeholder = "A few words about it (optional)" "aria-label" = "Franchise summary" }button { id = "fe-create" type = "button" class = "primary" "Create franchise" on click(e) { emit newFranchise(e) } }}editSection {h2 { class = "film-heading" "New timeline" }input { id = "te-name" value = timelineName on input(e) { timelineName = e.target.value } type = "text" placeholder = "Name, e.g. Star Trek — Prime" autocomplete = "off" "aria-label" = "Timeline name" }button { id = "te-create" type = "button" class = "primary" "Create timeline" on click(e) { emit newTimeline(e) } }}editSection {h2 { class = "film-heading" "Edit a timeline" }input { id = "tl-find" value = findText type = "search" placeholder = "Timeline name" autocomplete = "off" "aria-label" = "Find a timeline" on input(e) { emit findTyped(e) } }if (hasFound) {timelineList { id = "tl-found"for (t of found) {a { class = "timeline-link" href = t.hreftimelineLinkName { t.name }timelineLinkCount { t.countText }}}}}}}}}on newFranchise(e) {r = emit server fedCreateFranchise(franchiseName, franchiseSummary)if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }navigate('/franchises/' + r.slug)}on newTimeline(e) {r = emit server fedCreateTimeline(timelineName)if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }navigate('/timelines/' + r.slug + '/edit')}on findTyped(e) {v = e.target.valuefindText = vr = emit server fedFindTimelines(v)if (r == null || findText != v) { return null }found = r.rows}// ---- the faces (unique names: hl:web dispatches by name across all files; the trailing `session` is the server's) ----on server fedCreateFranchise(name, summary, session) {if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }return createFranchise(name, summary)}on server fedCreateTimeline(name, session) {if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }return createTimeline(&name)}// timeline names are public (/franchises lists them all) — no session neededon server fedFindTimelines(text) {return { rows = findTimelines(&text) }}
Branches
Latest commits
- 613ae0ecMerge branch 'bs3' into mainTracker
- 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
- 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
- 310613f1Merge branch 'records-dp72' into mainTracker
- 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
- c41587d2Merge branch 'bs2' into mainTracker
- 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
- 019d5cedMerge branch 'records-1110' into mainTracker
- f88ae8b9|||PR records: day56 toggle live, reviewTracker
- b6b3bb4dMerge branch 'ap56e' into mainTracker
- 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
- 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
- 4b54f6f9Merge branch 'records-audit' into mainTracker
- cab4a3bc|||PR records: branch audit, PR-onlyTracker
- 641e1c4cMerge branch 'records-dp71' into mainTracker
- 85a6e9f5|||PR records: DP71 checked in ChromeTracker
- f5be5f18records: gitoria PR-only planTracker
- 46a37036records: DP71 liveTracker
- 3bcb7039Status/log: DP71 in progressTracker
- 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker