gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit7bcfdc227bcfdc22|||PR drop worker edits to conductor recordsmre7bcfdc22/components/project-form.hl

2.6 KB

  1. // components/project-form.hl — the form that opens a project (ticket #20), used by the page `/new-project` (components/new_project.hl) and by
  2. // the "New project" window of the ticket list (components/ticket_list.hl). Any logged-in user with a display name may; they become its first
  3. // admin. The slug (the URL part) is proposed from the title as you type and stays editable — once you edit it, the title no longer overwrites
  4. // it. Title / slug / description can be changed later on the project's settings page. The host hears the result through `onCreated(title,
  5. // settingsHref)`; a refusal is shown under the form. ONE per page (a composed component's members are the page's state).
  6. import { createProject, slugFromTitle, uniqueSlug } from '../lib/projects.hl'
  7. import { writerOfSession } from '../lib/users.hl'
  8. import { messageLook } from '../lib/looks.hl'
  9. onCreated = null
  10. title = ''
  11. slug = ''
  12. slugEdited = false
  13. message = ''
  14. Style {
  15. pMessage = messageLook + { }
  16. }
  17. View {
  18. form { id = "projectform"
  19. on submit(e) {
  20. e.preventDefault()
  21. emit create(e)
  22. }
  23. label { "Title"
  24. input { id = "projecttitle" name = "title" required = "required" maxlength = "100" autocomplete = "off" value = title on input(e) { emit setTitle(e.target.value) } }
  25. }
  26. label { "Slug (the address of the project)"
  27. input { id = "projectslug" name = "slug" maxlength = "100" autocomplete = "off" value = slug on input(e) { emit setSlug(e.target.value) } }
  28. }
  29. button { id = "projectcreate" type = "submit" "Create project" }
  30. p { id = "projectmessage" Style.pMessage message }
  31. }
  32. }
  33. on setTitle(v) {
  34. title = v
  35. if (!slugEdited) {
  36. r = emit server proposeSlug(v)
  37. if (r != null && r.slug != null) { slug = r.slug }
  38. }
  39. }
  40. on setSlug(v) {
  41. slug = v
  42. slugEdited = true
  43. }
  44. on create(e) {
  45. if (title.trim() == '') { return null }
  46. r = emit server makeProject(title, slug)
  47. if (r == null || r.error != null) {
  48. message = r != null ? r.error : 'could not create the project'
  49. return null
  50. }
  51. message = ''
  52. made = r
  53. title = ''
  54. slug = ''
  55. slugEdited = false
  56. if (onCreated != null) { onCreated(made.title, made.settingsHref) }
  57. }
  58. on server proposeSlug(text, session) {
  59. if (hlTypeName(text) != 'String' || text.trim() == '') { return { slug = '' } }
  60. return { slug = uniqueSlug(slugFromTitle(text)) }
  61. }
  62. on server makeProject(title, slug, session) {
  63. w = writerOfSession(session)
  64. if (w.error != null) { return { error = w.error } }
  65. if (hlTypeName(title) != 'String' || hlTypeName(slug) != 'String') { return { error = 'title and slug must be text' } }
  66. r = createProject(w.user, title, slug, '')
  67. if (r.error != null) { return { error = r.error } }
  68. return { title = r.project.title slug = r.project.slug settingsHref = r.project.settingsHref }
  69. }

Branches

Latest commits

  • 7bcfdc22|||PR drop worker edits to conductor recordsmre
  • 2617b6ee|||PR dialogs: host flag cleared on close, dialog gate (tickets#40)mre
  • 6e701371|||PR record partial day72 dialog validationmre
  • b9fb9a91|||PR bind ticket dialog visibility to member flagsmre
  • 0788e65f|||PR re-vendor Hybriel day72mre
  • 8a7f475aMerge branch 'records-t33' into mainTickets
  • e685d0c2|||PR records: PROCEDURES merge callmre
  • b42aff2b|||PR records: GO 2026-11-23, workers L33 O34, PROCEDURES.mdmre
  • ed091d44Merge branch 'records' into mainTickets
  • 180c0cdb|||PR records: ticket move live (M32), hybriel#439mre
  • 497cae7bMerge branch 'm32-move' into mainTickets
  • 772e0696|||PR Allow project admins to move tickets between their projectsmre
  • be92a560Merge branch 'records' into mainTickets
  • 0daf2ea8|||PR records: PR-only workflow, #50 donemre
  • 0185d0b6Log PR 1 deploymre
  • f5bf16e2Mission 031: deploy PR 1mre
  • c69cd5f3Merge branch 'pr-flow' into mainTickets
  • cc56798cLog gitoria PR-only requestmre
  • d876d0b2|||PR README: changes land as PRsmre
  • fd83ac1fconductor: caramboleyo is the user, not owner/creatorApollo