Add support for viewing a list of your friends' changesets
This commit is contained in:
parent
2b04242462
commit
ce829bcc7c
4 changed files with 32 additions and 1 deletions
|
@ -266,6 +266,27 @@ class ChangesetController < ApplicationController
|
|||
return
|
||||
end
|
||||
end
|
||||
|
||||
if params[:friends]
|
||||
user = @user
|
||||
if user
|
||||
friend_ids = []
|
||||
user.friends.each do |friend|
|
||||
friend_user = User.find(friend.friend_user_id)
|
||||
if friend_user.data_public?
|
||||
friend_ids << friend.friend_user_id
|
||||
end
|
||||
end
|
||||
if friend_ids.length > 0
|
||||
conditions = cond_merge conditions, ['user_id in (?)', friend_ids]
|
||||
else
|
||||
conditions = cond_merge conditions, ['false']
|
||||
end
|
||||
elsif request.format == :html
|
||||
@title = t 'user.no_such_user.title'
|
||||
render :template => 'user/no_such_user', :status => :not_found
|
||||
end
|
||||
end
|
||||
|
||||
if params[:bbox]
|
||||
bbox = BoundingBox.from_bbox_params(params)
|
||||
|
@ -282,7 +303,11 @@ class ChangesetController < ApplicationController
|
|||
user_link = render_to_string :partial => "user", :object => user
|
||||
end
|
||||
|
||||
if user and bbox
|
||||
if params[:friends] and user
|
||||
@title = t 'changeset.list.title_friend'
|
||||
@heading = t 'changeset.list.heading_friend'
|
||||
@description = t 'changeset.list.description_friend'
|
||||
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
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<% if friends.empty? %>
|
||||
<%= t 'user.view.no friends' %>
|
||||
<% else %>
|
||||
<%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %><br/><br/>
|
||||
<table id="friends">
|
||||
<%= render :partial => "contact", :collection => friends %>
|
||||
</table>
|
||||
|
|
|
@ -307,16 +307,19 @@ en:
|
|||
title_user: "Changesets by %{user}"
|
||||
title_bbox: "Changesets within %{bbox}"
|
||||
title_user_bbox: "Changesets by %{user} within %{bbox}"
|
||||
title_friend: "Changesets by your friends"
|
||||
|
||||
heading: "Changesets"
|
||||
heading_user: "Changesets"
|
||||
heading_bbox: "Changesets"
|
||||
heading_user_bbox: "Changesets"
|
||||
heading_friend: "Changesets"
|
||||
|
||||
description: "Recent changes"
|
||||
description_user: "Changesets by %{user}"
|
||||
description_bbox: "Changesets within %{bbox}"
|
||||
description_user_bbox: "Changesets by %{user} within %{bbox}"
|
||||
description_friend: "Changesets by your friends"
|
||||
timeout:
|
||||
sorry: "Sorry, the list of changesets you requested took too long to retrieve."
|
||||
diary_entry:
|
||||
|
@ -1692,6 +1695,7 @@ en:
|
|||
unhide_user: "unhide this user"
|
||||
delete_user: "delete this user"
|
||||
confirm: "Confirm"
|
||||
friends_changesets: "Browse all changesets by friends"
|
||||
popup:
|
||||
your location: "Your location"
|
||||
nearby mapper: "Nearby mapper"
|
||||
|
|
|
@ -86,6 +86,7 @@ OpenStreetMap::Application.routes.draw do
|
|||
match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
|
||||
match '/user/:display_name/edits' => 'changeset#list'
|
||||
match '/user/:display_name/edits/feed' => 'changeset#feed', :format => :atom
|
||||
match '/browse/friends' => 'changeset#list', :friends => true
|
||||
match '/browse/changesets' => 'changeset#list'
|
||||
match '/browse/changesets/feed' => 'changeset#feed', :format => :atom
|
||||
match '/browse' => 'changeset#list'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue