- @edits = Changeset.find(:all,
- :order => "changesets.created_at DESC",
- :conditions => conditions,
- :limit => 20)
- end
-
- ##
- # list edits (changesets) belonging to a user
- def list_user
- user = User.find_by_display_name(params[:display_name], :conditions => {:visible => true})
-
- if user
- @display_name = user.display_name
- if not user.data_public? and @user != user
- @edits = nil
- render
+ if params[:nearby]
+ if @user
+ changesets = changesets.where(:user_id => @user.nearby)
+ elsif request.format == :html
+ require_user
+ return
+ end
+ end
+
+ if params[:bbox]
+ bbox = BoundingBox.from_bbox_params(params)
+ elsif params[:minlon] and params[:minlat] and params[:maxlon] and params[:maxlat]
+ bbox = BoundingBox.from_lon_lat_params(params)
+ end
+
+ if bbox
+ changesets = conditions_bbox(changesets, bbox)
+ bbox_link = render_to_string :partial => "bbox", :object => bbox
+ end
+
+ if user
+ user_link = render_to_string :partial => "user", :object => user
+ end
+
+ if params[:friends] and @user
+ @title = t 'changeset.list.title_friend'
+ @heading = t 'changeset.list.heading_friend'
+ @description = t 'changeset.list.description_friend'
+ elsif params[:nearby] and @user
+ @title = t 'changeset.list.title_nearby'
+ @heading = t 'changeset.list.heading_nearby'
+ @description = t 'changeset.list.description_nearby'
+ elsif user and bbox
+ @title = t 'changeset.list.title_user_bbox', :user => user.display_name, :bbox => bbox.to_s
+ @heading = t 'changeset.list.heading_user_bbox', :user => user.display_name, :bbox => bbox.to_s
+ @description = t 'changeset.list.description_user_bbox', :user => user_link, :bbox => bbox_link
+ elsif user
+ @title = t 'changeset.list.title_user', :user => user.display_name
+ @heading = t 'changeset.list.heading_user', :user => user.display_name
+ @description = t 'changeset.list.description_user', :user => user_link
+ elsif bbox
+ @title = t 'changeset.list.title_bbox', :bbox => bbox.to_s
+ @heading = t 'changeset.list.heading_bbox', :bbox => bbox.to_s
+ @description = t 'changeset.list.description_bbox', :bbox => bbox_link