Created
March 6, 2013 15:09
-
-
Save corbanbrook/5099925 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
| var navItems = _.chain(Pressly.Manifest.sections).select(function(section) { | |
| // Select all the sections which are not shallow and.. | |
| return !section.shallow && section.assets.length > 0; | |
| }).collect(function(section) { | |
| // Collect assets from these section which includes.. | |
| return _(section.assets).detect(function(asset) { | |
| // The first article asset it finds that .. | |
| return asset.type === "article" && asset.children && _(asset.children).any(function(child) { | |
| // Has a a child asset with type of image | |
| return child.type === "image"; | |
| }); | |
| }) || _(section.assets).first(); // No assets with images were found so use the first asset and use a place holder image | |
| }).value(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment