Created
December 6, 2016 15:12
-
-
Save curtosis/a4c47dae45a81030d011cce550cb0e4a to your computer and use it in GitHub Desktop.
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
(defn row [label input] | |
[:div.row | |
[:div.col-md-2 [:label label]] | |
[:div.col-md-5 input]]) | |
(defn make-user-form-template [ratom] | |
(let [user-count (:user-count @ratom)] | |
[:div | |
[:button {:on-click #(swap! ratom update-in [:user-count] inc)} "Add User"] | |
[:div | |
(for [user (range 1 (inc user-count))] | |
[:div [:span (str "User #" user ":")] | |
(row "user name" [:input {:field :text | |
:id (keyword (str "user." user ".username"))}]) | |
])]])) | |
(defn test-form [doc] | |
(fn [] | |
[:div | |
[:div.page-header [:h1 "Reagent Form"]] | |
[bind-fields (make-user-form-template doc) doc] | |
[:label (str @doc)]])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment