Skip to content
Browse files

More JSON responses for new iPhone app.

  • Loading branch information...
1 parent d43d730 commit 79bab4bd75e8d0e853f97d8c01684eb04ab5a08c @kueda kueda committed Mar 14, 2012
Showing with 21 additions and 1 deletion.
  1. +3 −1 app/controllers/projects_controller.rb
  2. +14 −0 app/controllers/shared/lists_module.rb
  3. +4 −0 app/models/taxon.rb
View
4 app/controllers/projects_controller.rb
@@ -129,7 +129,9 @@ def by_login
format.json do
render :json => @project_users.to_json(:include => {
:user => {:only => :login},
- :project => {:methods => [:icon_url]}
+ :project => {
+ :methods => [:icon_url],
+ :include => :project_list}
})
end
end
View
14 app/controllers/shared/lists_module.rb
@@ -92,6 +92,20 @@ def show
prevent_caching
render :status => :accepted, :text => "This file takes a little while to generate. It should be ready shortly at #{request.url}"
end
+
+ format.json do
+ render :json => @list.to_json(:include => {
+ :listed_taxa => {
+ :except => [:manually_added, :updater_id, :observation_month_counts, :taxon_range_id, :source_id],
+ :include => {
+ :taxon => {
+ :methods => [:default_name, :photo_url, :iconic_taxon_name],
+ :only => [:name, :rank, :id]
+ }
+ }
+ }
+ })
+ end
end
end
View
4 app/models/taxon.rb
@@ -896,6 +896,10 @@ def image_url
taxon_image_url(self)
end
+ def photo_url
+ photos.blank? ? nil : image_url
+ end
+
# Static ##################################################################
#

0 comments on commit 79bab4b

Please sign in to comment.
Something went wrong with that request. Please try again.