Remove dead code (mostly unused requires)
This commit is contained in:
parent
f7b79a5e2a
commit
cc3dbdca62
6 changed files with 31 additions and 39 deletions
|
@ -1,7 +1,6 @@
|
||||||
(ns grub.db
|
(ns grub.db
|
||||||
(:require [monger.core :as m]
|
(:require [monger.core :as m]
|
||||||
[monger.collection :as mc]
|
[monger.collection :as mc]
|
||||||
[monger.operators :as mo]
|
|
||||||
[clojure.core.async :as a :refer [<! >! chan go]]))
|
[clojure.core.async :as a :refer [<! >! chan go]]))
|
||||||
|
|
||||||
(def collection "grub-lists")
|
(def collection "grub-lists")
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
(ns grub.websocket
|
(ns grub.websocket
|
||||||
(:require [grub.db :as db]
|
(:require [org.httpkit.server :as httpkit]
|
||||||
[org.httpkit.server :as httpkit]
|
|
||||||
[clojure.core.async :as a :refer [<! >! chan go]]
|
[clojure.core.async :as a :refer [<! >! chan go]]
|
||||||
[cognitect.transit :as t])
|
[cognitect.transit :as t])
|
||||||
(:import [java.io ByteArrayInputStream ByteArrayOutputStream]))
|
(:import [java.io ByteArrayInputStream ByteArrayOutputStream]))
|
||||||
|
|
||||||
(defn disconnected [status ws-channel to from]
|
|
||||||
(println "Client disconnected:" (.toString ws-channel) "with status" status)
|
|
||||||
(a/close! to)
|
|
||||||
(a/close! from))
|
|
||||||
|
|
||||||
(defn write-msg [msg]
|
(defn write-msg [msg]
|
||||||
(let [out (ByteArrayOutputStream. 4096)
|
(let [out (ByteArrayOutputStream. 4096)
|
||||||
writer (t/writer out :json)]
|
writer (t/writer out :json)]
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
>remote (chan)
|
>remote (chan)
|
||||||
events (chan)
|
events (chan)
|
||||||
view-state (view/render-app state/empty-state render-states new-states)
|
view-state (view/render-app state/empty-state render-states new-states)
|
||||||
ws (websocket/connect pending-msg >remote events)
|
ws (websocket/connect pending-msg >remote events)]
|
||||||
agent-states (sync/sync-client! >remote events new-states states)]
|
(sync/sync-client! >remote events new-states states)
|
||||||
(add-watch states :render (fn [_ _ old new]
|
(add-watch states :render (fn [_ _ old new]
|
||||||
(when-not (= old new)
|
(when-not (= old new)
|
||||||
(a/put! render-states (state/get-latest new)))))
|
(a/put! render-states (state/get-latest new)))))
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
(ns grub.view.grub
|
(ns grub.view.grub
|
||||||
(:require [grub.view.dom :as dom]
|
(:require [grub.view.dom :as dom]
|
||||||
[om.core :as om :include-macros true]
|
[om.core :as om :include-macros true]
|
||||||
[sablono.core :as html :refer-macros [html]]
|
[sablono.core :refer-macros [html]]
|
||||||
[cljs.core.async :as a :refer [<! put! chan]]
|
[cljs.core.async :as a :refer [<! put! chan]]
|
||||||
[cljs-uuid.core :as uuid])
|
[cljs-uuid.core :as uuid])
|
||||||
(:require-macros [grub.macros :refer [log logs]]
|
(:require-macros [grub.macros :refer [log logs]]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(:require [grub.view.dom :as dom]
|
(:require [grub.view.dom :as dom]
|
||||||
[grub.view.grub :as grub-view]
|
[grub.view.grub :as grub-view]
|
||||||
[om.core :as om :include-macros true]
|
[om.core :as om :include-macros true]
|
||||||
[sablono.core :as html :refer-macros [html]]
|
[sablono.core :refer-macros [html]]
|
||||||
[cljs.core.async :as a :refer [<! chan]])
|
[cljs.core.async :as a :refer [<! chan]])
|
||||||
(:require-macros [grub.macros :refer [log logs]]
|
(:require-macros [grub.macros :refer [log logs]]
|
||||||
[cljs.core.async.macros :refer [go go-loop]]))
|
[cljs.core.async.macros :refer [go go-loop]]))
|
||||||
|
@ -32,33 +32,32 @@
|
||||||
:remove-grub-ch (chan)})
|
:remove-grub-ch (chan)})
|
||||||
om/IRenderState
|
om/IRenderState
|
||||||
(render-state [this {:keys [new-grub-text remove-grub-ch] :as state}]
|
(render-state [this {:keys [new-grub-text remove-grub-ch] :as state}]
|
||||||
(let [add (om/get-shared owner :grub-add)]
|
(html
|
||||||
(html
|
[:div
|
||||||
[:div
|
[:h3 "Grub List"]
|
||||||
[:h3 "Grub List"]
|
[:div.input-group.add-grub-input-form
|
||||||
[:div.input-group.add-grub-input-form
|
[:span.input-group-btn
|
||||||
[:span.input-group-btn
|
[:input.form-control#add-grub-input
|
||||||
[:input.form-control#add-grub-input
|
{:type "text"
|
||||||
{:type "text"
|
:placeholder "What do you need?"
|
||||||
:placeholder "What do you need?"
|
:value new-grub-text
|
||||||
:value new-grub-text
|
:on-key-up #(when (dom/enter-pressed? %)
|
||||||
:on-key-up #(when (dom/enter-pressed? %)
|
|
||||||
(add-grub owner grubs new-grub-text))
|
(add-grub owner grubs new-grub-text))
|
||||||
:on-change #(om/set-state! owner :new-grub-text (dom/event-val %))}]]
|
:on-change #(om/set-state! owner :new-grub-text (dom/event-val %))}]]
|
||||||
[:button.btn.btn-primary
|
[:button.btn.btn-primary
|
||||||
{:id "add-grub-btn"
|
{:id "add-grub-btn"
|
||||||
:type "button"
|
:type "button"
|
||||||
:on-click #(add-grub owner grubs new-grub-text)}
|
:on-click #(add-grub owner grubs new-grub-text)}
|
||||||
[:span.glyphicon.glyphicon-plus#add-grub-btn]]]
|
[:span.glyphicon.glyphicon-plus#add-grub-btn]]]
|
||||||
[:ul#grub-list.list-group
|
[:ul#grub-list.list-group
|
||||||
(for [grub (sort-grubs grubs)]
|
(for [grub (sort-grubs grubs)]
|
||||||
(om/build grub-view/view grub {:key :id :opts {:remove-ch remove-grub-ch}}))]
|
(om/build grub-view/view grub {:key :id :opts {:remove-ch remove-grub-ch}}))]
|
||||||
[:button.btn.pull-right
|
[:button.btn.pull-right
|
||||||
{:id "clear-all-btn"
|
{:id "clear-all-btn"
|
||||||
:class (when (empty? grubs) "hidden")
|
:class (when (empty? grubs) "hidden")
|
||||||
:type "button"
|
:type "button"
|
||||||
:on-click #(om/update! grubs nil {} :local)}
|
:on-click #(om/update! grubs nil {} :local)}
|
||||||
"Clear all"]])))
|
"Clear all"]]))
|
||||||
om/IWillMount
|
om/IWillMount
|
||||||
(will-mount [_]
|
(will-mount [_]
|
||||||
(let [add-grubs-ch (om/get-shared owner :add-grubs-ch)
|
(let [add-grubs-ch (om/get-shared owner :add-grubs-ch)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[grub.view.grub :as grub-view]
|
[grub.view.grub :as grub-view]
|
||||||
[grub.util :as util]
|
[grub.util :as util]
|
||||||
[om.core :as om :include-macros true]
|
[om.core :as om :include-macros true]
|
||||||
[sablono.core :as html :refer-macros [html]]
|
[sablono.core :refer-macros [html]]
|
||||||
[cljs.core.async :as a :refer [<! put! chan]]
|
[cljs.core.async :as a :refer [<! put! chan]]
|
||||||
[cljs-uuid.core :as uuid])
|
[cljs-uuid.core :as uuid])
|
||||||
(:require-macros [grub.macros :refer [log logs]]
|
(:require-macros [grub.macros :refer [log logs]]
|
||||||
|
|
Loading…
Reference in a new issue