gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitbd76cfa6bd76cfa6connect: format Style with nested language rulesmrebd76cfa6/components/inbox.hl

3.3 KB

  1. // components/inbox.hl — `/inbox` (ticket #20): the tickets ASSIGNED TO YOU, in two lists: pending and
  2. // review, across all projects. Personal: needs a login. Live: a ticket assigned to you, or moving into
  3. // or out of those states, appears / disappears without a reload.
  4. parent './main.hl'
  5. import { inboxRows } from '../lib/tickets.hl'
  6. import { siteName } from '../project.hl'
  7. import { userOfSession } from '../lib/users.hl'
  8. import { hintLook, subjectLook, ticketsLook } from '../lib/looks.hl'
  9. session = null
  10. myId = userOfSession(session) != null ? userOfSession(session).id : ''
  11. loggedIn = myId != ''
  12. loggedOut = myId == ''
  13. box = inboxRows(userOfSession(session))
  14. pending = box.pending
  15. review = box.review
  16. noPending = pending.length == 0
  17. noReview = review.length == 0
  18. __title = siteName + ' | inbox'
  19. Style {
  20. '#loginhint' = hintLook + { }
  21. olTickets = ticketsLook + { }
  22. aSubject = subjectLook + { }
  23. '#reviewbox' {
  24. display = 'grid'
  25. gap = '.5rem'
  26. h2 {
  27. margin = '0'
  28. fontSize = '1.1rem'
  29. }
  30. }
  31. '#pendingbox' {
  32. display = 'grid'
  33. gap = '.5rem'
  34. h2 {
  35. margin = '0'
  36. fontSize = '1.1rem'
  37. }
  38. }
  39. }
  40. View {
  41. ticketBoard {
  42. h1 { id = "heading" "Inbox" }
  43. if (loggedOut) { p { id = "loginhint" "Log in with ident (top right) to see the tickets assigned to you." } }
  44. if (loggedIn) {
  45. section { id = "reviewbox"
  46. h2 { "Review" }
  47. if (noReview) { p { id = "reviewempty" class = "empty" "Nothing is waiting for your review." } }
  48. ol { id = "review" Style.olTickets
  49. for (row of review) {
  50. li {
  51. ticketState { class = row.stateSlug row.state }
  52. a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }
  53. ticketMeta {
  54. a { href = row.projectHref row.projectTitle }
  55. time { row.updated }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. section { id = "pendingbox"
  62. h2 { "Pending" }
  63. if (noPending) { p { id = "pendingempty" class = "empty" "Nothing is pending for you." } }
  64. ol { id = "pending" Style.olTickets
  65. for (row of pending) {
  66. li {
  67. ticketState { class = row.stateSlug row.state }
  68. a { Style.aSubject href = row.href ticketRef { row.ref } row.subject }
  69. ticketMeta {
  70. a { href = row.projectHref row.projectTitle }
  71. time { row.updated }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. }
  78. }
  79. }
  80. // a row goes to the top of its list if it is assigned to me and in that state, and out of both otherwise
  81. place = (row) => {
  82. p = []
  83. r = []
  84. if (row.assigneeId == myId && row.state == 'pending') { p.push(row) }
  85. if (row.assigneeId == myId && row.state == 'review') { r.push(row) }
  86. for (x of pending) { if (x.id != row.id) { p.push(x) } }
  87. for (x of review) { if (x.id != row.id) { r.push(x) } }
  88. pending = p
  89. review = r
  90. noPending = p.length == 0
  91. noReview = r.length == 0
  92. }
  93. on client ticketCreated(row) { place(row) }
  94. on client ticketEvent(ticketId, ev, row) { place(row) }
  95. on client signedIn(tag, info) {
  96. b = emit server myInbox()
  97. if (b != null && b.pending != null) {
  98. pending = b.pending
  99. review = b.review
  100. noPending = b.pending.length == 0
  101. noReview = b.review.length == 0
  102. myId = b.me
  103. loggedIn = true
  104. loggedOut = false
  105. }
  106. }
  107. on client signedOut(tag) {
  108. myId = ''
  109. loggedIn = false
  110. loggedOut = true
  111. }
  112. on server myInbox(session) {
  113. u = userOfSession(session)
  114. if (u == null) { return { error = 'log in first' } }
  115. b = inboxRows(u)
  116. return { pending = b.pending review = b.review me = u.id }
  117. }

Branches

Latest commits

  • bd76cfa6connect: format Style with nested language rulesmre
  • 01fad593inbox: format Style with nested language rulesmre
  • 79dc9392you: format Style with nested language rulesmre
  • 78073baamain: format Style with nested language rulesmre
  • 5499c290Sync theme unchanged from layouts 17e0f03mre
  • fd33ee21Sync reviewed components from 8176eb1mre
  • 93348453Re-vendor tickets to Hybriel set day35mre
  • a4123831tickets#42: the /connect and /login/callback error pages are app pages: the function routes redirect to /connect/failed/<code> and /login/failed/<code> (components/problem.hl, sentences in lib/problems.hl), htmlPage and its hand-written stylesheet are gone; gate tests/error-pages.mjsmre
  • cefc7b4atickets: a startup error prints its message before exit 1 (hybriel#247)mre
  • 99bd6570tickets: lib/migrate.hl writes no table of another topic any more: projects.hl rewriteSlug / addProjectNamed / hasMembers, tickets.hl moveToProject / ticketRecords / ticketRecordsOf, events.hl renameStates / eventRecords / eventRecordsOf; the migration calls them (tickets#47)mre
  • b57161e3tickets: the markup names its own rules (Style.pMessage, Style.olTickets, ...) instead of hand-written class strings that copy a stylesheet rule; the shared bodies sit in lib/looks.hl (tickets#38)mre
  • f767b24dtickets: 111 needless let became plain declarations (3 in ticket.hl, ticket_list.hl, comments.hl and 108 never-reassigned, not captured loop-body ones); the 212 really reassigned lets stay (tickets#44)mre
  • 16c0d3b5tickets: the modal window is phone first: the full-screen sheet is the base rule, the centred window sits in the min-width 60rem block (tickets#39)mre
  • 090ee809tickets: every component's styles in its own nested Style {} block; styles.hl keeps only the theme inherit, the accent and the site-wide rules (tickets#36)mre
  • d395763ftickets: ident-access gate ports 8769/8768 (8797 is taken on loreana)mre
  • afb9a403tickets: an ident access key (Authorization: Bearer idt_…) works in the API (ident#27 app side): lib/ident-access.hl copied from components, read keys GET only, ident down 503; gate tests/ident-access-tickets.mjsmre
  • 48c1ba79tickets: md-paste-files gate with the file manager casesmre
  • f04afc43tickets: MdEditor from components 59704ce (a file manager copy still attaches, pipe rows, tickets#49)mre
  • 06599fa0tickets: MdEditor from components b0f1ec2 (a clipboard with text always pastes the text, tickets#49); real Ctrl+V gatemre
  • 2e1b116ftickets: re-vendor Hybriel master acaceaf3 (framework ec8d6c1d): plugins/web patch queue while a page is built, anonymous session cookies refresh; gate waits for the comment editors to draw (W174) and clicks the form editor when it stands still; security gate: main's code runs on its own binary, lazy-session cookie checksmre