Created
November 14, 2013 19:33
-
-
Save aamedina/7472905 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 render-event-enter [r [_ path transform-name messages] input-queue] | |
| (let [control-id (render/get-id r (conj path "control")) | |
| button-id (render/new-id! r (conj path "control" transform-name))] | |
| (let [messages (map (partial msg/add-message-type transform-name) messages) | |
| syms (msg/message-params messages)] | |
| (assert input-queue "Input-Queue is nil") | |
| (d/append! (d/by-id control-id) | |
| (str "<a class='btn btn-primary' style='margin-top:5px;margin-right:5px;' " | |
| "id='" button-id "'>" | |
| (str transform-name) | |
| "</a>")) | |
| (if (seq syms) | |
| ;; Open the modal dialog for this event | |
| (event/listen! (d/by-id button-id) | |
| :click | |
| (fn [e] | |
| (event/prevent-default e) | |
| (modal-collect-input r input-queue path transform-name messages))) | |
| ;; Gather input and send messages | |
| (events/send-on-click (d/by-id button-id) | |
| input-queue | |
| (get-missing-input (mapv #(assoc % :from :ui) messages)))) | |
| (render/on-destroy! r path #(event/unlisten! (d/by-id button-id) :click))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment