Skip to content

Instantly share code, notes, and snippets.

@tobyhede
Created March 30, 2012 05:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobyhede/2246801 to your computer and use it in GitHub Desktop.
Save tobyhede/2246801 to your computer and use it in GitHub Desktop.
cljs and crate/hiccup
(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