Skip to content
Browse files

move examples over to the new organization

Signed-off-by: Chris Granger <ibdknox@gmail.com>
  • Loading branch information...
1 parent bf07022 commit a34fcf7815ec354c4c33d31679a20097757f527f @ibdknox committed
Showing with 24 additions and 24 deletions.
  1. +15 −15 README.md
  2. +8 −8 examples/todo.cljs
  3. +1 −1 project.clj
View
30 README.md
@@ -23,14 +23,15 @@ Pinot includes a basic set of dom interaction pieces, including an implementatio
```clojure
(ns client.test
- (:require [pinot.html :as html])
+ (:require [pinot.html :as html]
+ [pinot.dom :as dom])
(:require-macros [pinot.macros :as pm]))
(def x (html/html [:p [:em "hey"]]))
-(html/css x {:color :blue})
-(html/attr x {:class "para"})
-(html/val (html/dom-find "input"))
-(html/append-to (html/dom-find "#content div.body") x)
+(dom/css x {:color :blue})
+(dom/attr x {:class "para"})
+(dom/val (dom/query "input"))
+(dom/append (dom/query "#content div.body") x)
```
Pinot also includes `(defpartial)` like in Noir, however Pinot derives even greater advantage from it:
@@ -42,7 +43,7 @@ Pinot also includes `(defpartial)` like in Noir, however Pinot derives even grea
[:span {:class (when done? "done")}]])
;;You can pass the partial function to dom-find to find all the todos.
-(def all-todos (html/dom-find todo))
+(def all-todos (dom/query todo))
```
###Events
@@ -51,19 +52,19 @@ Events can also take advantage of partials
```clojure
(ns playground.client.test
- (:require [pinot.html :as html]
+ (:require [pinot.dom :as dom]
[pinot.events :as events]))
-(events/on (html/dom-find "li") :click
+(events/on (dom/query "li") :click
(fn [me e]
- (html/css me {:background :blue})
+ (dom/css me {:background :blue})
(events/prevent e)))
;; Partials can also be passed here, allowing you to add an event to every
;; element created through that partial.
(events/on todo :click
(fn [me e]
- (html/css me {:background :blue})
+ (dom/css me {:background :blue})
(events/prevent e)))
```
@@ -73,8 +74,7 @@ Remotes let you make calls to a noir server without having to think about XHR. O
```clojure
(ns playground.client.test
- (:require [pinot.html :as html]
- [pinot.remotes :as remotes])
+ (:require [pinot.remotes :as remotes])
(:require-macros [pinot.macros :as pm]))
(pm/remote (adder 2 5 6) [result]
@@ -114,7 +114,7 @@ Pinot also includes a set of functions for creating visualizations in the style
```clojure
(ns playground.client.test
- (:require [pinot.html :as html]
+ (:require [pinot.dom :as dom]
[pinot.visual :as vis])
(:require-macros [pinot.macros :as mac]))
@@ -127,7 +127,7 @@ Pinot also includes a set of functions for creating visualizations in the style
(mac/defpartial item [x]
[:svg:circle {:r (* 2 x)}])
-(html/append-to (html/dom-find "#wrapper")
+(dom/append (dom/query "#wrapper")
(canvas))
(-> (vis/visual items)
@@ -136,7 +136,7 @@ Pinot also includes a set of functions for creating visualizations in the style
(vis/attr :fill "#777")
(vis/attr :cx #(+ 20 (rand-int 800)))
(vis/attr :cy #(+ 80 (* 10 (mod % 4))))
- (vis/enter (partial html/append-to (html/dom-find "svg"))))
+ (vis/enter (partial dom/append (dom/query "svg"))))
(-> (vis/select item)
(vis/transition 500)
View
16 examples/todo.cljs
@@ -1,7 +1,7 @@
(ns todo.core
(:require [pinot.html :as ph]
[pinot.html.tags :as tags]
- [pinot.validation :as vali]
+ [pinot.dom :as dom]
[pinot.events :as pe])
(:require-macros [pinot.macros :as pm]))
@@ -26,23 +26,23 @@
(tags/text-field "todoText")
(tags/submit-button {:class "submit"} "add todo")))
-(ph/append-to (ph/dom-find "body")
+(dom/append (dom/query "body")
(ph/html
[:div
(todo-form)
[:ul
(map todo-item @todos)]]))
-(pe/on (ph/dom-find "#todoForm") :submit
+(pe/on (dom/query "#todoForm") :submit
(fn [me e]
- (let [text (ph/val (ph/dom-find "#todoText"))
+ (let [text (dom/val (dom/query "#todoText"))
neue (add-todo text)]
- (ph/append-to (ph/dom-find "ul") (todo-item neue))
+ (dom/append (dom/query "ul") (todo-item neue))
(pe/prevent e))))
-(pe/on (ph/dom-find "a.remove") :click
+(pe/on (dom/query "a.remove") :click
(fn [me e]
- (let [id (ph/attr me :id)]
+ (let [id (dom/attr me :id)]
(remove-todo id)
- (ph/unappend me)
+ (dom/unappend me)
(pe/prevent e))))
View
2 project.clj
@@ -1,4 +1,4 @@
-(defproject pinot "0.1.0-SNAPSHOT"
+(defproject pinot "0.1.1-SNAPSHOT"
:description "Pinot - a ClojureScript client-side framework"
:dependencies [[org.clojure/clojure "1.2.1"]
[goog-jar "1.0.0"]])

0 comments on commit a34fcf7

Please sign in to comment.
Something went wrong with that request. Please try again.