   :complete-all-toggle
   todo-middleware
   (fn [todos]
-    (let [val (not-every? :done (vals todos))]
+    (let [val (not-every? :done (vals todos))]   ;; toggle true or false?
       (reduce #(assoc-in %1 [%2 :done] val)
               todos
               (keys todos)))))

(ns todomvc.handlers
  (:require
    [todomvc.db    :refer [default-value valid-schema?]]
    [re-frame.core :refer [register-pure-handler
                           path after
                           trim-v

    (assoc db :showing filter-kw)))


(register-pure-handler             ;; given the text, create a new todo
  :add-todo
  todo-middleware
  (fn [todos [text]]               ;; "path" middlware means we are given :todo
    (let [id  (next-id todos)]
      (assoc todos id {:id id :title text :done false}))))

