gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit47e516af47e516afident#33 ident#34: the identity form's avatar rules move into identityform.hl; the preview and Remove button are hidden with the hidden attribute instead of built class strings (avatarPreviewClass, avatarRemoveClass gone)mre47e516af/components/identitylist.hl

2.4 KB

  1. // components/identitylist.hl — THE ACCOUNT'S IDENTITIES (ident#40.3), placed by components/home.hl on `/`: the list with "Used in…", Edit
  2. // and Delete, and the New identity button. The host passes in the rows (identities, lib/identities.hl identityRows). This component owns
  3. // the delete (face dropIdentity); the form is the host's other component (identityform.hl), so New and Edit go up:
  4. // $parent.openNew() and $parent.openEdit(id). The host shows the messages: $parent.status(message, notice), and takes the new rows with
  5. // $parent.identitiesDeleted(rows, id).
  6. import { accountOfSession } from '../lib/accounts.hl'
  7. import { identityRows, deleteIdentity } from '../lib/identities.hl'
  8. identities = []
  9. View {
  10. section { id = "identitiessection"
  11. sectionHead {
  12. h1 { "Your identities" }
  13. button { id = "newidentity" type = "button" class = "small" "New identity" on click(e) { $parent.openNew() } }
  14. }
  15. ul { id = "identities"
  16. for (row of identities) {
  17. li { class = "identity"
  18. if (row.hasAvatar) { img { class = "avatar" src = row.avatar alt = "" width = "32" height = "32" } }
  19. identityMain {
  20. identityLabel { row.label }
  21. identityShortId { class = "shortid" row.shortId }
  22. if (row.isDefault) { defaultBadge { "default" } }
  23. identityDetails { row.details }
  24. }
  25. identityActions {
  26. a { class = "used" href = row.usedHref "Used in…" }
  27. button { type = "button" class = "quiet small edit" value = row.id "Edit" on click(e) { $parent.openEdit(e.target.value) } }
  28. if (row.canDelete) { button { type = "button" class = "quiet small danger delete" value = row.id "Delete" on click(e) { emit remove(e.target.value) } } }
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
  35. rowOf = (id) => {
  36. for (row of identities) { if ('' + row.id == '' + id) { return row } }
  37. return null
  38. }
  39. on remove(id) {
  40. $parent.status('', '')
  41. row = rowOf(id)
  42. if (row == null) { return null }
  43. if (!confirm('Delete the identity “' + row.label + '”?')) { return null }
  44. r = emit server dropIdentity('' + id)
  45. if (r == null) {
  46. $parent.status('the server did not answer — try again', '')
  47. return null
  48. }
  49. if (r.error != null) {
  50. $parent.status(r.error, '')
  51. return null
  52. }
  53. $parent.identitiesDeleted(r.identities, '' + id)
  54. }
  55. on server dropIdentity(id, session) {
  56. let me = accountOfSession(&session)
  57. if (me == null) { return { error = 'you are not signed in' } }
  58. r = deleteIdentity(me.id, id)
  59. if (r.error != null) { return r }
  60. return { deleted = r.deleted identities = identityRows(me.id) }
  61. }

Branches

Latest commits

  • 47e516afident#33 ident#34: the identity form's avatar rules move into identityform.hl; the preview and Remove button are hidden with the hidden attribute instead of built class strings (avatarPreviewClass, avatarRemoveClass gone)mre
  • 5cb5cf0eident#33: the code field's look moves into codestep.hl's Stylemre
  • f421cd60ident#33: the shell's own rules (user menu address, offline note, network probe) move into main.hl's Stylemre
  • c512fb96Merge branch 'f4-homesplit' into mainIdent
  • 07d1717c|||PR ident#40 home.hl is split into components, one per area: email step, identity form, identity list, app identity choice, time zone; each moves its faces with it, the email step is shared with embed.hl (#40.3, rest of #40.2)mre
  • 59e8fcc1ident#40.3: the app's identity choice is one component (components/chooseidentity.hl); its face chooseIdentity moves with itmre
  • e23efdfcident#40.3: the identity list is one component (components/identitylist.hl); its delete and face dropIdentity move with itmre
  • e24b59a6ident#40.3: the time zone is one component (components/timezone.hl); its face changeTimeZone moves with itmre
  • 8cbc5717ident#40.3: the email step is one component (components/emailstep.hl) placed by home.hl and embed.hlmre
  • 6fad3bd2Merge branch 'f3-codestep' into mainIdent
  • 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
  • c28bddeeMerge branch 'f2-shell' into mainIdent
  • c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
  • 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
  • 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
  • edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
  • 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre
  • c7eef14aMerge branch 'nv1-navigate' into mainIdent
  • 644f9775|||PR ident#36 navigate() instead of window.location in the shell, start shell and homemre
  • 4ca2f921deploy.sh: tar --hard-dereference so backups hold no hard linksmre