                      :id (str table-id "-selected")}
                 [:td id [:a {:id (str "row-" id)}]] [:td lead-organisations] [:td name] [:td created-at]]))]])))))
 
+(defn projects-div [tables owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [{:keys [programmes projects]} tables
+            history (om/get-shared owner :history)]
+        (html [:div {:id "projects" :class (if (:active projects) "hidden" "")}
+               [:h2 "Projects"]
+               [:ul {:class "breadcrumb"}
+                [:li [:a
+                      {:onClick (fn projects-div-history-change
+                                  [_ _]
+                                  (history/update-token-ids! history :programmes nil))}
+                      (title-for programmes)]]]
+               (om/build table projects {:opts {:histkey :projects}})])))))
+      
 (defn programmes-tab [data owner]
   (let [{tables :tables} data]
     (reify

                                                       selection-key
                                                       template
                                                       nav-event)]
      ;; (println "Nav Event: " nav-event)
      ;; (println "To Clear: " to-clear)
      ;; (println "URI: " uri " for path " path " selection-key " selection-key)
      (doseq [c to-clear]
        (om/update! data (vector c :data) [])
        (om/update! data (vector c :selected) nil))
      

        ;; TODO sort out duplication here, wrap (on/build table ...) calls probably.
        ;;
        (let [{:keys [programmes projects properties devices sensors sensor-select]} tables]
          ;; (println "Tables: " tables)
          (html [:div
                 ;;(om/build clear-tables data)
                 ;; [:div {:id "programmes"}
                 ;;  [:h1 (:title data)]
                 ;;  (om/build programmes-table programmes)]
                 (om/build programmes-div programmes)

                 ;; [:div {:id "projects"}
                 ;;  [:h2 "Projects"]
                 ;;  [:ul {:class "breadcrumb"}
                 ;;   [:li (title-for programmes)]]
                 ;;  (om/build table projects {:opts {:histkey :projects}})]
                 (om/build projects-div tables)

                 [:h2  {:id "properties"} "Properties"]
                 [:ul {:class "breadcrumb"}
