Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up list view. Append id to links.

  • Loading branch information...
commit 68058d97b885bdb29b21982012d0e51f010784c8 1 parent 486f643
Sean Corfield authored
Showing with 17 additions and 10 deletions.
  1. +17 −10 src/example/controllers/user.clj
27 src/example/controllers/user.clj
View
@@ -32,7 +32,7 @@
(assoc rc :user (get-user-by-id (to-long (:id rc)))))
(defn list [rc]
- rc)
+ (assoc rc :users @users))
(defn save [rc]
;; need redirect!
@@ -63,12 +63,19 @@
(content (:name dept)))))))
(defn list-view [rc nodes]
- (at nodes
- [:tr.zero] (if (empty? @users) identity (substitute ""))
- [:tr.user]
- (clone-for [user @users]
- [:td.id :a] (content (str (:id user)))
- [:td.name :a] (content (str (:first-name user) " " (:last-name user)))
- [:td.email] (content (:email user))
- [:td.department] (content (:name (get-department-by-id (:department-id user))))
- )))
+ (let [users (:users rc)]
+ (at nodes
+ [:tr.zero] (if (empty? users) identity (substitute ""))
+ [:tr.user]
+ (clone-for [user users]
+ [:td.id :a]
+ (do->
+ (append-attr :href (:id user))
+ (content (str (:id user))))
+ [:td.name :a]
+ (do->
+ (append-attr :href (:id user))
+ (content (str (:first-name user) " " (:last-name user))))
+ [:td.email] (content (:email user))
+ [:td.department] (content (:name (get-department-by-id (:department-id user))))
+ [:td.delete :a] (append-attr :href (:id user))))))
Please sign in to comment.
Something went wrong with that request. Please try again.