admin.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {{define "admin"}}
  2. data := struct {
  3. Users []gamelangpb.User
  4. Sessions map[string]gamelangpb.User
  5. }{
  6. Users: ws.usermanager.List(),
  7. Sessions: ws.sessions,
  8. }
  9. <!DOCTYPE html>
  10. <html lang="en">
  11. <head>
  12. <meta charset="utf-8">
  13. <title>admin</title>
  14. </head>
  15. <body>
  16. <h1> Admin </h1><br>
  17. <h2> current users </h2><br>
  18. <table style="width:50%">
  19. <tr>
  20. <th>Username</th>
  21. <th>Admin</th>
  22. </tr>
  23. {{range $user := .Users }}
  24. <tr>
  25. <td>{{$user.Name}}</td>
  26. <td>{{$user.Admin}}</td>
  27. </tr>
  28. {{end}}
  29. </table>
  30. <h2> sessions </h2><br>
  31. <table style="width:50%">
  32. <tr>
  33. <th>Session</th>
  34. <th>Username</th>
  35. </tr>
  36. {{range $session, $user := .Sessions }}
  37. <tr>
  38. <td>{{$session}}</td>
  39. <td>{{$user.Name}}</td>
  40. </tr>
  41. {{end}}
  42. </table>
  43. <h2> worlds </h2><br>
  44. <table style="width:50%">
  45. <tr>
  46. <th>World</th>
  47. <th>User</th>
  48. </tr>
  49. {{range $world := .Worlds}}
  50. <tr>
  51. <td>{{$world.Name}}</td>
  52. <td>{{range $user := $world.Users}}{{$user.Name}} {{end}}</td>
  53. </tr>
  54. {{end}}
  55. </table>
  56. </body>
  57. </html>
  58. {{end}}