Skip to content

Instantly share code, notes, and snippets.

@tangrammer
Created February 6, 2014 10:42
Show Gist options
  • Save tangrammer/8841925 to your computer and use it in GitHub Desktop.
Save tangrammer/8841925 to your computer and use it in GitHub Desktop.
(ns heroku.index
(:require-macros [cljs.core.async.macros :refer [go]])
(:require
[heroku.util :as util]
[ajax.core :refer [GET POST]]
[om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]
[clojure.browser.repl]
[cljs.core.async :refer [put! chan <!]])
)
(enable-console-print!)
(defn dir [o]
(.dir js/console o)
)
(def app-state (atom {:title "Shared example" :nav "the nav"}))
(println "welcome to app!")
(defn menu [app owner]
(reify
om/IRender
(render [this]
(dom/div #js {:id "menu" :style #js{:float "left" :backgroundColor "orange" :color "white"}}
(dom/h3 nil (:nav app))
)))
)
(defn content [app owner]
(reify
om/IRender
(render [this]
(dom/div #js {:id "content" :style #js {:float "left" :backgroundColor "gray" :width "400px"}}
(dom/h2 nil "Contact list")
(dom/h3 nil (:title @app)))
)))
(defn container [app owner]
(reify
om/IRender
(render [this]
(dom/div #js {:id "container" :style #js {:width "500px" :backgroundColor "white"}}
(dom/h2 nil "Container")
(om/build menu app )
(om/build content app )
))))
(om/root app-state container (. js/document (getElementById "my-app")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment