 	[:h1 (str "User " id " Detail Page")]
 	[:hr]))
 
+(defpartial user-line [{:keys [user_id username firstname lastname]}]
+	[:tr
+		[:td user_id]
+		[:td [:a {:href (url-for user_show {:id user_id})} username]]
+		[:td firstname]
+		[:td lastname]
+	])
+
+
 (defpage users_index "/admin/users" {} (common/layout
 	[:h1 "Users"]
 	[:hr]
-	(let [users (select admin/user) user (first users)]
+	(let [users (select admin/user)]
 		[:table
 			[:thead [:tr
 				[:th "id"]

(ns clojento.views.admin
  (:require [clojento.models.admin :as admin] [clojento.views.common :as common])
  (:use [noir.core :only [defpage url-for]]
        [noir.response :only [redirect]]
        [korma.core :only [select fields]]
        [hiccup.core :only [html]]))

	[:h1 (str "Role " id " Detail Page")]
	[:hr]))

(defpartial role-line [{id :role_id, name :role_name, type :role_type}]
	[:tr
		[:td id]
		[:td [:a {:href (url-for role_show {:id id})} name]]
		[:td type]
	])

(defpage roles_index "/admin/roles" {} (common/layout
	[:h1 "Roles"]
	[:hr]
	(let [roles (select admin/role)]
		[:table
			[:thead [:tr
				[:th "id"]
				[:th "name"]
				[:th "type"]
			]]
			[:tbody (map role-line roles) ]
		])))

