Created
July 13, 2015 21:49
-
-
Save acwio/3f54aa0b65ee6872330d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
window.apiClient.api.type('projects').get(window.project_id).then( | |
function(project) { | |
console.log(project); /* retrieve all the pages for the project */ | |
project[0].get('pages').then( | |
function(pages) { | |
/* iterate through each page | |
* and add content to the model */ | |
for(var key in pages){ | |
/* check for presence of 'url_key' */ | |
if('url_key' in pages[key]) { | |
console.log(pages[key].url_key); | |
console.log(pages[key].content); | |
/* add the relevant content */ | |
if (pages[key].url_key == "education") { | |
that.set({'education': pages[key].content}); | |
} | |
else if (pages[key].url_key == "faq") { | |
that.set({'faq': pages[key].content}); | |
} | |
else if (pages[key].url_key == "results") { | |
that.set({'results': pages[key].content}); | |
} | |
else if (pages[key].url_key == "science_case") { | |
that.set({'science_case': pages[key].content}); | |
} | |
} | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment