Created
March 30, 2012 05:23
-
-
Save tobyhede/2246801 to your computer and use it in GitHub Desktop.
cljs and crate/hiccup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defhtml db-list [databases] | |
[:table{:class "table table-bordered table-striped"} | |
[:thead | |
[:tr | |
[:th "Database"] | |
[:th "Collections"] | |
[:th "Storage"] | |
[:th "Allocated"] | |
[:th "Actions"] | |
] | |
] | |
[:tbody | |
(for [db databases] | |
(db-list-row db) | |
) | |
] | |
] | |
) | |
(defelem table [columns body] | |
[:table{:class "table table-bordered table-striped"} | |
[:thead | |
[:tr | |
(for [col-name columns] | |
[:th col-name]) | |
] | |
] | |
[:tbody body] | |
] | |
) | |
(defhtml db-list [databases] | |
(table | |
["Database" "Collections" "Storage" "Allocated" "Actions"] | |
(for [db databases] | |
(db-list-row db) | |
) | |
) | |
) | |
(get-json url | |
(fn [data status] | |
(inner $content-pane (db-show (aget data "collections"))) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment