From: Thomas Wood Date: Thu, 18 Jun 2009 14:29:28 +0000 (+0000) Subject: Extend work started in [15970] to add edit link to way pages on databrowser. X-Git-Tag: live~6987 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/80ff70a1ffdcdf5711de8e1ceaa2b0b474630789?ds=inline Extend work started in [15970] to add edit link to way pages on databrowser. --- diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index d3af27217..8124d4a33 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -30,6 +30,9 @@ class BrowseController < ApplicationController @way = Way.find(params[:id], :include => [:way_tags, {:changeset => :user}, {:nodes => [:node_tags, {:ways => :way_tags}]}, :containing_relation_members]) @next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] ) @prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] ) + + # Used for edit link, takes approx middle node of way + @midnode = @way.nodes[@way.nodes.length/2] rescue ActiveRecord::RecordNotFound @type = "way" render :action => "not_found", :status => :not_found diff --git a/app/views/browse/way.html.erb b/app/views/browse/way.html.erb index 79c913a07..f6a3b2308 100644 --- a/app/views/browse/way.html.erb +++ b/app/views/browse/way.html.erb @@ -16,7 +16,9 @@ <%= render :partial => "way_details", :object => @way %>
<%= t'browse.way.download', :download_xml_link => link_to(t('browse.way.download_xml'), :controller => "way", :action => "read"), - :view_history_link => link_to(t('browse.way.view_history'), :action => "way_history") %> + :view_history_link => link_to(t('browse.way.view_history'), :action => "way_history"), + :edit_link => link_to(t('browse.way.edit'), :controller => "site", :action => "edit", :way => @way.id, :lat => @midnode.lat, :lon => @midnode.lon, :zoom => 16) + %> <%= render :partial => "map", :object => @way %> diff --git a/config/locales/en.yml b/config/locales/en.yml index dd76441ca..c8b2cc2b4 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -199,9 +199,10 @@ en: way: way: "Way" way_title: "Way: {{way_name}}" - download: "{{download_xml_link}} or {{view_history_link}}" + download: "{{download_xml_link}}, {{view_history_link}} or {{edit_link}}" download_xml: "Download XML" view_history: "view history" + edit: "edit" changeset: changeset_paging_nav: showing_page: "Showing page"