add view to list all users
This commit is contained in:
parent
1fe65001c5
commit
fb52546f99
5
app.moon
5
app.moon
|
@ -13,6 +13,11 @@ class App extends lapis.Application
|
|||
"/": =>
|
||||
render: "index"
|
||||
|
||||
[list: "/list"]: =>
|
||||
user = Users\find id: @session.user
|
||||
@list = Users\select!
|
||||
render: true
|
||||
|
||||
[register: "/register"]: capture_errors respond_to {
|
||||
GET: =>
|
||||
@csrf_token = csrf.generate_token @
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import Widget from require "lapis.html"
|
||||
|
||||
class List extends Widget
|
||||
content: =>
|
||||
element "table", ->
|
||||
tr ->
|
||||
td -> text "id"
|
||||
td -> text "name"
|
||||
td -> text "email"
|
||||
td -> text "admin"
|
||||
td -> text "created"
|
||||
td -> text "updated"
|
||||
for _, user in pairs @list
|
||||
tr ->
|
||||
td -> text user.id
|
||||
td -> text user.name
|
||||
td -> text user.email
|
||||
td -> text tostring user.admin
|
||||
td -> text tostring user.created
|
||||
td -> text tostring user.updated
|
Loading…
Reference in New Issue