Created
January 25, 2011 22:48
-
-
Save vinniefranco/795870 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
json.gallery do |g| | |
g.info do |info| | |
info.title @gallery.title if @gallery.title | |
info.image @gallery.image.l(:medium) if @gallery.image | |
info.parent_id @gallery.parent_id if @gallery.parent_id | |
info.root true unless @gallery.parent_id | |
end | |
@gallery.photos.each do |photo| | |
g.photos do |p| | |
p.id photo.id | |
p.title photo.title | |
p.description photo.description | |
p.image photo.image.l(:medium) if photo.image | |
end | |
end | |
@gallery.galleries.each do |gallery| | |
g.galleries do |gg| | |
gg.id gallery.id | |
gg.title gallery.title | |
gg.meta "#{pluralize(gallery.galleries.count, 'Gallery') if gallery.galleries.any?} #{pluralize(gallery.photos.count, 'Photo') if gallery.photos.any?}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment