SHARE
TWEET

Untitled

a guest Jan 12th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defui Sections
  2.   static om/IQueryParams
  3.   (params [this]
  4.     {:pouchq {}})
  5.   static om/IQuery
  6.   (query [this]
  7.     '({:learn/sections [:learn/sections]} ?pouchq))
  8.   Object
  9.   (componentWillUpdate [this next-props _]
  10.    (let [vid-title (get-in next-props [:learn/active :video :title])
  11.          base-sec (str "section_" vid-title "_")
  12.          new-params {:pouchq {:startkey base-sec
  13.                               :endkey (str base-sec "\uffff")
  14.                               :include_docs true}}]
  15.     (om/update-query! this (fn [{:keys [query params] :as q}]
  16.                              (assoc q :params new-params))
  17.  
  18.   (render [this]
  19.     (dom/div nil "hey there")))
  20.  
  21. (def sections (om/factory Sections))
  22.  
  23. (defui ActiveLearn
  24.   static om/IQueryParams
  25.   (params [this]
  26.    {:pouchq {:startkey "active-data"
  27.              :endkey "active-data"
  28.              :include_docs true}})
  29.   static om/IQuery
  30.   (query [this]
  31.     '({:learn/active [:learn/active]} ?pouchq))
  32.   Object
  33.   (render [this]
  34.     (dom/div nil "hey there")))
  35.  
  36. (def active-learn (om/factory ActiveLearn))
  37.  
  38. (defui View
  39.  static om/IQuery
  40.  (query [this]
  41.   [:app/learn (om/get-query ActiveLearn)
  42.               (om/get-query Sections)])
  43.  Object
  44.  (render [this]
  45.   (dom/div nil)
  46.   (sections (om/props this))))
RAW Paste Data
Top