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
|
return
|
||||||
end
|
end
|
||||||
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]
|
if params[:bbox]
|
||||||
bbox = BoundingBox.from_bbox_params(params)
|
bbox = BoundingBox.from_bbox_params(params)
|
||||||
|
@ -282,7 +303,11 @@ class ChangesetController < ApplicationController
|
||||||
user_link = render_to_string :partial => "user", :object => user
|
user_link = render_to_string :partial => "user", :object => user
|
||||||
end
|
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
|
@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
|
@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
|
@description = t 'changeset.list.description_user_bbox', :user => user_link, :bbox => bbox_link
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
<% if friends.empty? %>
|
<% if friends.empty? %>
|
||||||
<%= t 'user.view.no friends' %>
|
<%= t 'user.view.no friends' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
<%= link_to t('user.view.friends_changesets'), {:controller => 'browse', :action => 'friends'} %><br/><br/>
|
||||||
<table id="friends">
|
<table id="friends">
|
||||||
<%= render :partial => "contact", :collection => friends %>
|
<%= render :partial => "contact", :collection => friends %>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -307,16 +307,19 @@ en:
|
||||||
title_user: "Changesets by %{user}"
|
title_user: "Changesets by %{user}"
|
||||||
title_bbox: "Changesets within %{bbox}"
|
title_bbox: "Changesets within %{bbox}"
|
||||||
title_user_bbox: "Changesets by %{user} within %{bbox}"
|
title_user_bbox: "Changesets by %{user} within %{bbox}"
|
||||||
|
title_friend: "Changesets by your friends"
|
||||||
|
|
||||||
heading: "Changesets"
|
heading: "Changesets"
|
||||||
heading_user: "Changesets"
|
heading_user: "Changesets"
|
||||||
heading_bbox: "Changesets"
|
heading_bbox: "Changesets"
|
||||||
heading_user_bbox: "Changesets"
|
heading_user_bbox: "Changesets"
|
||||||
|
heading_friend: "Changesets"
|
||||||
|
|
||||||
description: "Recent changes"
|
description: "Recent changes"
|
||||||
description_user: "Changesets by %{user}"
|
description_user: "Changesets by %{user}"
|
||||||
description_bbox: "Changesets within %{bbox}"
|
description_bbox: "Changesets within %{bbox}"
|
||||||
description_user_bbox: "Changesets by %{user} within %{bbox}"
|
description_user_bbox: "Changesets by %{user} within %{bbox}"
|
||||||
|
description_friend: "Changesets by your friends"
|
||||||
timeout:
|
timeout:
|
||||||
sorry: "Sorry, the list of changesets you requested took too long to retrieve."
|
sorry: "Sorry, the list of changesets you requested took too long to retrieve."
|
||||||
diary_entry:
|
diary_entry:
|
||||||
|
@ -1692,6 +1695,7 @@ en:
|
||||||
unhide_user: "unhide this user"
|
unhide_user: "unhide this user"
|
||||||
delete_user: "delete this user"
|
delete_user: "delete this user"
|
||||||
confirm: "Confirm"
|
confirm: "Confirm"
|
||||||
|
friends_changesets: "Browse all changesets by friends"
|
||||||
popup:
|
popup:
|
||||||
your location: "Your location"
|
your location: "Your location"
|
||||||
nearby mapper: "Nearby mapper"
|
nearby mapper: "Nearby mapper"
|
||||||
|
|
|
@ -86,6 +86,7 @@ OpenStreetMap::Application.routes.draw do
|
||||||
match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
|
match '/browse/changeset/:id' => 'browse#changeset', :as => :changeset, :id => /\d+/
|
||||||
match '/user/:display_name/edits' => 'changeset#list'
|
match '/user/:display_name/edits' => 'changeset#list'
|
||||||
match '/user/:display_name/edits/feed' => 'changeset#feed', :format => :atom
|
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' => 'changeset#list'
|
||||||
match '/browse/changesets/feed' => 'changeset#feed', :format => :atom
|
match '/browse/changesets/feed' => 'changeset#feed', :format => :atom
|
||||||
match '/browse' => 'changeset#list'
|
match '/browse' => 'changeset#list'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue