 ;; Left menu
 
 (defn update-current [event app]
-  (let [title (.. event -target -textContent)
-        input (p/get-document title)]
-    (om/update! app :input input)
-    (om/update! app :title title)
-    (om/update! app :last-title title)
-    (om/update! app :last-input input)))
+  (let [title (.. event -target -textContent)]
+    (put! (:channel @app) [:change title])))
 
 (defn delete-click [title app]
   (put! (:channel @app) [:remove title]))


;; The main app

(defn save-document [app]
  (om/update! app :last-input (:input @app))
  (om/update! app :last-title (:title @app))

  (case command
    :save   (save-document app)
    :rename (rename-document app params)
    :remove (remove-document app params)
    :change (change-document app params)))

(defn listen [el type app]
  (events/listen el type
