Created
January 12, 2017 11:09
-
-
Save johnomarkid/c1cff90088418cdc8994440cd1b4580b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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