gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitee2b677aee2b677alog: RV39 deployingmreee2b677a/components/franchiseedit.hl

4.3 KB

  1. // components/franchiseedit.hl — `/franchises/edit` (tracker.worldapi.org#19, mission 066): the creator's editor, step 1 —
  2. // a new franchise (name + summary → its index), a new timeline (name → its own editor, /timelines/<slug>/edit, where titles
  3. // are added and ordered and the franchise is attached), and a finder for the timelines that exist (by name → their editor).
  4. // Only the creator (franchises.hl isEditorSession: ident id az5b2, TRACKER_EDITORS) sees the forms; every face checks it again.
  5. //
  6. // HYBRIEL TRAPS (as components/search.hl): no member reads both a route param and `session`; every list is replaced whole.
  7. parent './main.hl'
  8. import { navigate } from 'hl:web'
  9. import { appTitle } from '../project.hl'
  10. import { isEditorSession, createFranchise, createTimeline, findTimelines } from '../lib/franchises.hl'
  11. import { warmReady, warmText } from '../lib/warm.hl'
  12. static editorOf = (&session) => { return isEditorSession(&session) }
  13. session = null
  14. isEditor = editorOf(&session)
  15. notEditor = isEditor == false
  16. message = ''
  17. hasMessage = message != ''
  18. found = []
  19. hasFound = found.length > 0
  20. __title = 'Edit franchises — ' + appTitle
  21. // mission T17 (boot time): the server listens while bootscan.hl still builds the lists / slug maps / search index (lib/warm.hl); until the 'all'
  22. // stage is there this page says so instead of showing half a map
  23. warming = !warmReady('all')
  24. warmNote = warming ? warmText() : ''
  25. View {
  26. franchiseEditPage {
  27. if (warming) { p { id = "warming" class = "message banner" warmNote } }
  28. h1 { "Edit franchises" }
  29. if (notEditor) { p { id = "edit-refused" class = "muted" "Only the creator can edit franchises and timelines." } }
  30. if (isEditor) {
  31. if (hasMessage) { p { id = "edit-message" class = "message" message } }
  32. editSection {
  33. h2 { class = "film-heading" "New franchise" }
  34. input { id = "fe-name" type = "text" placeholder = "Name, e.g. Star Trek" autocomplete = "off" "aria-label" = "Franchise name" }
  35. textarea { id = "fe-summary" rows = "3" placeholder = "A few words about it (optional)" "aria-label" = "Franchise summary" }
  36. button { id = "fe-create" type = "button" class = "primary" "Create franchise" on click(e) { emit newFranchise(e) } }
  37. }
  38. editSection {
  39. h2 { class = "film-heading" "New timeline" }
  40. input { id = "te-name" type = "text" placeholder = "Name, e.g. Star Trek — Prime" autocomplete = "off" "aria-label" = "Timeline name" }
  41. button { id = "te-create" type = "button" class = "primary" "Create timeline" on click(e) { emit newTimeline(e) } }
  42. }
  43. editSection {
  44. h2 { class = "film-heading" "Edit a timeline" }
  45. input { id = "tl-find" type = "search" placeholder = "Timeline name" autocomplete = "off" "aria-label" = "Find a timeline" on input(e) { emit findTyped(e) } }
  46. if (hasFound) {
  47. timelineList { id = "tl-found"
  48. for (t of found) {
  49. a { class = "timeline-link" href = t.href
  50. timelineLinkName { t.name }
  51. timelineLinkCount { t.countText }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. on newFranchise(e) {
  61. r = emit server fedCreateFranchise(document.getElementById('fe-name').value, document.getElementById('fe-summary').value)
  62. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  63. navigate('/franchises/' + r.slug)
  64. }
  65. on newTimeline(e) {
  66. r = emit server fedCreateTimeline(document.getElementById('te-name').value)
  67. if (r == null || r.error != null) { message = r != null ? r.error : 'Could not create it.' return null }
  68. navigate('/timelines/' + r.slug + '/edit')
  69. }
  70. on findTyped(e) {
  71. v = e.target.value
  72. r = emit server fedFindTimelines(v)
  73. if (r == null || document.getElementById('tl-find').value != v) { return null }
  74. found = r.rows
  75. }
  76. // ---- the faces (unique names: hl:web dispatches by name across all files; the trailing `session` is the server's) ----
  77. on server fedCreateFranchise(name, summary, session) {
  78. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  79. return createFranchise(name, summary)
  80. }
  81. on server fedCreateTimeline(name, session) {
  82. if (!isEditorSession(&session)) { return { error = 'only the creator can do that' } }
  83. return createTimeline(&name)
  84. }
  85. // timeline names are public (/franchises lists them all) — no session needed
  86. on server fedFindTimelines(text) {
  87. return { rows = findTimelines(&text) }
  88. }

Branches

Latest commits

  • ee2b677alog: RV39 deployingmre
  • c1c4178cMerge branch 'rv39'mre
  • a016e9abReapply "Merge branch 'rv39'"mre
  • f29e2502log: RV39 gate fixmre
  • d9fce111browser gate #26: exact frame count incl. SL1 people step (hybriel#308)mre
  • ad529ac1log: m572 verdictmre
  • 1b37d404RV39 on hold: hybriel#308mre
  • f9127c68Revert "Merge branch 'rv39'"mre
  • cd39f3d3log: hybriel#308mre
  • 51341d6elog: RV39 deploy startedmre
  • c9e29e06Merge branch 'rv39'mre
  • 0f8d1fdclog: RV39 report, browser 387/2mre
  • 50249b0bRV39: reportmre
  • 10ed9581compose: HL_GC_STATS=1mre
  • 955da19bRV39: re-vendor Hybriel set day39 (source 51e921d7, bin 6b481aa7)mre
  • 64b8d1dclog: RV39 startedmre
  • 1f2df72amission RV39mre
  • 6c1936f9log+status: GC planmre
  • 2846a840log: m569 result, GC hypothesismre
  • b24cd2d5log: Anton on hl:fetch, mission 569mre