Permalink
Browse files

added num of posts to admin page

  • Loading branch information...
tsloughter committed Oct 16, 2011
1 parent 915e96e commit 6fc020f8565ed6e362c043aecaa53075bd520559
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/admin.opa
View
@@ -1,20 +1,27 @@
package opado.admin
+import opado.todo
import opado.user
+import stdlib.themes.bootstrap
Admin = {{
add_users() =
users = /users
- Map.iter((_, y -> add_user_to_page(y.username, y.fullname)), users)
+ Map.iter(_, y -> items = /todo_items[y.username]
+ add_user_to_page(y.username, y.fullname, Map.size(items)), users)
- add_user_to_page(username: string, fullname: string) =
- line = <li>{username} {fullname}</li>
+ add_user_to_page(username: string, fullname: string, size: int) =
+ line = <tr><td>{username}</td><td>{fullname}</td><td>{size}</td></tr>
Dom.transform([#user_list +<- line])
admin() =
- <div>
- <ul id=#user_list onready={_ -> add_users() } ></ul>
- </div>
+ <table class="zebra-striped" id=#user_list onready={_ -> add_users() } >
+ <thead><tr>
+ <th>Username</th>
+ <th>Fullname</th>
+ <th>Number Posts</th>
+ </tr></thead>
+ </table>
resource : Parser.general_parser(http_request -> resource) =
parser

0 comments on commit 6fc020f

Please sign in to comment.