]> git.openstreetmap.org Git - rails.git/commitdiff
change layout: now a link, no longer a tab
authorChristopher Schmidt <crschmidt@crschmidt.net>
Tue, 22 Apr 2008 12:48:26 +0000 (12:48 +0000)
committerChristopher Schmidt <crschmidt@crschmidt.net>
Tue, 22 Apr 2008 12:48:26 +0000 (12:48 +0000)
app/views/browse/_start.rhtml
app/views/browse/start.rjs
app/views/layouts/site.rhtml
app/views/site/index.rhtml
public/stylesheets/site.css

index 10316c3833b565c3b0543c0922090f684508ee24..eff1f415b06976dfbc1b0ba0b7060d918466c12a 100644 (file)
 
 <div id="status"></div>
 <div id="object">
 
 <div id="status"></div>
 <div id="object">
-<h3>Recent Changes</h3>
-<ul>
-<% @nodes.each do |node| %>
-<li><%= node.id %> @ <a href="#" onclick="setMapCenter(new OpenLayers.LonLat(<%= node.lon.to_s %>, <%= node.lat.to_s %>), 16); return false;"><%= node.lat.to_s %>,<%= node.lon.to_s %></a></li>
-<% end %>
-</ul>
 </div>
 </div>
 </div>
 </div>
index 2f23c1b1acb35722180dcb1bfc2fe68c00b91609..2c48c70ff9f1df7bafd0472fb7303b9825348bd6 100644 (file)
@@ -22,6 +22,11 @@ page << <<EOJ
         map.addControl(box);
         map.events.register("moveend", map, validateLinks);
         map.events.triggerEvent("moveend");
         map.addControl(box);
         map.events.register("moveend", map, validateLinks);
         map.events.triggerEvent("moveend");
