]> git.openstreetmap.org Git - rails.git/commitdiff
js changes for 'history' tab
authorHarry Wood <mail@harrywood.co.uk>
Mon, 23 Mar 2009 16:41:18 +0000 (16:41 +0000)
committerHarry Wood <mail@harrywood.co.uk>
Mon, 23 Mar 2009 16:41:18 +0000 (16:41 +0000)
config/routes.rb
public/javascripts/map.js
public/javascripts/site.js

index 4431c47653050fd31d6720de63ce8058ea17bdf3..fcf22bced98d12cd21a18101bc8b5073174917d6 100644 (file)
@@ -71,7 +71,7 @@ ActionController::Routing::Routes.draw do |map|
   map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
   
   # Data browsing
   map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
   
   # Data browsing
-  map.connect '/browse', :controller => 'browse', :action => 'index'
+  map.connect '/browse', :controller => 'changeset', :action => 'list'
   map.connect '/browse/start', :controller => 'browse', :action => 'start'
   map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
   map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
   map.connect '/browse/start', :controller => 'browse', :action => 'start'
   map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
   map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
@@ -80,11 +80,12 @@ ActionController::Routing::Routes.draw do |map|
   map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
   map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
   map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
   map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
   map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
   map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
+  map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
   
   # web site
   
   # web site
-
   map.connect '/', :controller => 'site', :action => 'index'
   map.connect '/edit', :controller => 'site', :action => 'edit'
   map.connect '/', :controller => 'site', :action => 'index'
   map.connect '/edit', :controller => 'site', :action => 'edit'
+  map.connect '/history', :controller => 'changeset', :action => 'list_bbox'
   map.connect '/export', :controller => 'site', :action => 'export'
   map.connect '/login', :controller => 'user', :action => 'login'
   map.connect '/logout', :controller => 'user', :action => 'logout'
   map.connect '/export', :controller => 'site', :action => 'export'
   map.connect '/login', :controller => 'user', :action => 'login'
   map.connect '/logout', :controller => 'user', :action => 'logout'
@@ -101,6 +102,7 @@ ActionController::Routing::Routes.draw do |map|
 
   map.connect '/index.html', :controller => 'site', :action => 'index'
   map.connect '/edit.html', :controller => 'site', :action => 'edit'
 
   map.connect '/index.html', :controller => 'site', :action => 'index'
   map.connect '/edit.html', :controller => 'site', :action => 'edit'
+  map.connect '/history.html', :controller => 'changeset', :action => 'list_bbox'
   map.connect '/export.html', :controller => 'site', :action => 'export'
   map.connect '/search.html', :controller => 'way_tag', :action => 'search'
   map.connect '/login.html', :controller => 'user', :action => 'login'
   map.connect '/export.html', :controller => 'site', :action => 'export'
   map.connect '/search.html', :controller => 'way_tag', :action => 'search'
   map.connect '/login.html', :controller => 'user', :action => 'login'
@@ -137,7 +139,7 @@ ActionController::Routing::Routes.draw do |map|
 
   # user pages
   map.connect '/user/:display_name', :controller => 'user', :action => 'view'
 
   # user pages
   map.connect '/user/:display_name', :controller => 'user', :action => 'view'
-  map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
+  map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list_user'
   map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
   map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
   map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
   map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
   map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
   map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
@@ -152,7 +154,8 @@ ActionController::Routing::Routes.draw do |map|
   map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
   map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
   map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
   map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
   map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
   map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
-
+  
+  
   # test pages
   map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
   map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
   # test pages
   map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
   map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
index 608f4c264a166fa5dfb54521c7bd87c25d14b03f..a25564f0d97dd1d282cd73f4b71e3544ef40164a 100644 (file)
@@ -144,7 +144,7 @@ function setMapExtent(extent) {
    map.zoomToExtent(extent.clone().transform(epsg4326, map.getProjectionObject()));
 }
 
    map.zoomToExtent(extent.clone().transform(epsg4326, map.getProjectionObject()));
 }
 
-function getMapExtent(extent) {
+function getMapExtent() {
    return map.getExtent().clone().transform(map.getProjectionObject(), epsg4326);
 }
 
    return map.getExtent().clone().transform(map.getProjectionObject(), epsg4326);
 }
 
index 95c0b938e3938fe89675fbabd2d55302ccef78b2..d381c02314d2b9e7761fa0fac387a05b266c444d 100644 (file)
@@ -1,4 +1,6 @@
-function updatelinks(lon,lat,zoom,layers) {
+//Called as the user scrolls/zooms around.
+//Maniplate hrefs of the view tab and various other links
+function updatelinks(lon,lat,zoom,layers,extents) {
   var decimals = Math.pow(10, Math.floor(zoom/3));
   var node;
 
   var decimals = Math.pow(10, Math.floor(zoom/3));
   var node;
 
@@ -55,6 +57,29 @@ function updatelinks(lon,lat,zoom,layers) {
       node.style.fontStyle = 'italic';
     }
   }
       node.style.fontStyle = 'italic';
     }
   }
+  
+  node = document.getElementById("historyanchor");
+  if (node) {
+    if (zoom >= 11) {
+      var args = new Object();
+      //conjure a bounding box centred at the lat/lon.
+      //TODO: feed actual bounds of the window through to here somehow.
+      minlon = extents.left;
+      minlat = extents.bottom;
+      maxlon = extents.right;
+      maxlat = extents.top;
+      minlon = Math.round(minlon * decimals) / decimals;
+      minlat = Math.round(minlat * decimals) / decimals;
+      maxlon = Math.round(maxlon * decimals) / decimals;
+      maxlat = Math.round(maxlat * decimals) / decimals;
+      args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat;
+      node.href = setArgs("history/", args);
+      node.style.fontStyle = 'normal';
+    } else {
+      node.href = 'javascript:alert("zoom in to see editing history");';
+      node.style.fontStyle = 'italic';
+    }
+  }
 }
 
 function getArgs(url) {
 }
 
 function getArgs(url) {