mediapublic / mediapublic

Content and Ideas for the MediaPublic.io website.
GNU General Public License v3.0
32 stars 7 forks source link

Make organizations page pretty #182

Open thequbit opened 8 years ago

thequbit commented 8 years ago

This is the action that came out of #177 .

thequbit commented 8 years ago

@GabeIsman I'm having a hard time figuring out how to get the actual list of returned orgs. I see that collection is used all over, but I'm having a hard time figuring out how to get to the data within that object ( specificity so I can rearrange to group by state ). I thought I had a better grip on how you had abstracted things, but I got lost in the layers, ha.

GabeIsman commented 8 years ago

@thequbit So Backbone mixes underscore collection handling methods right into the collection. So you can do collection.groupBy('state') and you'll get and object like { AL: [...], AK: [...],... }. See http://backbonejs.org/docs/backbone.html#section-146.

GabeIsman commented 8 years ago

Alternately if you want to be more explicit, collection.models is just the array of model objects.