]> git.openstreetmap.org Git - rails.git/commitdiff
Extend work started in [15970] to add edit link to way pages on databrowser.
authorThomas Wood <grand.edgemaster@gmail.com>
Thu, 18 Jun 2009 14:29:28 +0000 (14:29 +0000)
committerThomas Wood <grand.edgemaster@gmail.com>
Thu, 18 Jun 2009 14:29:28 +0000 (14:29 +0000)
app/controllers/browse_controller.rb
app/views/browse/way.html.erb
config/locales/en.yml

index d3af27217544831281ea4e08aba81538e8f4395f..8124d4a339ec2d509ff29e2fdffc9fa2cf7039f0 100644 (file)
@@ -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
index 79c913a077346f3a7d45b9b37b3c21081cab145f..f6a3b2308f1de81f9c355770eed9419672ddf644 100644 (file)
@@ -16,7 +16,9 @@
       <%= render :partial => "way_details", :object => @way %>
       <hr />
       <%= 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)
+      %>
     </td>
     <%= render :partial => "map", :object => @way %>
   </tr>
index dd76441ca57e1ae504340e06b1ee6b2e967b09d1..c8b2cc2b41a0cd868ab3058cc9627408445939f3 100644 (file)
@@ -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"