+        if (map.getZoom() >= 16) {
+            useMap();
+        } else {
+            $("status").innerHTML = "Zoom in or Select an area of the map to view.";
+        }    
     }
     
     function stopBrowse() {
     }
     
     function stopBrowse() {
@@ -49,7 +54,6 @@ page << <<EOJ
     
     function useMap() {
         var bounds = map.getExtent();
     
     function useMap() {
         var bounds = map.getExtent();
-        setBounds(bounds);
         getData(bounds);
         return false;
     }
         getData(bounds);
         return false;
     }
@@ -57,13 +61,13 @@ page << <<EOJ
     
     function endDrag(bbox) {
         var bounds = bbox.getBounds();
     
     function endDrag(bbox) {
         var bounds = bbox.getBounds();
-        setBounds(bounds);
         box.deactivate();
         getData(bounds);
         $("drag_box").innerHTML = "Manually select a different area";
     }
     
     function displayFeatureWarning() {
         box.deactivate();
         getData(bounds);
         $("drag_box").innerHTML = "Manually select a different area";
     }
     
     function displayFeatureWarning() {
+        $("status").innerHTML = "";
         var div = document.createElement("div");
         var p = document.createElement("p");
         p.appendChild(document.createTextNode("You have loaded an area which contains " + featureList.length + " features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below.")); 
         var div = document.createElement("div");
         var p = document.createElement("p");
         p.appendChild(document.createTextNode("You have loaded an area which contains " + featureList.length + " features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below.")); 
@@ -121,9 +125,11 @@ page << <<EOJ
 
         var url = "/api/0.5/map?bbox="+bounds.toBBOX();
         
 
         var url = "/api/0.5/map?bbox="+bounds.toBBOX();
         
+        loadGML(url);
+    }
+    function loadGML(url) {
         $("status").innerHTML = "Loading...";
         if (!gml) {
         $("status").innerHTML = "Loading...";
         if (!gml) {
-            var def = OpenLayers.Feature.Vector.style['default'];
             var style = new OpenLayers.Style();
             style.addRules([new OpenLayers.Rule( 
               {'symbolizer': 
             var style = new OpenLayers.Style();
             style.addRules([new OpenLayers.Rule( 
               {'symbolizer': 
@@ -135,7 +141,7 @@ page << <<EOJ
             gml = new OpenLayers.Layer.GML("Data",url, 
                     {format: OpenLayers.Format.OSM, formatOptions: {checkTags: true},
                      maxFeatures: 100, requestSuccess: customDataLoader,
             gml = new OpenLayers.Layer.GML("Data",url, 
                     {format: OpenLayers.Format.OSM, formatOptions: {checkTags: true},
                      maxFeatures: 100, requestSuccess: customDataLoader,
-                     styleMap: new OpenLayers.StyleMap({'default': style, 'select': {'strokeColor': '#0000ff'}})
+                     styleMap: new OpenLayers.StyleMap({'default': style, 'select': {'strokeColor': '#0000ff', strokeWidth: 8}})
                     }
             );
             gml.events.register("loadend", gml, dataLoaded );
                     }
             );
             gml.events.register("loadend", gml, dataLoaded );
@@ -153,7 +159,6 @@ page << <<EOJ
 
         currentFeature = null;
     }
 
         currentFeature = null;
     }
-    
     function dataLoaded() { 
         $("status").innerHTML = "Loaded " + this.features.length + " features. (<a href='"+ this.url+"'>API</a>)";
         
     function dataLoaded() { 
         $("status").innerHTML = "Loaded " + this.features.length + " features. (<a href='"+ this.url+"'>API</a>)";
         
@@ -257,17 +262,6 @@ page << <<EOJ
         currentFeature = feature; 
     }   
     
         currentFeature = feature; 
     }   
     
-    function setBounds(bounds) {
-      var epsg4326 = new OpenLayers.Projection("EPSG:4326");
-      var decimals = Math.pow(10, Math.floor(map.getZoom() / 3));
-
-      bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);
-
-      $("minlon").innerHTML = Math.round(bounds.left * decimals) / decimals;
-      $("minlat").innerHTML = Math.round(bounds.bottom * decimals) / decimals;
-      $("maxlon").innerHTML = Math.round(bounds.right * decimals) / decimals;
-      $("maxlat").innerHTML = Math.round(bounds.top * decimals) / decimals;
-    }
     function validateLinks() {
         var bounds = this.getExtent();
         bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);
     function validateLinks() {
         var bounds = this.getExtent();
         bounds = bounds.clone().transform(map.getProjectionObject(), epsg4326);
index d9641891ca75f5e69714fbc8f4616d546fd65364..d2a9e0122fe8d1b31acf195bcf3d8ae44938e55c 100644 (file)
@@ -54,7 +54,6 @@
         <% end %>
         <li><%= link_to 'GPS Traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass} %></li>
         <li><%= link_to 'User Diaries', {:controller => 'diary_entry', :action => 'list'}, {:id => 'diaryanchor', :title => 'view user diaries', :class => diaryclass} %></li>
         <% end %>
         <li><%= link_to 'GPS Traces', {:controller => 'trace', :action => 'list'}, {:id => 'traceanchor', :title => 'manage traces', :class => traceclass} %></li>
         <li><%= link_to 'User Diaries', {:controller => 'diary_entry', :action => 'list'}, {:id => 'diaryanchor', :title => 'view user diaries', :class => diaryclass} %></li>
-        <li><%= link_to_remote 'Browse', {:url => {:controller => 'browse', :action => 'start'}}, {:href => url_for( {:controller => 'browse', :action => 'index'}), :id => 'browseanchor', :title => 'browse data', :class => browseclass} %></li>
       </ul>
     </div>
 
       </ul>
     </div>
 
index 94b24debf54d41162759c182f069ab03e29d8108..fa31d848ba2f3ab39806270f5e63a1360c366cb5 100644 (file)
@@ -9,6 +9,7 @@
 <%= render :partial => 'search' %>
 
 <div id="map">
 <%= render :partial => 'search' %>
 
 <div id="map">
+<div id="datalink"><%= link_to_remote 'See Data', {:url => {:controller => 'browse', :action => 'start'}}, {:href => url_for( {:controller => 'browse', :action => 'index'}), :id => 'browseanchor', :title => 'browse data'} %></div>
 <div id="permalink"><a href="/" id="permalinkanchor">Permalink</a></div>
 </div> 
 
 <div id="permalink"><a href="/" id="permalinkanchor">Permalink</a></div>
 </div> 
 
index c7f1b008572e7745a9982460e41f2b7fa4eaba89..4e4a703430e90060476a621af63205e6cbe04acd 100644 (file)
@@ -1,4 +1,4 @@
-a {
+a m
   color: #0000ff;
   text-decoration: none;
 }
   color: #0000ff;
   text-decoration: none;
 }
@@ -569,6 +569,13 @@ input[type="text"] {
   font-weight: normal;
 }
 
   font-weight: normal;
 }
 
+#datalink {
+  z-index:10000;
+  position:absolute;
+  bottom:30px;
+  right:15px;
+  font-size:smaller;
+}
 #permalink {
   z-index:10000;
   position:absolute;
 #permalink {
   z-index:10000;
   position:absolute;