   "Wraps a user-provided parser read function for Om Next by
    special-casing queries for screen-based routing information
    (such as :workflo/screen, :workflo/forms and
-   :workflo/layout.)"
+   :workflo/sections.)"
   [read env key params]
   (case key
-    :workflo/screen (read-screen read env key params)
-    :workflo/forms  (read-forms read env key params)
-    :workflo/layout (read-layout read env key params)
+    :workflo/screen   (read-screen read env key params)
+    :workflo/forms    (read-forms read env key params)
+    :workflo/sections (read-sections read env key params)
     (read env key params)))
 
 (defn parser


;;;; Wrapping application

(defn- realize-layout
  "Realizes the results of a layout query by instantiating
   all returned views with their props / query results."
  [layout]
  (zipmap (keys layout)
          (map (fn [{:keys [view props] :as item}]
                 (view (vary-meta props assoc :om-path
                                  (-> item meta :om-path))))
               (vals layout))))

(defn camel-cased-prop-map
  "Convert a Clojure map with Om Next properties to a map

  [_ {:keys [screen]} _ _]
  {:value (:forms screen)})

(defn read-sections
  "Executes all queries for views in the sections of the
   active screen."
  [_ {:keys [parser query screen] :as env} _ _]
  {:value
   (reduce (fn [res section-item]
             (let [[section query] (first section-item)]
               (assoc res section
                      {:view  (-> screen :sections section resolve-view :factory)
                       :props (parser (dissoc env :path) query nil)})))
           {} query)})

