change layout: now a link, no longer a tab
This commit is contained in:
parent
24c623fdf2
commit
25fa17d612
5 changed files with 19 additions and 24 deletions
|
@ -15,11 +15,5 @@
|
|||
|
||||
<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>
|
||||
|
|
|
@ -22,6 +22,11 @@ page << <<EOJ
|
|||
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() {
|
||||
|
@ -49,7 +54,6 @@ page << <<EOJ
|
|||
|
||||
function useMap() {
|
||||
var bounds = map.getExtent();
|
||||
setBounds(bounds);
|
||||
getData(bounds);
|
||||
return false;
|
||||
}
|
||||
|
@ -57,13 +61,13 @@ page << <<EOJ
|
|||
|
||||
function endDrag(bbox) {
|
||||
var bounds = bbox.getBounds();
|
||||
setBounds(bounds);
|
||||
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."));
|
||||
|
@ -121,9 +125,11 @@ page << <<EOJ
|
|||
|
||||
var url = "/api/0.5/map?bbox="+bounds.toBBOX();
|
||||
|
||||
loadGML(url);
|
||||
}
|
||||
function loadGML(url) {
|
||||
$("status").innerHTML = "Loading...";
|
||||
if (!gml) {
|
||||
var def = OpenLayers.Feature.Vector.style['default'];
|
||||
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,
|
||||
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 );
|
||||
|
@ -153,7 +159,6 @@ page << <<EOJ
|
|||
|
||||
currentFeature = null;
|
||||
}
|
||||
|
||||
function dataLoaded() {
|
||||
$("status").innerHTML = "Loaded " + this.features.length + " features. (<a href='"+ this.url+"'>API</a>)";
|
||||
|
||||
|
@ -257,17 +262,6 @@ page << <<EOJ
|
|||
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);
|
||||
|
|
|
@ -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>
|
||||
<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>
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
<%= 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>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
a {
|
||||
a m
|
||||
color: #0000ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
@ -569,6 +569,13 @@ input[type="text"] {
|
|||
font-weight: normal;
|
||||
}
|
||||
|
||||
#datalink {
|
||||
z-index:10000;
|
||||
position:absolute;
|
||||
bottom:30px;
|
||||
right:15px;
|
||||
font-size:smaller;
|
||||
}
|
||||
#permalink {
|
||||
z-index:10000;
|
||||
position:absolute;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue