add view to list all users

This commit is contained in:
Sam Dodrill 2015-01-05 15:08:29 -08:00
parent 1fe65001c5
commit fb52546f99
2 changed files with 25 additions and 0 deletions

View File

@ -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 @

20
views/list.moon Normal file
View File

@ -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