From fb52546f99bb6a431e94df33e5e0c79160d7c5bb Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Mon, 5 Jan 2015 15:08:29 -0800 Subject: [PATCH] add view to list all users --- app.moon | 5 +++++ views/list.moon | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 views/list.moon diff --git a/app.moon b/app.moon index fd59960..0b17bab 100644 --- a/app.moon +++ b/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 @ diff --git a/views/list.moon b/views/list.moon new file mode 100644 index 0000000..74d38ba --- /dev/null +++ b/views/list.moon @@ -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