Skip to content

Instantly share code, notes, and snippets.

@johnomarkid
Created January 12, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnomarkid/c1cff90088418cdc8994440cd1b4580b to your computer and use it in GitHub Desktop.
Save johnomarkid/c1cff90088418cdc8994440cd1b4580b to your computer and use it in GitHub Desktop.
(defui Sections
static om/IQueryParams
(params [this]
{:pouchq {}})
static om/IQuery
(query [this]
'({:learn/sections [:learn/sections]} ?pouchq))
Object
(componentWillUpdate [this next-props _]
(let [vid-title (get-in next-props [:learn/active :video :title])
base-sec (str "section_" vid-title "_")
new-params {:pouchq {:startkey base-sec
:endkey (str base-sec "\uffff")
:include_docs true}}]
(om/update-query! this (fn [{:keys [query params] :as q}]
(assoc q :params new-params))
(render [this]
(dom/div nil "hey there")))
(def sections (om/factory Sections))
(defui ActiveLearn
static om/IQueryParams
(params [this]
{:pouchq {:startkey "active-data"
:endkey "active-data"
:include_docs true}})
static om/IQuery
(query [this]
'({:learn/active [:learn/active]} ?pouchq))
Object
(render [this]
(dom/div nil "hey there")))
(def active-learn (om/factory ActiveLearn))
(defui View
static om/IQuery
(query [this]
[:app/learn (om/get-query ActiveLearn)
(om/get-query Sections)])
Object
(render [this]
(dom/div nil)
(sections (om/props this))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment