json.closed_milestone_count @closed_milestone_count 
json.opening_milestone_count @opening_milestone_count
json.total_count @milestones.total_count
json.milestones @milestones.each do |milestone| 
  if params[:only_name]
    json.partial! "simple_detail", locals: {milestone: milestone}
  else  
    json.partial! "detail", locals: {milestone: milestone}
  end
end