- resp = ""
-
- bugs.each do |bug|
- resp += "putAJAXMarker(" + bug.id.to_s + ", " + bug.lon.to_s + ", " + bug.lat.to_s;
- comment_no = 1
- bug.map_bug_comment.each do |comment|
- resp += (comment_no == 1 ? ", '" : "<hr />")
- resp += comment.comment if comment.comment
- resp += " [ "
- resp += comment.commenter_name if comment.commenter_name
- resp += " " + comment.date_created.to_s + " ]"
- comment_no += 1
- end
- resp += (comment_no == 1 ? "," : "', ") + (bug.status=="open"?"0":"1") + ");\n"
+ respond_to do |format|
+ format.html {render :template => 'map_bugs/get_bugs.js', :content_type => "text/javascript"}
+ format.rss {render :template => 'map_bugs/get_bugs.rss'}
+ format.js
+ format.xml {render :template => 'map_bugs/get_bugs.xml'}
+ format.json { render :json => @bugs.to_json(:methods => [:lat, :lon], :only => [:id, :status, :date_created], :include => { :map_bug_comment => { :only => [:commenter_name, :date_created, :comment]}}) }
+ #format.gpx {render :text => "Rendering GPX"}