Merge branch 'redesign'

Conflicts:
	app/assets/stylesheets/common.css.scss
This commit is contained in:
Tom Hughes 2013-11-28 17:30:53 +00:00
commit 68a3df4d53
186 changed files with 3778 additions and 4073 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Before After
Before After

View file

@ -13,7 +13,7 @@
height="200"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
inkscape:version="0.48.2 r9819"
inkscape:export-filename="/Users/tmcw/src/openstreetmap-website/app/assets/images/sprite.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
@ -27,17 +27,17 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2"
inkscape:cx="141.24705"
inkscape:cy="185.81774"
inkscape:zoom="4"
inkscape:cx="210.42032"
inkscape:cy="175.54808"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="756"
inkscape:window-x="0"
inkscape:window-width="1436"
inkscape:window-height="856"
inkscape:window-x="4"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true"
inkscape:object-paths="true"
@ -122,7 +122,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@ -257,5 +257,13 @@
d="M 185 6 L 183 8 L 183 12 L 185 14 L 187 14 L 185 12 L 185 8 L 190 8 L 190 11 L 192 11 L 192 8 L 190 6 L 187 6 L 185 6 z M 192 6 L 194 8 L 194 12 L 189 12 L 189 9 L 187 9 L 187 12 L 189 14 L 194 14 L 196 12 L 196 8 L 194 6 L 192 6 z "
transform="translate(0,852.36218)"
id="path4118" />
<path
inkscape:connector-curvature="0"
style="color:#000000;fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
d="m 205.9375,877.51843 -1,1 0,1 3,3 -3,3 0,1 1,1 1,0 3,-3 3,3 1,0 1,-1 0,-1 -3,-3 3,-3 0,-1 -1,-1 -1,0 -3,3 -3,-3 -1,0 z"
id="path3059"
inkscape:export-filename="/Users/saman/work_repos/osm-redesign/renders/share-1.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

View file

@ -9,17 +9,13 @@
//= require osm
//= require leaflet
//= require leaflet.osm
//= require leaflet.hash
//= require leaflet.map
//= require leaflet.zoom
//= require leaflet.extend
//= require leaflet.locationfilter
//= require i18n/translations
//= require oauth
//= require piwik
//= require map
//= require sidebar
//= require richtext
//= require geocoder
//= require querystring
var querystring = require('querystring-component');
@ -28,13 +24,6 @@ function zoomPrecision(zoom) {
return Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
}
function normalBounds(bounds) {
if (bounds instanceof L.LatLngBounds) return bounds;
return new L.LatLngBounds(
new L.LatLng(bounds[0][0], bounds[0][1]),
new L.LatLng(bounds[1][0], bounds[1][1]));
}
function remoteEditHandler(bbox, select) {
var loaded = false,
query = {
@ -69,31 +58,27 @@ function remoteEditHandler(bbox, select) {
* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
function updatelinks(loc, zoom, layers, bounds, object) {
function updatelinks(loc, zoom, layers, object) {
$(".geolink").each(function(index, link) {
var href = link.href.split(/[?#]/)[0],
args = querystring.parse(link.search.substring(1));
editlink = $(link).hasClass("editlink");
if (bounds && $(link).hasClass("bbox")) args.bbox = normalBounds(bounds).toBBoxString();
if (object && $(link).hasClass("object")) args[object.type] = object.id;
var query = querystring.stringify(args);
if (query) href += '?' + query;
if ($(link).hasClass("llz")) {
args = {
lat: loc.lat,
lon: loc.lon || loc.lng,
zoom: zoom
};
if (layers && $(link).hasClass("layers")) {
args.layers = layers;
}
href += OSM.formatHash(args);
if (object && editlink) {
href += '?' + object.type + '=' + object.id;
}
var args = {
lat: loc.lat,
lon: loc.lon || loc.lng,
zoom: zoom
};
if (layers && !editlink) {
args.layers = layers;
}
href += OSM.formatHash(args);
link.href = href;
});
@ -105,15 +90,6 @@ function updatelinks(loc, zoom, layers, bounds, object) {
.toggleClass('disabled', editDisabled)
.attr('data-original-title', editDisabled ?
I18n.t('javascripts.site.edit_disabled_tooltip') : '');
var historyDisabled = zoom < 11;
$('#history_tab')
.tooltip({placement: 'bottom'})
.off('click.minzoom')
.on('click.minzoom', function() { return !historyDisabled; })
.toggleClass('disabled', historyDisabled)
.attr('data-original-title', historyDisabled ?
I18n.t('javascripts.site.history_disabled_tooltip') : '');
}
// generate a cookie-safe string of map state
@ -135,12 +111,21 @@ function escapeHTML(string) {
});
}
/*
* Forms which have been cached by rails may have the wrong
* authenticity token, so patch up any forms with the correct
* token taken from the page header.
*/
function maximiseMap() {
$("#content").addClass("maximised");
}
function minimiseMap() {
$("#content").removeClass("maximised");
}
$(document).ready(function () {
var auth_token = $("meta[name=csrf-token]").attr("content");
$("form input[name=authenticity_token]").val(auth_token);
$("#menu-icon").on("click", function(e) {
e.preventDefault();
$("header").toggleClass("closed");
});
$("nav.primary li a").on("click", function() {
$("header").toggleClass("closed");
});
});

View file

@ -1,84 +0,0 @@
$(document).ready(function () {
var map = L.map("small_map", {
attributionControl: false,
zoomControl: false
}).addLayer(new L.OSM.Mapnik());
L.OSM.zoom()
.addTo(map);
var params = $("#small_map").data();
var object, bbox;
if (params.type == "changeset") {
bbox = L.latLngBounds([params.minlat, params.minlon],
[params.maxlat, params.maxlon]);
map.fitBounds(bbox);
L.rectangle(bbox, {
weight: 2,
color: '#e90',
fillOpacity: 0
}).addTo(map);
$("#loading").hide();
$("#browse_map .secondary-actions").show();
$("a[data-editor=remote]").click(function () {
return remoteEditHandler(bbox);
});
updatelinks(map.getCenter(), 16, null, [[params.minlat, params.minlon],
[params.maxlat, params.maxlon]]);
} else if (params.type == "note") {
object = {type: params.type, id: params.id};
map.setView([params.lat, params.lon], 16);
L.marker([params.lat, params.lon], { icon: getUserIcon() }).addTo(map);
bbox = map.getBounds();
$("#loading").hide();
$("#browse_map .secondary-actions").show();
$("a[data-editor=remote]").click(function () {
return remoteEditHandler(bbox);
});
updatelinks(params, 16, null, bbox, object);
} else {
$("#object_larger_map, #object_edit").hide();
object = {type: params.type, id: params.id};
if (!params.visible) {
object.version = params.version - 1;
}
map.addObject(object, {
zoom: true,
callback: function(extent) {
$("#loading").hide();
if (extent && extent.isValid()) {
$("#browse_map .secondary-actions").show();
$("a.bbox[data-editor=remote]").click(function () {
return remoteEditHandler(extent);
});
$("a.object[data-editor=remote]").click(function () {
return remoteEditHandler(extent, params.type + params.id);
});
$("#object_larger_map").show();
$("#object_edit").show();
updatelinks(map.getCenter(), 16, null, extent, object);
}
}
});
}
});

View file

@ -1,73 +0,0 @@
$(document).ready(function () {
var changesets = [], rects = {};
var map = L.map("changeset_list_map", {
attributionControl: false,
zoomControl: false
}).addLayer(new L.OSM.Mapnik());
L.OSM.zoom()
.addTo(map);
var group = L.featureGroup().addTo(map);
$("[data-changeset]").each(function () {
var changeset = $(this).data('changeset');
if (changeset.bbox) {
changeset.bounds = L.latLngBounds([changeset.bbox.minlat, changeset.bbox.minlon],
[changeset.bbox.maxlat, changeset.bbox.maxlon]);
changesets.push(changeset);
}
});
changesets.sort(function (a, b) {
return b.bounds.getSize() - a.bounds.getSize();
});
for (var i = 0; i < changesets.length; ++i) {
var changeset = changesets[i],
rect = L.rectangle(changeset.bounds,
{weight: 2, color: "#ee9900", fillColor: "#ffff55", fillOpacity: 0});
rect.id = changeset.id;
rects[changeset.id] = rect;
rect.addTo(group);
}
function highlightChangeset(id) {
rects[id].setStyle({fillOpacity: 0.5});
$("#changeset_" + id).addClass("selected");
}
function unHighlightChangeset(id) {
rects[id].setStyle({fillOpacity: 0});
$("#changeset_" + id).removeClass("selected");
}
group.on({
mouseover: function (e) {
highlightChangeset(e.layer.id);
},
mouseout: function (e) {
unHighlightChangeset(e.layer.id);
}
});
$("[data-changeset]").on({
mouseover: function () {
highlightChangeset($(this).data("changeset").id);
},
mouseout: function () {
unHighlightChangeset($(this).data("changeset").id);
}
});
$(window).scroll(function() {
if ($(window).scrollTop() > $('.content-heading').outerHeight() + $('#top-bar').outerHeight() ) {
$('#changeset_list_map_wrapper').addClass('scrolled');
} else {
$('#changeset_list_map_wrapper').removeClass('scrolled');
}
});
map.fitBounds(OSM.mapParams().bounds || group.getBounds());
});

View file

@ -21,13 +21,14 @@ $(document).ready(function () {
var params = $("#map").data();
var centre = [params.lat, params.lon];
var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright';
map = L.map("map", {
attributionControl: false,
zoomControl: false
}).addLayer(new L.OSM.Mapnik());
L.OSM.zoom()
L.OSM.zoom({position: position})
.addTo(map);
map.setView(centre, params.zoom);

View file

@ -1,31 +0,0 @@
function maximiseMap() {
$("#content").addClass("maximised");
}
function minimiseMap() {
$("#content").removeClass("maximised");
}
$(document).ready(function () {
$("#search_form").submit(function (e) {
e.preventDefault();
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("action"), {
query: $("#query").val()
}, openSidebar);
});
$("#describe_location").click(function (e) {
e.preventDefault();
var mapParams = OSM.mapParams();
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("href"), {
lat: mapParams.lat,
lon: mapParams.lon,
zoom: mapParams.zoom
}, openSidebar);
});
});

View file

@ -1,14 +0,0 @@
$(document).ready(function () {
$("body").on("click", ".search_more a", function (e) {
e.preventDefault();
var div = $(this).parents(".search_more");
div.find(".search_results_entry").hide();
div.find(".search_searching").show();
$.get($(this).attr("href"), function(data) {
div.replaceWith(data);
});
});
});

View file

@ -9,75 +9,74 @@
//= require index/browse
//= require index/export
//= require index/notes
//= require index/history
//= require index/note
//= require index/new_note
//= require router
(function() {
var loaderTimeout;
OSM.loadSidebarContent = function(path, callback) {
clearTimeout(loaderTimeout);
loaderTimeout = setTimeout(function() {
$('#sidebar_loader').show();
}, 200);
// IE<10 doesn't respect Vary: X-Requested-With header, so
// prevent caching the XHR response as a full-page URL.
if (path.indexOf('?') >= 0) {
path += '&xhr=1'
} else {
path += '?xhr=1'
}
$('#sidebar_content')
.empty();
$.ajax({
url: path,
dataType: "html",
complete: function(xhr) {
clearTimeout(loaderTimeout);
$('#flash').empty();
$('#sidebar_loader').hide();
var content = $(xhr.responseText);
if (xhr.getResponseHeader('X-Page-Title')) {
document.title = xhr.getResponseHeader('X-Page-Title');
}
$('head')
.find('link[type="application/atom+xml"]')
.remove();
$('head')
.append(content.filter('link[type="application/atom+xml"]'));
$('#sidebar_content').html(content.not('link[type="application/atom+xml"]'));
if (callback) {
callback();
}
}
});
};
})();
$(document).ready(function () {
var params = OSM.mapParams();
var map = L.map("map", {
var map = new L.OSM.Map("map", {
zoomControl: false,
layerControl: false
});
map.attributionControl.setPrefix('');
map.hash = L.hash(map);
var copyright = I18n.t('javascripts.map.copyright', {copyright_url: '/copyright'});
var layers = [
new L.OSM.Mapnik({
attribution: copyright,
code: "M",
keyid: "mapnik",
name: I18n.t("javascripts.map.base.standard")
}),
new L.OSM.CycleMap({
attribution: copyright + ". Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
code: "C",
keyid: "cyclemap",
name: I18n.t("javascripts.map.base.cycle_map")
}),
new L.OSM.TransportMap({
attribution: copyright + ". Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
code: "T",
keyid: "transportmap",
name: I18n.t("javascripts.map.base.transport_map")
}),
new L.OSM.MapQuestOpen({
attribution: copyright + ". Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
code: "Q",
keyid: "mapquest",
name: I18n.t("javascripts.map.base.mapquest")
}),
new L.OSM.HOT({
attribution: copyright + ". Tiles courtesy of <a href='http://hot.openstreetmap.org/' target='_blank'>Humanitarian OpenStreetMap Team</a>",
code: "H",
keyid: "hot",
name: I18n.t("javascripts.map.base.hot")
})
];
function updateLayers(params) {
var layerParam = params.layers || "M";
var layersAdded = "";
for (var i = layers.length - 1; i >= 0; i--) {
if (layerParam.indexOf(layers[i].options.code) >= 0) {
map.addLayer(layers[i]);
layersAdded = layersAdded + layers[i].options.code;
} else if (i == 0 && layersAdded == "") {
map.addLayer(layers[i]);
} else {
map.removeLayer(layers[i]);
}
}
}
updateLayers(params);
$(window).on("hashchange", function () {
updateLayers(OSM.mapParams());
});
map.updateLayers(params.layers);
map.on("baselayerchange", function (e) {
if (map.getZoom() > e.layer.options.maxZoom) {
@ -85,16 +84,6 @@ $(document).ready(function () {
}
});
map.noteLayer = new L.LayerGroup();
map.noteLayer.options = {code: 'N'};
map.dataLayer = new L.OSM.DataLayer(null);
map.dataLayer.options.code = 'D';
$("#sidebar").on("opened closed", function () {
map.invalidateSize();
});
var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright';
L.OSM.zoom({position: position})
@ -113,7 +102,7 @@ $(document).ready(function () {
L.OSM.layers({
position: position,
layers: layers,
layers: map.baseLayers,
sidebar: sidebar
}).addTo(map);
@ -136,9 +125,31 @@ $(document).ready(function () {
L.control.scale()
.addTo(map);
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
initializeNotes(map);
if (params.layers.indexOf(map.noteLayer.options.code) >= 0) {
map.addLayer(map.noteLayer);
}
initializeBrowse(map);
if (params.layers.indexOf(map.dataLayer.options.code) >= 0) {
map.addLayer(map.dataLayer);
}
}
$('.leaflet-control .control-button').tooltip({placement: 'left', container: 'body'});
map.on('moveend layeradd layerremove', updateLocation);
map.on('moveend layeradd layerremove', function() {
updatelinks(
map.getCenter().wrap(),
map.getZoom(),
map.getLayersCode(),
map._object);
var expiry = new Date();
expiry.setYear(expiry.getFullYear() + 10);
$.cookie("_osm_location", cookieContent(map), { expires: expiry });
});
if (OSM.PIWIK) {
map.on('layeradd', function (e) {
@ -152,32 +163,18 @@ $(document).ready(function () {
});
}
if (params.bounds) {
map.fitBounds(params.bounds);
} else {
map.setView([params.lat, params.lon], params.zoom);
}
var marker = L.marker([0, 0], {icon: getUserIcon()});
if (!params.object_zoom) {
if (params.bounds) {
map.fitBounds(params.bounds);
} else {
map.setView([params.lat, params.lon], params.zoom);
}
}
if (params.box) {
L.rectangle(params.box, {
weight: 2,
color: '#e90',
fillOpacity: 0
}).addTo(map);
}
if (params.marker) {
marker.setLatLng([params.mlat, params.mlon]).addTo(map);
}
if (params.object) {
map.addObject(params.object, { zoom: params.object_zoom });
}
$("#homeanchor").on("click", function(e) {
e.preventDefault();
@ -211,22 +208,91 @@ $(document).ready(function () {
});
}
initializeSearch(map);
initializeExport(map);
initializeBrowse(map, params);
initializeNotes(map, params);
OSM.Index = function(map) {
var page = {};
page.pushstate = function() {
$("#content").addClass("overlay-sidebar");
map.invalidateSize({pan: false})
.panBy([-350, 0], {animate: false});
};
page.load = function() {
return map.getState();
};
page.popstate = function() {
$("#content").addClass("overlay-sidebar");
map.invalidateSize({pan: false});
};
page.unload = function() {
map.panBy([350, 0], {animate: false});
$("#content").removeClass("overlay-sidebar");
map.invalidateSize({pan: false});
};
return page;
};
OSM.Browse = function(map) {
var page = {};
page.pushstate = page.popstate = function(path, type, id) {
OSM.loadSidebarContent(path, function() {
page.load(path, type, id);
});
};
page.load = function(path, type, id) {
map.addObject({type: type, id: parseInt(id)});
};
page.unload = function() {
map.removeObject();
};
return page;
};
var history = OSM.History(map);
OSM.router = OSM.Router(map, {
"/": OSM.Index(map),
"/search": OSM.Search(map),
"/export": OSM.Export(map),
"/note/new": OSM.NewNote(map),
"/history/friends": history,
"/history/nearby": history,
"/history": history,
"/user/:display_name/history": history,
"/note/:id": OSM.Note(map),
"/:type/:id(/history)": OSM.Browse(map)
});
OSM.router.load();
$(document).on("click", "a", function(e) {
if (e.isDefaultPrevented() || e.isPropagationStopped()) return;
if (this.host === window.location.host && OSM.router.route(this.pathname + this.search + this.hash)) e.preventDefault();
});
$(".search_form").on("submit", function(e) {
e.preventDefault();
$("header").addClass("closed");
var query = $(this).find("input[name=query]").val();
if (query) {
OSM.router.route("/search?query=" + encodeURIComponent(query) + OSM.formatHash(map));
} else {
OSM.router.route("/" + OSM.formatHash(map));
}
});
$(".describe_location").on("click", function(e) {
e.preventDefault();
var precision = zoomPrecision(map.getZoom());
OSM.router.route("/search?query=" + encodeURIComponent(
map.getCenter().lat.toFixed(precision) + "," +
map.getCenter().lng.toFixed(precision)));
});
});
function updateLocation() {
updatelinks(this.getCenter().wrap(),
this.getZoom(),
this.getLayersCode(),
this.getBounds().wrap());
var expiry = new Date();
expiry.setYear(expiry.getFullYear() + 10);
$.cookie("_osm_location", cookieContent(this), { expires: expiry });
// Trigger hash update on layer changes.
this.hash.onMapMove();
}

View file

@ -1,15 +1,6 @@
//= require templates/browse/feature
//= require templates/browse/feature_list
//= require templates/browse/feature_history
function initializeBrowse(map, params) {
function initializeBrowse(map) {
var browseBounds;
var layersById;
var selectedLayer;
var browseObjectList;
var areasHidden = false;
var locationFilter;
var dataLayer = map.dataLayer;
dataLayer.setStyle({
@ -28,7 +19,7 @@ function initializeBrowse(map, params) {
});
dataLayer.isWayArea = function () {
return !areasHidden && L.OSM.DataLayer.prototype.isWayArea.apply(this, arguments);
return false;
};
dataLayer.on("click", function (e) {
@ -37,128 +28,48 @@ function initializeBrowse(map, params) {
map.on('layeradd', function (e) {
if (e.layer === dataLayer) {
$.ajax({ url: "/browse/start", success: function (sidebarHtml) {
startBrowse(sidebarHtml);
}});
map.on("moveend", updateData);
updateData();
}
});
map.on('layerremove', function (e) {
if (e.layer === dataLayer) {
closeSidebar();
map.off("moveend", updateData);
$('#browse_status').empty();
}
});
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
if (params.layers.indexOf(dataLayer.options.code) >= 0) {
map.addLayer(dataLayer);
}
}
function startBrowse(sidebarHtml) {
locationFilter = new L.LocationFilter({
enableButton: false,
adjustButton: false
}).addTo(map);
locationFilter.on("change", getData);
$("#sidebar_title").html(I18n.t('browse.start_rjs.data_frame_title'));
$("#sidebar_content").html(sidebarHtml);
openSidebar();
if (browseObjectList) loadObjectList();
map.on("moveend", updateData);
updateData();
$("#browse_filter_toggle").click(toggleFilter);
$("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.hide_areas'));
$("#browse_hide_areas_box").click(toggleAreas);
$("#sidebar").one("closed", function () {
map.removeLayer(dataLayer);
map.removeLayer(locationFilter);
map.off("moveend", updateData);
locationFilter.off("change", getData);
});
}
function updateData() {
if (!locationFilter.isEnabled()) {
if (map.getZoom() >= 15) {
var bounds = map.getBounds();
if (!browseBounds || !browseBounds.contains(bounds)) {
browseBounds = bounds;
getData();
}
} else {
setStatus(I18n.t('browse.start_rjs.zoom_or_select'));
}
var bounds = map.getBounds();
if (!browseBounds || !browseBounds.contains(bounds)) {
getData();
}
}
function toggleFilter() {
if (locationFilter.isEnabled()) {
$("#browse_filter_toggle").html(I18n.t('browse.start_rjs.manually_select'));
locationFilter.disable();
} else {
$("#browse_filter_toggle").html(I18n.t('browse.start_rjs.view_data'));
locationFilter.setBounds(map.getBounds().pad(-0.2));
locationFilter.enable();
}
getData();
}
function toggleAreas(e) {
e.preventDefault();
if (areasHidden) {
$("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.hide_areas'));
areasHidden = false;
} else {
$("#browse_hide_areas_box").html(I18n.t('browse.start_rjs.show_areas'));
areasHidden = true;
}
getData();
}
function displayFeatureWarning(count, limit, callback) {
clearStatus();
var div = document.createElement("div");
var p = document.createElement("p");
p.appendChild(document.createTextNode(I18n.t("browse.start_rjs.loaded_an_area_with_num_features", { num_features: count, max_features: limit })));
div.appendChild(p);
var input = document.createElement("input");
input.type = "submit";
input.value = I18n.t('browse.start_rjs.load_data');
input.onclick = callback;
div.appendChild(input);
$("#browse_content").html("");
$("#browse_content").append(div);
$('#browse_status').html(
$("<p class='warning'></p>")
.text(I18n.t("browse.start_rjs.loaded_an_area_with_num_features", { num_features: count, max_features: limit }))
.append(
$("<input type='submit'>")
.val(I18n.t('browse.start_rjs.load_data'))
.click(callback)));
}
var dataLoader;
function getData() {
var bounds = locationFilter.isEnabled() ? locationFilter.getBounds() : map.getBounds();
var bounds = map.getBounds();
var size = bounds.getSize();
if (size > OSM.MAX_REQUEST_AREA) {
setStatus(I18n.t("browse.start_rjs.unable_to_load_size", { max_bbox_size: OSM.MAX_REQUEST_AREA, bbox_size: size }));
$('#browse_status').html(
$("<p class='warning'></p>")
.text(I18n.t("browse.start_rjs.unable_to_load_size", { max_bbox_size: OSM.MAX_REQUEST_AREA, bbox_size: size.toFixed(2) })));
return;
}
setStatus(I18n.t('browse.start_rjs.loading'));
var url = "/api/" + OSM.API_VERSION + "/map?bbox=" + bounds.toBBoxString();
/*
@ -181,35 +92,14 @@ function initializeBrowse(map, params) {
dataLoader = $.ajax({
url: url,
success: function (xml) {
clearStatus();
$("#browse_content").empty();
dataLayer.clearLayers();
selectedLayer = null;
var features = dataLayer.buildFeatures(xml);
function addFeatures() {
$('#browse_status').empty();
dataLayer.addData(features);
layersById = {};
dataLayer.eachLayer(function (layer) {
var feature = layer.feature;
layersById[feature.id] = layer;
$.extend(feature, {
typeName: featureTypeName(feature),
url: "/browse/" + feature.type + "/" + feature.id,
name: featureName(feature)
});
});
browseObjectList = $(JST["templates/browse/feature_list"]({
features: features,
url: url
}))[0];
loadObjectList();
}
if (features.length < maxFeatures) {
@ -219,29 +109,11 @@ function initializeBrowse(map, params) {
}
dataLoader = null;
browseBounds = bounds;
}
});
}
function viewFeatureLink() {
var layer = layersById[$(this).data("feature-id")];
onSelect(layer);
if (locationFilter.isEnabled()) {
map.panTo(layer.getBounds().getCenter());
}
return false;
}
function loadObjectList() {
$("#browse_content").html(browseObjectList);
$("#browse_content").find("a[data-feature-id]").click(viewFeatureLink);
return false;
}
function onSelect(layer) {
// Unselect previously selected feature
if (selectedLayer) {
@ -252,91 +124,9 @@ function initializeBrowse(map, params) {
layer.originalStyle = layer.options;
layer.setStyle({color: '#0000ff', weight: 8});
// If the current object is the list, don't innerHTML="", since that could clear it.
if ($("#browse_content").firstChild == browseObjectList) {
$("#browse_content").removeChild(browseObjectList);
} else {
$("#browse_content").empty();
}
var feature = layer.feature;
$("#browse_content").html(JST["templates/browse/feature"]({
name: featureNameSelect(feature),
url: "/browse/" + feature.type + "/" + feature.id,
attributes: feature.tags
}));
$("#browse_content").find("a.browse_show_list").click(loadObjectList);
$("#browse_content").find("a.browse_show_history").click(loadHistory);
OSM.router.route('/' + layer.feature.type + '/' + layer.feature.id);
// Stash the currently drawn feature
selectedLayer = layer;
}
function loadHistory() {
$(this).attr("href", "").text(I18n.t('browse.start_rjs.wait'));
var feature = selectedLayer.feature;
$.ajax({
url: "/api/" + OSM.API_VERSION + "/" + feature.type + "/" + feature.id + "/history",
success: function (xml) {
if (selectedLayer.feature != feature || $("#browse_content").firstChild == browseObjectList) {
return;
}
$(this).remove();
var history = [];
var nodes = xml.getElementsByTagName(feature.type);
for (var i = nodes.length - 1; i >= 0; i--) {
history.push({
user: nodes[i].getAttribute("user") || I18n.t('browse.start_rjs.private_user'),
timestamp: nodes[i].getAttribute("timestamp")
});
}
$("#browse_content").append(JST["templates/browse/feature_history"]({
name: featureNameHistory(feature),
url: "/browse/" + feature.type + "/" + feature.id,
history: history
}));
}.bind(this)
});
return false;
}
function featureTypeName(feature) {
return I18n.t('browse.start_rjs.object_list.type.' + feature.type);
}
function featureName(feature) {
return feature.tags['name:' + $('html').attr('lang')] ||
feature.tags.name ||
feature.id;
}
function featureNameSelect(feature) {
return feature.tags['name:' + $('html').attr('lang')] ||
feature.tags.name ||
I18n.t("browse.start_rjs.object_list.selected.type." + feature.type, { id: feature.id });
}
function featureNameHistory(feature) {
return feature.tags['name:' + $('html').attr('lang')] ||
feature.tags.name ||
I18n.t("browse.start_rjs.object_list.history.type." + feature.type, { id: feature.id });
}
function setStatus(status) {
$("#browse_status").html(status);
$("#browse_status").show();
}
function clearStatus() {
$("#browse_status").html("");
$("#browse_status").hide();
}
}

View file

@ -1,73 +1,78 @@
function initializeExport(map) {
if (window.location.pathname == "/export") {
startExport();
OSM.Export = function(map) {
var page = {};
var locationFilter = new L.LocationFilter({
enableButton: false,
adjustButton: false
}).on("change", update);
function getBounds() {
return L.latLngBounds(
L.latLng($("#minlat").val(), $("#minlon").val()),
L.latLng($("#maxlat").val(), $("#maxlon").val()));
}
function startExport() {
var locationFilter = new L.LocationFilter({
enableButton: false,
adjustButton: false
}).addTo(map);
function boundsChanged() {
var bounds = getBounds();
map.fitBounds(bounds);
locationFilter.setBounds(bounds);
locationFilter.enable();
validateControls();
}
locationFilter.on("change", update);
function enableFilter(e) {
e.preventDefault();
map.on("moveend", update);
$("#drag_box").hide();
$("#sidebar_title").html(I18n.t('export.start_rjs.export'));
locationFilter.setBounds(map.getBounds().pad(-0.2));
locationFilter.enable();
validateControls();
}
$("#maxlat,#minlon,#maxlon,#minlat").change(boundsChanged);
function update() {
setBounds(locationFilter.isEnabled() ? locationFilter.getBounds() : map.getBounds());
validateControls();
}
function setBounds(bounds) {
var precision = zoomPrecision(map.getZoom());
$("#minlon").val(bounds.getWest().toFixed(precision));
$("#minlat").val(bounds.getSouth().toFixed(precision));
$("#maxlon").val(bounds.getEast().toFixed(precision));
$("#maxlat").val(bounds.getNorth().toFixed(precision));
}
function validateControls() {
$("#export_osm_too_large").toggle(getBounds().getSize() > OSM.MAX_REQUEST_AREA);
$("#export_commit").toggle(getBounds().getSize() < OSM.MAX_REQUEST_AREA);
}
page.pushstate = page.popstate = function(path) {
$("#export_tab").addClass("current");
OSM.loadSidebarContent(path, page.load);
};
page.load = function() {
map
.addLayer(locationFilter)
.on("moveend", update);
$("#maxlat, #minlon, #maxlon, #minlat").change(boundsChanged);
$("#drag_box").click(enableFilter);
$("#sidebar_content .close").on("click", page.minimizeSidebar);
openSidebar();
update();
return map.getState();
};
setBounds(map.getBounds());
page.unload = function() {
map
.removeLayer(locationFilter)
.off("moveend", update);
$("#sidebar").one("closed", function () {
map.removeLayer(locationFilter);
map.off("moveend", update);
locationFilter.off("change", update);
});
$("#export_tab").removeClass("current");
};
function getBounds() {
return L.latLngBounds(L.latLng($("#minlat").val(), $("#minlon").val()),
L.latLng($("#maxlat").val(), $("#maxlon").val()));
}
function boundsChanged() {
var bounds = getBounds();
map.fitBounds(bounds);
locationFilter.setBounds(bounds);
enableFilter();
validateControls();
}
function enableFilter() {
if (!locationFilter.getBounds().isValid()) {
locationFilter.setBounds(map.getBounds().pad(-0.2));
}
$("#drag_box").hide();
locationFilter.enable();
}
function update() {
setBounds(locationFilter.isEnabled() ? locationFilter.getBounds() : map.getBounds());
validateControls();
}
function setBounds(bounds) {
var precision = zoomPrecision(map.getZoom());
$("#minlon").val(bounds.getWest().toFixed(precision));
$("#minlat").val(bounds.getSouth().toFixed(precision));
$("#maxlon").val(bounds.getEast().toFixed(precision));
$("#maxlat").val(bounds.getNorth().toFixed(precision));
}
function validateControls() {
$("#export_osm_too_large").toggle(getBounds().getSize() > OSM.MAX_REQUEST_AREA);
}
}
}
return page;
};

View file

@ -0,0 +1,137 @@
OSM.History = function(map) {
var page = {};
$("#sidebar_content")
.on("click", ".changeset_more a", loadMore)
.on("mouseover", "[data-changeset]", function () {
highlightChangeset($(this).data("changeset").id);
})
.on("mouseout", "[data-changeset]", function () {
unHighlightChangeset($(this).data("changeset").id);
})
.on("click", "[data-changeset]", function () {
clickChangeset($(this).data("changeset").id);
});
var group = L.featureGroup()
.on("mouseover", function (e) {
highlightChangeset(e.layer.id);
})
.on("mouseout", function (e) {
unHighlightChangeset(e.layer.id);
})
.on("click", function (e) {
clickChangeset(e.layer.id);
});
group.getLayerId = function(layer) {
return layer.id;
};
function highlightChangeset(id) {
group.getLayer(id).setStyle({fillOpacity: 0.3});
$("#changeset_" + id).addClass("selected");
}
function unHighlightChangeset(id) {
group.getLayer(id).setStyle({fillOpacity: 0});
$("#changeset_" + id).removeClass("selected");
}
function clickChangeset(id) {
OSM.router.route($("#changeset_" + id).find(".changeset_id").attr("href"));
}
function loadData() {
var data = {};
if (window.location.pathname === '/history') {
data = {bbox: map.getBounds().wrap().toBBoxString()};
}
$.ajax({
url: window.location.pathname,
method: "GET",
data: data,
success: function(html, status, xhr) {
$('#sidebar_content .changesets').html(html);
updateMap();
}
});
}
function loadMore(e) {
e.preventDefault();
e.stopPropagation();
var div = $(this).parents(".changeset_more");
$(this).hide();
div.find(".loader").show();
$.get($(this).attr("href"), function(data) {
div.replaceWith(data);
updateMap();
});
}
function updateMap() {
group.clearLayers();
var changesets = [];
$("[data-changeset]").each(function () {
var changeset = $(this).data('changeset');
if (changeset.bbox) {
changeset.bounds = L.latLngBounds(
[changeset.bbox.minlat, changeset.bbox.minlon],
[changeset.bbox.maxlat, changeset.bbox.maxlon]);
changesets.push(changeset);
}
});
changesets.sort(function (a, b) {
return b.bounds.getSize() - a.bounds.getSize();
});
for (var i = 0; i < changesets.length; ++i) {
var changeset = changesets[i],
rect = L.rectangle(changeset.bounds,
{weight: 2, color: "#FF9500", opacity: 1, fillColor: "#FFFFBF", fillOpacity: 0});
rect.id = changeset.id;
rect.addTo(group);
}
if (window.location.pathname !== '/history') {
var bounds = group.getBounds();
if (bounds.isValid()) map.fitBounds(bounds);
}
}
page.pushstate = page.popstate = function(path) {
$("#history_tab").addClass("current");
OSM.loadSidebarContent(path, page.load);
};
page.load = function() {
map.addLayer(group);
if (window.location.pathname === '/history') {
map.on("moveend", loadData)
}
loadData();
};
page.unload = function() {
map.removeLayer(group);
if (window.location.pathname === '/history') {
map.off("moveend", loadData)
}
$("#history_tab").removeClass("current");
};
return page;
};

View file

@ -0,0 +1,163 @@
OSM.NewNote = function(map) {
var noteLayer = map.noteLayer,
content = $('#sidebar_content'),
page = {},
addNoteButton = $(".control-note .control-button"),
newNote,
halo;
var noteIcons = {
"new": L.icon({
iconUrl: "<%= image_path 'new_note_marker.png' %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
}),
"open": L.icon({
iconUrl: "<%= image_path 'open_note_marker.png' %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
}),
"closed": L.icon({
iconUrl: "<%= image_path 'closed_note_marker.png' %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
})
};
addNoteButton.on("click", function (e) {
e.preventDefault();
e.stopPropagation();
if ($(this).hasClass('disabled')) return;
OSM.router.route('/note/new');
});
function createNote(marker, form, url) {
var location = marker.getLatLng().wrap();
marker.options.draggable = false;
marker.dragging.disable();
$(form).find("input[type=submit]").prop("disabled", true);
$.ajax({
url: url,
type: "POST",
oauth: true,
data: {
lat: location.lat,
lon: location.lng,
text: $(form.text).val()
},
success: function (feature) {
noteCreated(feature, marker);
}
});
function noteCreated(feature, marker) {
content.find("textarea").val("");
updateMarker(feature);
newNote = null;
noteLayer.removeLayer(marker);
addNoteButton.removeClass("active");
OSM.route('/note/' + feature.properties.id);
}
}
function updateMarker(feature) {
var marker = L.marker(feature.geometry.coordinates.reverse(), {
icon: noteIcons[feature.properties.status],
opacity: 0.9,
clickable: true
});
marker.id = feature.properties.id;
marker.addTo(noteLayer);
return marker;
}
page.pushstate = page.popstate = function (path) {
OSM.loadSidebarContent(path, page.load);
};
function newHalo(loc, a) {
if (a == 'dragstart' && map.hasLayer(halo)) {
map.removeLayer(halo);
} else {
if (map.hasLayer(halo)) map.removeLayer(halo);
halo = L.circleMarker(loc, {
weight: 2.5,
radius: 20,
fillOpacity: 0.5,
color: "#FF6200"
});
map.addLayer(halo);
}
}
page.load = function () {
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
addNoteButton.addClass("active");
map.addLayer(noteLayer);
var mapSize = map.getSize();
var markerPosition;
if (mapSize.y > 800) {
markerPosition = [mapSize.x / 2, mapSize.y / 2];
} else if (mapSize.y > 400) {
markerPosition = [mapSize.x / 2, 400];
} else {
markerPosition = [mapSize.x / 2, mapSize.y];
}
newNote = L.marker(map.containerPointToLatLng(markerPosition), {
icon: noteIcons["new"],
opacity: 0.9,
draggable: true
});
newNote.on("dragstart dragend", function(a) {
newHalo(newNote.getLatLng(), a.type);
});
newNote.addTo(noteLayer);
newHalo(newNote.getLatLng());
newNote.on("remove", function () {
addNoteButton.removeClass("active");
}).on("dragstart",function () {
$(newNote).stopTime("removenote");
}).on("dragend", function () {
content.find("textarea").focus();
});
content.find("textarea")
.on("input", disableWhenBlank)
.focus();
function disableWhenBlank(e) {
$(e.target.form.add).prop("disabled", $(e.target).val() === "");
}
content.find('input[type=submit]').on('click', function (e) {
e.preventDefault();
createNote(newNote, e.target.form, '/api/0.6/notes.json');
});
return map.getState();
};
page.unload = function () {
noteLayer.removeLayer(newNote);
map.removeLayer(halo);
addNoteButton.removeClass("active");
};
return page;
};

View file

@ -0,0 +1,98 @@
OSM.Note = function (map) {
var noteLayer = map.noteLayer,
content = $('#sidebar_content'),
page = {},
halo, currentNote;
var noteIcons = {
"new": L.icon({
iconUrl: "<%= image_path('new_note_marker.png') %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
}),
"open": L.icon({
iconUrl: "<%= image_path('open_note_marker.png') %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
}),
"closed": L.icon({
iconUrl: "<%= image_path('closed_note_marker.png') %>",
iconSize: [25, 40],
iconAnchor: [12, 40]
})
};
function updateNote(form, method, url) {
$(form).find("input[type=submit]").prop("disabled", true);
$.ajax({
url: url,
type: method,
oauth: true,
data: {text: $(form.text).val()},
success: function () {
OSM.loadSidebarContent(window.location.pathname, page.load);
}
});
}
page.pushstate = page.popstate = function (path) {
OSM.loadSidebarContent(path, page.load);
};
page.load = function () {
content.find("input[type=submit]").on("click", function (e) {
e.preventDefault();
var data = $(e.target).data();
updateNote(e.target.form, data.method, data.url);
});
content.find("textarea").on("input", function (e) {
var form = e.target.form;
if ($(e.target).val() == "") {
$(form.close).val(I18n.t("javascripts.notes.show.resolve"));
$(form.comment).prop("disabled", true);
} else {
$(form.close).val(I18n.t("javascripts.notes.show.comment_and_resolve"));
$(form.comment).prop("disabled", false);
}
});
content.find("textarea").val('').trigger("input");
var data = $('.details').data(),
latLng = data.coordinates.split(',');
if (!window.location.hash) {
OSM.router.moveListenerOff();
map.once('moveend', OSM.router.moveListenerOn);
map.getZoom() > 15 ? map.panTo(latLng) : map.setView(latLng, 16);
}
if (!map.hasLayer(halo)) {
halo = L.circleMarker(latLng, {
weight: 2.5,
radius: 20,
fillOpacity: 0.5,
color: "#FF6200"
});
map.addLayer(halo);
}
if (map.hasLayer(currentNote)) map.removeLayer(currentNote);
currentNote = L.marker(latLng, {
icon: noteIcons[data.status],
opacity: 1,
clickable: true
});
map.addLayer(currentNote);
};
page.unload = function () {
if (map.hasLayer(halo)) map.removeLayer(halo);
if (map.hasLayer(currentNote)) map.removeLayer(currentNote);
};
return page;
};

View file

@ -1,10 +1,6 @@
//= require templates/notes/show
//= require templates/notes/new
function initializeNotes(map, params) {
function initializeNotes(map) {
var noteLayer = map.noteLayer,
notes = {},
newNote;
notes = {};
var noteIcons = {
"new": L.icon({
@ -35,57 +31,31 @@ function initializeNotes(map, params) {
noteLayer.clearLayers();
notes = {};
}
}).on("popupclose", function (e) {
if (newNote && e.popup == newNote._popup) {
$(newNote).oneTime(10, "removenote", function () {
map.removeLayer(newNote);
newNote = null;
});
}
}).on("popupopen", function (e) {
if (!('ontouchstart' in document.documentElement)) {
$(e.popup._container).find(".comment").focus();
}
});
if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') {
if (params.layers.indexOf(noteLayer.options.code) >= 0) {
map.addLayer(noteLayer);
}
if (params.note) {
$.ajax({
url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json",
success: function (feature) {
var marker = updateMarker(notes[feature.properties.id], feature);
notes[feature.properties.id] = marker;
map.addLayer(noteLayer);
marker.openPopup();
}
});
}
}
noteLayer.on('click', function(e) {
OSM.router.route('/note/' + e.layer.id);
});
function updateMarker(marker, feature) {
if (marker) {
marker.setIcon(noteIcons[feature.properties.status]);
marker.setPopupContent(createPopupContent(
marker, feature.properties,
$(marker._popup._content).find("textarea").val()
));
} else {
marker = L.marker(feature.geometry.coordinates.reverse(), {
icon: noteIcons[feature.properties.status],
opacity: 0.9
opacity: 0.8,
clickable: true
});
marker.addTo(noteLayer).bindPopup(
createPopupContent(marker, feature.properties),
popupOptions()
);
marker.id = feature.properties.id;
marker.addTo(noteLayer);
}
return marker;
}
noteLayer.getLayerId = function(marker) {
return marker.id;
};
var noteLoader;
function loadNotes() {
@ -114,160 +84,11 @@ function initializeNotes(map, params) {
notes[feature.properties.id] = updateMarker(marker, feature);
}
for (id in oldNotes) {
for (var id in oldNotes) {
noteLayer.removeLayer(oldNotes[id]);
}
noteLoader = null;
}
};
function popupOptions() {
var mapSize = map.getSize();
return {
minWidth: 320,
maxWidth: mapSize.y * 1 / 3,
maxHeight: mapSize.y * 2 / 3,
offset: new L.Point(0, -40),
autoPanPadding: new L.Point(60, 40)
};
}
function createPopupContent(marker, properties, comment) {
var content = $(JST["templates/notes/show"]({ note: properties }));
content.find("textarea").on("input", function (e) {
var form = e.target.form;
if ($(e.target).val() == "") {
$(form.close).val(I18n.t("javascripts.notes.show.resolve"));
$(form.comment).prop("disabled", true);
} else {
$(form.close).val(I18n.t("javascripts.notes.show.comment_and_resolve"));
$(form.comment).prop("disabled", false);
}
});
content.find("input[type=submit]").on("click", function (e) {
e.preventDefault();
var data = $(e.target).data();
updateNote(marker, e.target.form, data.method, data.url);
});
if (comment) {
content.find("textarea").val(comment).trigger("input");
}
return content[0];
}
var addNoteButton = $(".control-note .control-button");
function createNote(marker, form, url) {
var location = marker.getLatLng();
marker.options.draggable = false;
marker.dragging.disable();
$(form).find("input[type=submit]").prop("disabled", true);
$.ajax({
url: url,
type: "POST",
oauth: true,
data: {
lat: location.lat,
lon: location.lng,
text: $(form.text).val()
},
success: noteCreated
});
function noteCreated(feature) {
$(marker._popup._content).find("textarea").val("");
notes[feature.properties.id] = updateMarker(marker, feature);
newNote = null;
addNoteButton.removeClass("active").addClass("geolink");
}
}
function updateNote(marker, form, method, url) {
$(form).find("input[type=submit]").prop("disabled", true);
$.ajax({
url: url,
type: method,
oauth: true,
data: {
text: $(form.text).val()
},
success: function (feature) {
if (feature.properties.status == "hidden") {
noteLayer.removeLayer(marker);
delete notes[feature.properties.id];
} else {
var popupContent = createPopupContent(marker, feature.properties);
marker.setIcon(noteIcons[feature.properties.status]);
marker.setPopupContent(popupContent);
}
}
});
}
addNoteButton.on("click", function (e) {
e.preventDefault();
e.stopPropagation();
if (addNoteButton.hasClass("disabled")) return;
if (addNoteButton.hasClass("active")) return;
addNoteButton.removeClass("geolink").addClass("active");
map.addLayer(noteLayer);
var mapSize = map.getSize();
var markerPosition;
if (mapSize.y > 800) {
markerPosition = [mapSize.x / 2, mapSize.y / 2];
} else if (mapSize.y > 400) {
markerPosition = [mapSize.x / 2, 400];
} else {
markerPosition = [mapSize.x / 2, mapSize.y];
}
newNote = L.marker(map.containerPointToLatLng(markerPosition), {
icon: noteIcons["new"],
opacity: 0.9,
draggable: true
});
var popupContent = $(JST["templates/notes/new"]());
popupContent.find("textarea").on("input", disableWhenBlank);
function disableWhenBlank(e) {
$(e.target.form.add).prop("disabled", $(e.target).val() === "");
}
popupContent.find("input[type=submit]").on("click", function (e) {
e.preventDefault();
createNote(newNote, e.target.form, '/api/0.6/notes.json');
});
newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup();
newNote.on("remove", function (e) {
addNoteButton.removeClass("active").addClass("geolink");
}).on("dragstart", function (e) {
$(newNote).stopTime("removenote");
}).on("dragend", function (e) {
e.target.openPopup();
});
});
}

View file

@ -1,77 +1,79 @@
function initializeSearch(map) {
$("#search_form").submit(submitSearch);
$("#describe_location").click(describeLocation);
if ($("#query").val()) {
$("#search_form").submit();
}
// Focus the search field for browsers that don't support
// the HTML5 'autofocus' attribute
if (!("autofocus" in document.createElement("input"))) {
$("#query").focus();
}
$("#sidebar_content").on("click", ".search_results_entry a.set_position", clickSearchResult);
var marker = L.marker([0, 0], {icon: getUserIcon()});
function submitSearch(e) {
e.preventDefault();
var bounds = map.getBounds();
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("action"), {
query: $("#query").val(),
zoom: map.getZoom(),
minlon: bounds.getWest(),
minlat: bounds.getSouth(),
maxlon: bounds.getEast(),
maxlat: bounds.getNorth()
OSM.Search = function(map) {
$(".search_form input[name=query]")
.on("focus", function() {
$(".describe_location").fadeOut(100);
})
.on("blur", function() {
$(".describe_location").fadeIn(100);
});
openSidebar();
$("#sidebar_content")
.on("click", ".search_more a", clickSearchMore)
.on("click", ".search_results_entry a.set_position", clickSearchResult);
$("#sidebar").one("closed", function () {
map.removeLayer(marker);
map.removeObject();
function clickSearchMore(e) {
e.preventDefault();
e.stopPropagation();
var div = $(this).parents(".search_more");
$(this).hide();
div.find(".loader").show();
$.get($(this).attr("href"), function(data) {
div.replaceWith(data);
});
}
function clickSearchResult(e) {
e.preventDefault();
var data = $(this).data(),
center = L.latLng(data.lat, data.lon);
if (data.minLon && data.minLat && data.maxLon && data.maxLat) {
map.fitBounds([[data.minLat, data.minLon],
[data.maxLat, data.maxLon]]);
[data.maxLat, data.maxLon]]);
} else {
map.setView(center, data.zoom);
}
marker
.setLatLng(center)
.addTo(map);
if (data.type && data.id) {
map.addObject(data, { zoom: false, style: { opacity: 0.2, fill: false } });
}
}
function describeLocation(e) {
e.preventDefault();
var marker = L.marker([0, 0], {icon: getUserIcon()});
var center = map.getCenter(),
zoom = map.getZoom();
var page = {};
$("#sidebar_title").html(I18n.t('site.sidebar.search_results'));
$("#sidebar_content").load($(this).attr("href"), {
lat: center.lat,
lon: center.lng,
zoom: zoom
}, openSidebar);
}
}
page.pushstate = page.popstate = function(path) {
var params = querystring.parse(path.substring(path.indexOf('?') + 1));
$(".search_form input[name=query]").val(params.query);
OSM.loadSidebarContent(path, page.load);
};
page.load = function() {
$(".search_results_entry").each(function() {
var entry = $(this);
$.ajax({
url: entry.data("href"),
method: 'GET',
data: {
zoom: map.getZoom(),
minlon: map.getBounds().getWest(),
minlat: map.getBounds().getSouth(),
maxlon: map.getBounds().getEast(),
maxlat: map.getBounds().getNorth()
},
success: function(html) {
entry.html(html);
}
});
});
return map.getState();
};
page.unload = function() {
map.removeLayer(marker);
map.removeObject();
$(".search_form input[name=query]").val("");
};
return page;
};

View file

@ -19,10 +19,9 @@ L.OSM.key = function (options) {
.attr('class', 'sidebar_heading')
.appendTo($ui)
.append(
$('<a>')
$('<span>')
.text(I18n.t('javascripts.close'))
.attr('class', 'sidebar_close')
.attr('href', '#')
.attr('class', 'icon close')
.bind('click', toggle))
.append(
$('<h4>')
@ -57,6 +56,7 @@ L.OSM.key = function (options) {
if (!button.hasClass('disabled')) {
options.sidebar.togglePane($ui, button);
}
$('.leaflet-control .control-button').tooltip('hide');
}
function updateButton() {

View file

@ -22,10 +22,9 @@ L.OSM.layers = function(options) {
.attr('class', 'sidebar_heading')
.appendTo($ui)
.append(
$('<a>')
$('<span>')
.text(I18n.t('javascripts.close'))
.attr('class', 'sidebar_close')
.attr('href', '#')
.attr('class', 'icon close')
.bind('click', toggle))
.append(
$('<h4>')
@ -85,9 +84,9 @@ L.OSM.layers = function(options) {
.appendTo(item);
var input = $('<input>')
.attr('type', 'radio')
.prop('checked', map.hasLayer(layer))
.appendTo(label);
.attr('type', 'radio')
.prop('checked', map.hasLayer(layer))
.appendTo(label);
label.append(layer.options.name);
@ -115,13 +114,19 @@ L.OSM.layers = function(options) {
$('<p>')
.text(I18n.t('javascripts.map.layers.overlays'))
.attr("class", "deemphasize")
.appendTo(overlaySection);
var list = $('<ul>')
.appendTo(overlaySection);
function addOverlay(layer, name) {
function addOverlay(layer, name, maxArea) {
var refName = name.split(' ').join('_').toLowerCase();
var item = $('<li>')
.attr('class', refName)
.tooltip({
placement: 'top'
})
.appendTo(list);
var label = $('<label>')
@ -140,15 +145,24 @@ L.OSM.layers = function(options) {
} else {
map.removeLayer(layer);
}
map.fire('overlaylayerchange', {layer: layer});
});
map.on('layeradd layerremove', function() {
input.prop('checked', map.hasLayer(layer));
});
map.on('zoomend', function() {
var disabled = map.getBounds().getSize() >= maxArea;
$(input).prop('disabled', disabled);
$(item).attr('class', disabled ? 'disabled' : '');
item.attr('data-original-title', disabled ?
I18n.t('javascripts.site.' + refName + '_zoom_in_tooltip') : '');
});
}
addOverlay(map.noteLayer, I18n.t('javascripts.map.layers.notes'));
addOverlay(map.dataLayer, I18n.t('javascripts.map.layers.data'));
addOverlay(map.noteLayer, I18n.t('javascripts.map.layers.notes'), OSM.MAX_NOTE_REQUEST_AREA);
addOverlay(map.dataLayer, I18n.t('javascripts.map.layers.data'), OSM.MAX_REQUEST_AREA);
}
options.sidebar.addPane($ui);
@ -157,6 +171,7 @@ L.OSM.layers = function(options) {
e.stopPropagation();
e.preventDefault();
options.sidebar.togglePane($ui, button);
$('.leaflet-control .control-button').tooltip('hide');
}
return $container[0];

View file

@ -9,7 +9,69 @@ L.extend(L.LatLngBounds.prototype, {
}
});
L.extend(L.Map.prototype, {
L.OSM.Map = L.Map.extend({
initialize: function(id, options) {
L.Map.prototype.initialize.call(this, id, options);
var copyright = I18n.t('javascripts.map.copyright', {copyright_url: '/copyright'});
var donate = I18n.t('javascripts.map.donate_link_text', {donate_url: 'http://donate.openstreetmap.org'});
this.baseLayers = [
new L.OSM.Mapnik({
attribution: copyright + " &hearts; " + donate,
code: "M",
keyid: "mapnik",
name: I18n.t("javascripts.map.base.standard")
}),
new L.OSM.CycleMap({
attribution: copyright + ". Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
code: "C",
keyid: "cyclemap",
name: I18n.t("javascripts.map.base.cycle_map")
}),
new L.OSM.TransportMap({
attribution: copyright + ". Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
code: "T",
keyid: "transportmap",
name: I18n.t("javascripts.map.base.transport_map")
}),
new L.OSM.MapQuestOpen({
attribution: copyright + ". Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
code: "Q",
keyid: "mapquest",
name: I18n.t("javascripts.map.base.mapquest")
}),
new L.OSM.HOT({
attribution: copyright + ". Tiles courtesy of <a href='http://hot.openstreetmap.org/' target='_blank'>Humanitarian OpenStreetMap Team</a>",
code: "H",
keyid: "hot",
name: I18n.t("javascripts.map.base.hot")
})
];
this.noteLayer = new L.FeatureGroup();
this.noteLayer.options = {code: 'N'};
this.dataLayer = new L.OSM.DataLayer(null);
this.dataLayer.options.code = 'D';
},
updateLayers: function(layerParam) {
layerParam = layerParam || "M";
var layersAdded = "";
for (var i = this.baseLayers.length - 1; i >= 0; i--) {
if (layerParam.indexOf(this.baseLayers[i].options.code) >= 0) {
this.addLayer(this.baseLayers[i]);
layersAdded = layersAdded + this.baseLayers[i].options.code;
} else if (i == 0 && layersAdded == "") {
this.addLayer(this.baseLayers[i]);
} else {
this.removeLayer(this.baseLayers[i]);
}
}
},
getLayersCode: function () {
var layerConfig = '';
for (var i in this._layers) { // TODO: map.eachLayer
@ -107,7 +169,22 @@ L.extend(L.Map.prototype, {
return str;
},
addObject: function(object, options) {
addObject: function(object) {
var objectStyle = {
color: "#FF6200",
weight: 4,
opacity: 1,
fillOpacity: 0.5
};
var changesetStyle = {
weight: 4,
color: '#FF9500',
opacity: 1,
fillOpacity: 0,
clickable: false
};
this._object = object;
if (this._objectLoader) this._objectLoader.abort();
@ -120,9 +197,10 @@ L.extend(L.Map.prototype, {
success: function (xml) {
map._objectLayer = new L.OSM.DataLayer(null, {
styles: {
node: options.style,
way: options.style,
area: options.style
node: objectStyle,
way: objectStyle,
area: objectStyle,
changeset: changesetStyle
}
});
@ -139,13 +217,16 @@ L.extend(L.Map.prototype, {
};
map._objectLayer.addData(xml);
var bounds = map._objectLayer.getBounds();
if (options.zoom && bounds.isValid()) map.fitBounds(bounds);
if (options.callback) options.callback(bounds);
map._objectLayer.addTo(map);
if (!window.location.hash) {
var bounds = map._objectLayer.getBounds();
if (bounds.isValid()) {
OSM.router.moveListenerOff();
map.once('moveend', OSM.router.moveListenerOn);
map.fitBounds(bounds);
}
}
}
});
},
@ -154,6 +235,14 @@ L.extend(L.Map.prototype, {
this._object = null;
if (this._objectLoader) this._objectLoader.abort();
if (this._objectLayer) this.removeLayer(this._objectLayer);
},
getState: function() {
return {
center: this.getCenter().wrap(),
zoom: this.getZoom(),
layers: this.getLayersCode()
}
}
});
@ -175,5 +264,13 @@ L.extend(L.Icon.Default.prototype, {
}
});
L.Hash.prototype.parseHash = OSM.parseHash;
L.Hash.prototype.formatHash = OSM.formatHash;
function getUserIcon(url) {
return L.icon({
iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
shadowSize: [41, 41]
});
}

View file

@ -25,10 +25,9 @@ L.OSM.share = function (options) {
.attr('class', 'sidebar_heading')
.appendTo($ui)
.append(
$('<a>')
$('<span>')
.text(I18n.t('javascripts.close'))
.attr('class', 'sidebar_close')
.attr('href', '#')
.attr('class', 'icon close')
.bind('click', toggle))
.append(
$('<h4>')
@ -231,6 +230,7 @@ L.OSM.share = function (options) {
update();
options.sidebar.togglePane($ui, button);
$('.leaflet-control .control-button').tooltip('hide');
}
function toggleMarker() {

View file

@ -1,10 +0,0 @@
function getUserIcon(url) {
return L.icon({
iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
shadowSize: [41, 41]
});
}

View file

@ -12,7 +12,7 @@ OSM = {
apiUrl: function (object) {
var url = "/api/" + OSM.API_VERSION + "/" + object.type + "/" + object.id;
if (object.type != "node") {
if (object.type === "way" || object.type === "relation") {
url += "/full";
} else if (object.version) {
url += "/" + object.version;
@ -38,7 +38,7 @@ OSM = {
},
mapParams: function (search) {
var params = OSM.params(search), mapParams = {}, bounds, loc;
var params = OSM.params(search), mapParams = {}, loc, match;
if (params.mlon && params.mlat) {
mapParams.marker = true;
@ -46,35 +46,13 @@ OSM = {
mapParams.mlat = parseFloat(params.mlat);
}
if (params.node || params.way || params.relation) {
mapParams.object_zoom = true;
if (params.node) {
mapParams.object = {type: 'node', id: parseInt(params.node)};
} else if (params.way) {
mapParams.object = {type: 'way', id: parseInt(params.way)};
} else if (params.relation) {
mapParams.object = {type: 'relation', id: parseInt(params.relation)};
}
}
if (params.bbox) {
params.bbox = params.bbox.split(',');
bounds = L.latLngBounds(
[parseFloat(params.bbox[1]),
parseFloat(params.bbox[0])],
[parseFloat(params.bbox[3]),
parseFloat(params.bbox[2])]);
} else if (params.minlon && params.minlat && params.maxlon && params.maxlat) {
bounds = L.latLngBounds(
[parseFloat(params.minlat),
parseFloat(params.minlon)],
[parseFloat(params.maxlat),
parseFloat(params.maxlon)]);
}
if (params.box === 'yes') {
mapParams.box = bounds;
// Old-style object parameters; still in use for edit links e.g. /edit?way=1234
if (params.node) {
mapParams.object = {type: 'node', id: parseInt(params.node)};
} else if (params.way) {
mapParams.object = {type: 'way', id: parseInt(params.way)};
} else if (params.relation) {
mapParams.object = {type: 'relation', id: parseInt(params.relation)};
}
var hash = OSM.parseHash(location.hash);
@ -84,22 +62,14 @@ OSM = {
mapParams.lon = hash.center.lng;
mapParams.lat = hash.center.lat;
mapParams.zoom = hash.zoom;
mapParams.object_zoom = false;
} else if (bounds) {
mapParams.lon = bounds.getCenter().lng; // Not used by main map, but
mapParams.lat = bounds.getCenter().lat; // are used by iD/Potlatch.
mapParams.bounds = bounds;
mapParams.object_zoom = false;
} else if (params.lon && params.lat) {
mapParams.lon = parseFloat(params.lon);
mapParams.lat = parseFloat(params.lat);
mapParams.zoom = parseInt(params.zoom || 5);
mapParams.object_zoom = false;
} else if (params.mlon && params.mlat) {
mapParams.lon = parseFloat(params.mlon);
mapParams.lat = parseFloat(params.mlat);
mapParams.zoom = parseInt(params.zoom || 12);
mapParams.object_zoom = false;
} else if (loc = $.cookie('_osm_location')) {
loc = loc.split("|");
mapParams.lon = parseFloat(loc[0]);
@ -123,10 +93,6 @@ OSM = {
mapParams.layers = hash.layers || (loc && loc[3]) || '';
if (params.note) {
mapParams.note = parseInt(params.note);
}
var scale = parseFloat(params.scale);
if (scale > 0) {
mapParams.zoom = Math.log(360.0 / (scale * 512.0)) / Math.log(2.0);
@ -136,12 +102,41 @@ OSM = {
},
parseHash: function(hash) {
if (hash.indexOf('#') === 0) {
hash = hash.substr(1);
var i = hash.indexOf('#');
if (i < 0) {
return false;
}
hash = hash.substr(i + 1);
if (hash === '') {
return false;
}
hash = querystring.parse(hash);
var args = L.Hash.parseHash(hash.map || '') || {};
if (hash.layers) args.layers = hash.layers;
var args = hash.map.split("/");
if (args.length !== 3) {
return false;
}
var zoom = parseInt(args[0], 10),
lat = parseFloat(args[1]),
lon = parseFloat(args[2]);
if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) {
return false;
}
args = {
center: new L.LatLng(lat, lon),
zoom: zoom
};
if (hash.layers) {
args.layers = hash.layers;
}
return args;
},
@ -153,7 +148,7 @@ OSM = {
zoom = args.getZoom();
layers = args.getLayersCode();
} else {
center = L.latLng(args.lat, args.lon);
center = args.center || L.latLng(args.lat, args.lon);
zoom = args.zoom;
layers = args.layers || '';
}

View file

@ -0,0 +1,180 @@
/*
OSM.Router implements pushState-based navigation for the main page and
other pages that use a sidebar+map based layout (export, search results,
history, and browse pages).
For browsers without pushState, it falls back to full page loads, which all
of the above pages support.
The router is initialized with a set of routes: a mapping of URL path templates
to route controller objects. Path templates can contain placeholders
(`/note/:id`) and optional segments (`/:type/:id(/history)`).
Route controller objects can define four methods that are called at defined
times during routing:
* The `load` method is called by the router when a path which matches the
route's path template is loaded via a normal full page load. It is passed
as arguments the URL path plus any matching arguments for placeholders
in the path template.
* The `pushstate` method is called when a page which matches the route's path
template is loaded via pushState. It is passed the same arguments as `load`.
* The `popstate` method is called when returning to a previously
pushState-loaded page via popstate (i.e. browser back/forward buttons).
* The `unload` method is called on the exiting route controller when navigating
via pushState or popstate to another route.
Note that while `load` is not called by the router for pushState-based loads,
it's frequently useful for route controllers to call it manually inside their
definition of the `pushstate` and `popstate` methods.
An instance of OSM.Router is assigned to `OSM.router`. To navigate to a new page
via pushState (with automatic full-page load fallback), call `OSM.router.route`:
OSM.router.route('/way/1234');
If `route` is passed a path that matches one of the path templates, it performs
the appropriate actions and returns true. Otherwise it returns false.
OSM.Router also handles updating the hash portion of the URL containing transient
map state such as the position and zoom level. Some route controllers may wish to
temporarily suppress updating the hash (for example, to omit the hash on pages
such as `/way/1234` unless the map is moved). This can be done by calling
`OSM.router.moveListenerOff` and `OSM.router.moveListenerOn`.
*/
OSM.Router = function(map, rts) {
var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g;
var optionalParam = /\((.*?)\)/g;
var namedParam = /(\(\?)?:\w+/g;
var splatParam = /\*\w+/g;
function Route(path, controller) {
var regexp = new RegExp('^' +
path.replace(escapeRegExp, '\\$&')
.replace(optionalParam, '(?:$1)?')
.replace(namedParam, function(match, optional){
return optional ? match : '([^\/]+)';
})
.replace(splatParam, '(.*?)') + '(?:\\?.*)?$');
var route = {};
route.match = function(path) {
return regexp.test(path);
};
route.run = function(action, path) {
var params = [];
if (path) {
params = regexp.exec(path).map(function(param, i) {
return (i > 0 && param) ? decodeURIComponent(param) : param;
});
}
return (controller[action] || $.noop).apply(controller, params);
};
return route;
}
var routes = [];
for (var r in rts)
routes.push(Route(r, rts[r]));
routes.recognize = function(path) {
for (var i = 0; i < this.length; i++) {
if (this[i].match(path)) return this[i];
}
};
var currentPath = window.location.pathname + window.location.search,
currentRoute = routes.recognize(currentPath),
currentHash = location.hash || OSM.formatHash(map);
var router = {};
if (window.history && window.history.pushState) {
$(window).on('popstate', function(e) {
if (!e.originalEvent.state) return; // Is it a real popstate event or just a hash change?
var path = window.location.pathname + window.location.search;
if (path === currentPath) return;
currentRoute.run('unload');
currentPath = path;
currentRoute = routes.recognize(currentPath);
currentRoute.run('popstate', currentPath);
var state = e.originalEvent.state;
if (state.center) {
map.setView(state.center, state.zoom, {animate: false});
map.updateLayers(state.layers);
}
});
router.route = function (url) {
var path = url.replace(/#.*/, ''),
route = routes.recognize(path);
if (!route) return false;
window.history.pushState(OSM.parseHash(url) || {}, document.title, url);
currentRoute.run('unload');
currentPath = path;
currentRoute = route;
currentRoute.run('pushstate', currentPath);
return true;
};
router.stateChange = function(state) {
if (state.center) {
window.history.replaceState(state, document.title, OSM.formatHash(state));
} else {
window.history.replaceState(state, document.title, window.location);
}
};
} else {
router.route = function (url) {
window.location.assign(url);
};
router.stateChange = function(state) {
if (state.center) window.location.replace(OSM.formatHash(state));
};
}
router.updateHash = function() {
var hash = OSM.formatHash(map);
if (hash === currentHash) return;
currentHash = hash;
router.stateChange(OSM.parseHash(hash));
};
router.hashUpdated = function() {
var hash = location.hash;
if (hash === currentHash) return;
currentHash = hash;
var state = OSM.parseHash(hash);
if (!state) return;
map.setView(state.center, state.zoom);
map.updateLayers(state.layers);
router.stateChange(state, hash);
};
router.moveListenerOn = function() {
map.on('moveend', router.updateHash);
};
router.moveListenerOff = function() {
map.off('moveend', router.updateHash);
};
router.load = function() {
var loadState = currentRoute.run('load', currentPath);
router.stateChange(loadState || {});
};
map.on('moveend baselayerchange overlaylayerchange', router.updateHash);
$(window).on('hashchange', router.hashUpdated);
return router;
};

View file

@ -1,21 +0,0 @@
function openSidebar(options) {
options = options || {};
$("#sidebar").trigger("closed");
if (options.title) { $("#sidebar_title").html(options.title); }
$("#sidebar").width(options.width || "30%");
$("#sidebar").css("display", "block").trigger("opened");
}
function closeSidebar() {
$("#sidebar").css("display", "none").trigger("closed");
}
$(document).ready(function () {
$(".sidebar_close").click(function (e) {
closeSidebar();
e.preventDefault();
});
});

View file

@ -1,15 +0,0 @@
<div class="browse_details">
<h4><%- name %></h4>
<a class='more-details' href="<%- url %>"><%- I18n.t('browse.start_rjs.object_list.details') %></a>
<ul class="inner12">
<% for (var key in attributes) { %>
<li><b><%- key %></b>: <%- attributes[key] %></li>
<% } %>
<li> <a href="<%- url %>/history" class="browse_show_history"><%- I18n.t('browse.start_rjs.show_history') %></a></li>
</ul>
</div>
<a href="#" class="browse_show_list button"><%- I18n.t('browse.start_rjs.object_list.back') %></a>

View file

@ -1,10 +0,0 @@
<div class="browse_details">
<h4><%- I18n.t("browse.start_rjs.history_for_feature", {feature: name}) %></h4>
<a class='more-details' href="<%- url %>/history"><%- I18n.t('browse.start_rjs.details') %></a>
<ul class="inner12">
<% for (var i = 0; i < history.length; i++) { %>
<li><%- I18n.t("browse.start_rjs.edited_by_user_at_timestamp", history[i]) %></li>
<% } %>
</ul>
</div>

View file

@ -1,13 +0,0 @@
<div>
<h4 class="browse_heading"><%- I18n.t('browse.start_rjs.object_list.heading') %></h4>
<div>
<ul class='inner12'>
<% for (var i = 0; i < features.length; i++) { %>
<li><%- features[i].typeName %> <a href="<%- features[i].url %>" data-feature-id="<%- features[i].id %>"><%- features[i].name %></a></li>
<% } %>
</ul>
</div>
<div class='inner12'><a href="<%- url %>" class='button'><%- I18n.t('browse.start_rjs.object_list.api') %></a></div>
</div>

View file

@ -1,12 +0,0 @@
<div class="note">
<p><%- I18n.t('javascripts.notes.new.intro') %></p>
<form action="#">
<input type="hidden" name="lon">
<input type="hidden" name="lat">
<textarea class="comment" name="text" cols="40" rows="10"></textarea>
<br/>
<div class="buttons clearfix">
<input type="submit" name="add" value="<%- I18n.t('javascripts.notes.new.add') %>" disabled="1">
</div>
</form>
</div>

View file

@ -1,41 +0,0 @@
<div class="note">
<a class="icon link permalink deemphasize" href="/?note=<%- note.id %>"><span><%- I18n.t('javascripts.notes.show.permalink', { id: note.id }) %></span></a>
<% if (note.comments.some(function (comment) { return !comment.user })) { %>
<small class="warning"><%- I18n.t('javascripts.notes.show.anonymous_warning') %></small>
<% } %>
<% note.comments.forEach(function (comment) { %>
<div>
<small class="deemphasize">
<% if (comment.user) { %>
<%= I18n.t('javascripts.notes.show.' + comment.action + '_by', {
user: comment.user, user_url: comment.user_url,
time: I18n.l("time.formats.long", comment.date)
}) %>
<% } else { %>
<%- I18n.t('javascripts.notes.show.' + comment.action + '_by_anonymous', {
time: I18n.l("time.formats.long", comment.date)
}) %>
<% } %>
</small>
<div class="comment_body"><%= comment.html %></div>
</div>
<% }) %>
<% if (note.status == "open") { %>
<form action="#">
<textarea class="comment" name="text" cols="40" rows="5"></textarea>
<div class="buttons clearfix">
<input type="submit" name="hide" value="<%- I18n.t('javascripts.notes.show.hide') %>" class="hide_unless_moderator deemphasize" data-method="DELETE" data-url="<%- note.url %>">
<input type="submit" name="close" value="<%- I18n.t('javascripts.notes.show.resolve') %>" class="hide_unless_logged_in" data-method="POST" data-url="<%- note.close_url %>">
<input type="submit" name="comment" value="<%- I18n.t('javascripts.notes.show.comment') %>" data-method="POST" data-url="<%- note.comment_url %>" disabled="1">
</div>
</form>
<% } else { %>
<form action="#">
<input type="hidden" name="text" value="">
<div class="buttons clearfix">
<input type="submit" name="hide" value="<%- I18n.t('javascripts.notes.show.hide') %>" class="hide_unless_moderator deemphasize" data-method="DELETE" data-url="<%- note.url %>">
<input type="submit" name="reopen" value="<%- I18n.t('javascripts.notes.show.reactivate') %>" class="hide_unless_logged_in" data-method="POST" data-url="<%- note.reopen_url %>">
</div>
</form>
<% } %>
</div>

View file

@ -1,12 +1,24 @@
//= require leaflet.locate
$(document).ready(function () {
var map = L.map("map", {
attributionControl: false,
zoomControl: false
}).addLayer(new L.OSM.Mapnik());
L.OSM.zoom()
var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright';
L.OSM.zoom({position: position})
.addTo(map);
L.control.locate({
position: position,
strings: {
title: I18n.t('javascripts.map.locate.title'),
popup: I18n.t('javascripts.map.locate.popup')
}
}).addTo(map);
if (OSM.home) {
map.setView([OSM.home.lat, OSM.home.lon], 12);
} else {

View file

@ -16,7 +16,7 @@ $(document).ready(function() {
$('.start-mapping').attr('href', url);
} else if (navigator.geolocation) {
} else {
function geoSuccess(position) {
window.location = '/edit' + OSM.formatHash({
zoom: 17,
@ -27,21 +27,21 @@ $(document).ready(function() {
$('.start-mapping').on('click', function(e) {
e.preventDefault();
$('.start-mapping').addClass('loading');
$('.start-mapping')
.addClass('loading');
if (navigator.geolocation) {
// handle firefox's weird implementation
// https://bugzilla.mozilla.org/show_bug.cgi?id=675533
window.setTimeout(manualEdit, 4000);
// handle firefox's weird implementation
// https://bugzilla.mozilla.org/show_bug.cgi?id=675533
window.setTimeout(manualEdit, 4000);
navigator.geolocation.getCurrentPosition(geoSuccess, manualEdit);
navigator.geolocation.getCurrentPosition(geoSuccess, manualEdit);
} else {
manualEdit();
}
});
} else {
manualEdit();
}
function manualEdit() {
window.location = '/?edit_help=1'
window.location = '/?edit_help=1';
}
});

View file

@ -1,14 +1,5 @@
/* Make space for icons */
li.node::before,
li.way::before,
li.relation::before,
a.node:first-child::before,
a.way:first-child::before,
a.relation:first-child::before {
margin-left: -25px;
}
.node::before,
.way::before,
.relation::before {

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
/* Parameters */
$lineheight: 20px;
$typeheight: 14px;
$offwhite: #f4f4ff;
$blue: #7092FF;
$lightblue: #B8C5F0;
$green: #7ebc6f;
$grey: #CCC;
$red: red;
$lightgrey: #EEE;
$darkgrey: #888;
$hovercolor: 20%;
$headerHeight: 55px;
$sidebarWidth: 350px;
$keyline: 1px solid $lightgrey;
$border-radius: 3px;

View file

@ -1,7 +1,4 @@
#small-title,
#left,
#greeting,
#tabnav,
header,
#sidebar,
#permalink,
.leaflet-control {

View file

@ -1,96 +1,133 @@
@import "parameters";
/* Styles specific to a small screen, such as iPhone, Android, etc... */
/* Default rules for the body of every page */
body {
font-size: 10px;
}
h1 {
font-size: 12px;
}
h2, h3, h4 {
font-size: 12px;
}
.wrapper {
margin: 0;
}
.site-edit #content,
.site-index #content,
.site-export #content {
left: 0;
}
.site-edit #top-bar,
.site-index #top-bar,
.site-export #top-bar {
position: relative;
}
.site-edit #content, .site-index #content, .site-export #content {
position: absolute;
input[type="submit"],
input[type="text"] {
-webkit-appearance: none;
}
.column-1 {
width: 100%;
}
/* Rules for the whole left sidebar, including the logo */
#menu-icon {
display: inline-block !important;
}
#left {
nav.primary,
nav.secondary {
float: none !important;
position: relative;
display: block;
clear: both;
}
header {
height: auto;
min-height: $headerHeight;
background: #fff;
h1 {
padding-bottom: 15px;
}
&.closed nav {
display: none;
}
.search_form {
display: block;
}
}
#sidebar .search_form,
#edit_tab,
#export_tab {
display: none;
}
/* Rules for tabbed navigation bar */
nav.primary {
padding: 0;
#top-bar {
left: 0;
margin: 0px;
height: 24px;
position: static;
ul, li {
border: none;
border-radius: 0;
width: 100%;
}
ul {
border-top: 1px solid #eee;
li {
border-bottom: 1px solid #eee;
border-right: none;
> a {
border-radius: 0;
width: 100%;
text-align: center;
font-size: 15px;
}
}
}
}
#tabnav {
height: 19px;
margin: 0px;
padding-top: 5px;
margin-top: 26px;
font-size: 10px;
line-height: 10px;
nav.secondary {
border-bottom: 1px solid #eee;
.user-menu {
display: block;
width: 100%;
margin-left: 0;
> li {
width: 49%;
> a {
width: 100%;
text-align: center;
}
}
}
}
#tabnav a, #tabnav a:link, #tabnav a:visited {
font-size: 10px;
line-height: 10px;
padding: 5px;
margin-right: 1px;
#compact-secondary-nav {
display: none;
}
.menuicon { line-height: 10px;}
/* Rules for the site name - shown when left sidebar is hidden */
#small-title {
font-size: 10px;
display: block;
position: absolute;
left: 5px;
top: 5px;
margin: 0;
.compact-hide {
display: inline-block;
}
/* Rules for greeting bar in the top right corner */
.map-layout {
#sidebar, #map {
position: relative;
overflow-x: hidden;
width: 100%;
height: 50%;
}
#browse_map ul.secondary-actions {
float: right;
font-size: 10px;
.overlay-sidebar {
#sidebar {
width: 300px;
}
#map {
height: 100%;
}
}
#map-ui {
z-index: 9999;
width: 100%;
overflow-y: scroll;
}
}
#map {
border: 0;
#sidebar .welcome {
display: none !important;
}
.leaflet-top.leaflet-right {
top: 10px !important;
z-index: 0;
}
.content_map {
@ -102,69 +139,6 @@ h2, h3, h4 {
min-height: auto;
}
.content_map #small_map {
height: 300px;
border: 1px solid #ccc;
}
.leaflet-control-pan, .leaflet-control-zoomslider {
display: none;
}
.site-index .leaflet-top,
.site-export .leaflet-top {
top: 10px !important;
}
/* Rules for the main content area */
#content {
margin-left: 0px;
margin-right: 0px;
border-left: 0px;
border-right: 0px;
}
.site-export #content,
.site-edit #content,
.site-index #content {
margin-top: 21px;
}
/* Rules for search sidebar when shown */
#sidebar {
border: 0px;
margin: 0px;
width: 50% !important;
border-right: 1px solid #ccccdd;
}
p.search_results_entry {
padding: 2px 0px;
}
/* Rules for the map UI */
.layers-ui {
.leaflet-container {
display: none;
}
li {
border-radius: 0;
margin-bottom: 0;
&:first-child {
border-radius: 4px 4px 0 0;
}
&:last-child {
border-radius: 0 0 4px 4px;
}
}
}
/* Rules for the login form */
#login_login input#user_email {
@ -200,55 +174,6 @@ p.search_results_entry {
top: auto;
}
/* Rules for the user settings page */
#user_new_email {
width: 60% !important;
}
#user_description, #user_preferred_editor {
width: 90% !important;
}
.minorNote {
display: block;
}
/* Rules for the browse pages */
.browse-section.common div{
clear: both;
}
#changeset_list_map {
position: relative;
width: 100%;
right: 0;
left: 0;
top: 0px;
margin-bottom: 20px;
float: none;
height: 300px !important;
max-height: auto;
min-height: auto;
}
/* Rules for the diary entries pages */
#diary_entry_title, #diary_entry_body, #diary_entry_language_code, #diary_comment_body {
width: 100% !important;
}
#usemap {
display: block;
}
/* Rules for the messaging pages */
#message_title, #message_body {
width: 100% !important;
}
/* Rules for the sign-up page */
.user-new,
@ -261,3 +186,7 @@ p.search_results_entry {
display: none;
}
}
.site-about #content .attr h1 {
font-size: 28px;
}

View file

@ -418,6 +418,10 @@ class ApplicationController < ActionController::Base
request.body.rewind
end
def map_layout
request.xhr? ? 'xhr' : 'map'
end
def preferred_editor
editor = if params[:editor]
params[:editor]

View file

@ -1,74 +1,66 @@
class BrowseController < ApplicationController
layout 'site', :except => [ :start ]
layout :map_layout
before_filter :authorize_web
before_filter :set_locale
before_filter { |c| c.check_database_readable(true) }
around_filter :web_timeout, :except => [:start]
before_filter :require_oauth
around_filter :web_timeout
def start
end
def relation
@type = "relation"
@relation = Relation.find(params[:id])
@next = Relation.visible.where("id > ?", @relation.id).order(:id => :asc).first
@prev = Relation.visible.where("id < ?", @relation.id).order(:id => :desc).first
@feature = Relation.find(params[:id])
render 'feature'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def relation_history
@type = "relation"
@relation = Relation.find(params[:id])
@feature = Relation.find(params[:id])
render 'history'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def way
@type = "way"
@way = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
@next = Way.visible.where("id > ?", @way.id).order(:id => :asc).first
@prev = Way.visible.where("id < ?", @way.id).order(:id => :desc).first
@feature = Way.preload(:way_tags, :containing_relation_members, :changeset => :user, :nodes => [:node_tags, :ways => :way_tags]).find(params[:id])
render 'feature'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def way_history
@type = "way"
@way = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
@feature = Way.preload(:way_tags, :old_ways => { :changeset => :user }).find(params[:id])
render 'history'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def node
@type = "node"
@node = Node.find(params[:id])
@next = Node.visible.where("id > ?", @node.id).order(:id => :asc).first
@prev = Node.visible.where("id < ?", @node.id).order(:id => :desc).first
@feature = Node.find(params[:id])
render 'feature'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def node_history
@type = "node"
@node = Node.find(params[:id])
@feature = Node.find(params[:id])
render 'history'
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end
def changeset
@type = "changeset"
@changeset = Changeset.find(params[:id])
@node_pages, @nodes = paginate(:old_nodes, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'node_page')
@way_pages, @ways = paginate(:old_ways, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'way_page')
@relation_pages, @relations = paginate(:old_relations, :conditions => {:changeset_id => @changeset.id}, :per_page => 20, :parameter => 'relation_page')
@title = "#{I18n.t('browse.changeset.title')} | #{@changeset.id}"
@next = Changeset.where("id > ?", @changeset.id).order(:id => :asc).first
@prev = Changeset.where("id < ?", @changeset.id).order(:id => :desc).first
if @changeset.user.data_public?
@next_by_user = @changeset.user.changesets.where("id > ?", @changeset.id).reorder(:id => :asc).first
@prev_by_user = @changeset.user.changesets.where("id < ?", @changeset.id).reorder(:id => :desc).first
@ -80,9 +72,6 @@ class BrowseController < ApplicationController
def note
@type = "note"
@note = Note.find(params[:id])
@title = "#{I18n.t('browse.note.title')} | #{@note.id}"
@next = Note.visible.where("id > ?", @note.id).order(:id => :asc).first
@prev = Note.visible.where("id < ?", @note.id).order(:id => :desc).first
rescue ActiveRecord::RecordNotFound
render :action => "not_found", :status => :not_found
end

View file

@ -250,91 +250,51 @@ class ChangesetController < ApplicationController
##
# list edits (open changesets) in reverse chronological order
def list
if request.format == :atom and params[:page]
redirect_to params.merge({ :page => nil }), :status => :moved_permanently
if request.format == :atom and params[:max_id]
redirect_to params.merge({ :max_id => nil }), :status => :moved_permanently
return
end
if params[:display_name]
user = User.find_by_display_name(params[:display_name])
if !user || !user.active?
render_unknown_user params[:display_name]
return
end
end
if (params[:friends] || params[:nearby]) && !@user && request.format == :html
require_user
return
end
if request.format == :html and !params[:bbox]
require_oauth
render :action => :history, :layout => map_layout
else
changesets = conditions_nonempty(Changeset.all)
if params[:display_name]
user = User.find_by_display_name(params[:display_name])
if user and user.active?
if user.data_public? or user == @user
changesets = changesets.where(:user_id => user.id)
else
changesets = changesets.where("false")
end
if user.data_public? or user == @user
changesets = changesets.where(:user_id => user.id)
else
render_unknown_user params[:display_name]
return
changesets = changesets.where("false")
end
elsif params[:bbox]
changesets = conditions_bbox(changesets, BoundingBox.from_bbox_params(params))
elsif params[:friends] && @user
changesets = changesets.where(:user_id => @user.friend_users.public)
elsif params[:nearby] && @user
changesets = changesets.where(:user_id => @user.nearby)
end
if params[:friends]
if @user
changesets = changesets.where(:user_id => @user.friend_users.public)
elsif request.format == :html
require_user
return
end
if params[:max_id]
changesets = changesets.where("changesets.id <= ?", params[:max_id])
end
if params[:nearby]
if @user
changesets = changesets.where(:user_id => @user.nearby)
elsif request.format == :html
require_user
return
end
end
@edits = changesets.order("changesets.id DESC").limit(20).preload(:user, :changeset_tags)
if params[:bbox]
bbox = BoundingBox.from_bbox_params(params)
elsif params[:minlon] and params[:minlat] and params[:maxlon] and params[:maxlat]
bbox = BoundingBox.from_lon_lat_params(params)
end
if bbox
changesets = conditions_bbox(changesets, bbox)
bbox_link = render_to_string :partial => "bbox", :object => bbox
end
if user
user_link = render_to_string :partial => "user", :object => user
end
if params[:friends] and @user
@title = t 'changeset.list.title_friend'
@heading = t 'changeset.list.heading_friend'
@description = t 'changeset.list.description_friend'
elsif params[:nearby] and @user
@title = t 'changeset.list.title_nearby'
@heading = t 'changeset.list.heading_nearby'
@description = t 'changeset.list.description_nearby'
elsif user and bbox
@title = t 'changeset.list.title_user_bbox', :user => user.display_name, :bbox => bbox.to_s
@heading = t 'changeset.list.heading_user_bbox', :user => user.display_name, :bbox => bbox.to_s
@description = t 'changeset.list.description_user_bbox', :user => user_link, :bbox => bbox_link
elsif user
@title = t 'changeset.list.title_user', :user => user.display_name
@heading = t 'changeset.list.heading_user', :user => user.display_name
@description = t 'changeset.list.description_user', :user => user_link
elsif bbox
@title = t 'changeset.list.title_bbox', :bbox => bbox.to_s
@heading = t 'changeset.list.heading_bbox', :bbox => bbox.to_s
@description = t 'changeset.list.description_bbox', :bbox => bbox_link
else
@title = t 'changeset.list.title'
@heading = t 'changeset.list.heading'
@description = t 'changeset.list.description'
end
@page = (params[:page] || 1).to_i
@page_size = 20
@edits = changesets.order("changesets.created_at DESC").offset((@page - 1) * @page_size).limit(@page_size).preload(:user, :changeset_tags)
render :action => :list
render :action => :list, :layout => false
end
end

View file

@ -5,9 +5,6 @@ class ExportController < ApplicationController
caches_page :embed
def start
end
#When the user clicks 'Export' we redirect to a URL which generates the export download
def finish
bbox = BoundingBox.from_lon_lat_params(params)

View file

@ -7,6 +7,7 @@ class GeocoderController < ApplicationController
before_filter :authorize_web
before_filter :set_locale
before_filter :require_oauth, :only => [:search]
def search
normalize_params
@ -29,6 +30,8 @@ class GeocoderController < ApplicationController
@sources.push "osm_nominatim"
@sources.push "geonames" if defined?(GEONAMES_USERNAME)
end
render :layout => map_layout
end
def search_latlon

View file

@ -1,9 +1,10 @@
class SiteController < ApplicationController
layout 'site', :except => [:key, :permalink]
layout false, :only => [:key, :permalink]
layout 'site'
layout :map_layout, :only => [:index, :export]
before_filter :authorize_web
before_filter :set_locale
before_filter :redirect_browse_params, :only => :index
before_filter :redirect_map_params, :only => [:index, :edit, :export]
before_filter :require_user, :only => [:edit, :welcome]
before_filter :require_oauth, :only => [:index]
@ -33,6 +34,7 @@ class SiteController < ApplicationController
def key
expires_in 7.days, :public => true
render :layout => false
end
def edit
@ -44,8 +46,6 @@ class SiteController < ApplicationController
return
end
@extra_body_class = "site-edit-#{editor}"
if params[:node]
bbox = Node.find(params[:node]).bbox.to_unscaled
@lat = bbox.centre_lat
@ -72,6 +72,12 @@ class SiteController < ApplicationController
def welcome
end
def help
end
def about
end
def preview
render :text => RichText.new(params[:format], params[:text]).to_html
end
@ -82,6 +88,18 @@ class SiteController < ApplicationController
private
def redirect_browse_params
if params[:node]
redirect_to node_path(params[:node])
elsif params[:way]
redirect_to way_path(params[:way])
elsif params[:relation]
redirect_to relation_path(params[:relation])
elsif params[:note]
redirect_to browse_note_path(params[:note])
end
end
def redirect_map_params
anchor = []

View file

@ -94,6 +94,14 @@ module ApplicationHelper
end
def body_class
[params[:controller], "#{params[:controller]}-#{params[:action]}", @extra_body_class].compact.join(" ")
if content_for? :body_class
content_for :body_class
else
"#{params[:controller]} #{params[:controller]}-#{params[:action]}"
end
end
def current_page_class(path)
:current if current_page?(path)
end
end

View file

@ -1,8 +1,4 @@
module BrowseHelper
def link_to_page(page, page_param)
return link_to(page, page_param => page)
end
def printable_name(object, version=false)
if object.id.is_a?(Array)
id = object.id[0]
@ -61,6 +57,18 @@ module BrowseHelper
end
end
def type_and_paginated_count(type, pages)
if pages.page_count == 1
t "browse.changeset.#{type}",
:count => pages.item_count
else
t "browse.changeset.#{type}_paginated",
:x => pages.current_page.first_item,
:y => pages.current_page.last_item,
:count => pages.item_count
end
end
private
ICON_TAGS = [

View file

@ -0,0 +1,32 @@
module ChangesetHelper
def changeset_user_link(changeset)
if changeset.user.data_public?
link_to(changeset.user.display_name, user_path(changeset.user.display_name))
else
t('browse.anonymous')
end
end
def changeset_details(changeset)
if changeset.closed_at > DateTime.now
action = :created
time = distance_of_time_in_words_to_now(changeset.created_at)
title = l(changeset.created_at)
else
action = :closed
time = distance_of_time_in_words_to_now(changeset.closed_at)
title = "#{t('browse.created')}: #{l(changeset.created_at)}&#10;#{t('browse.closed')}: #{l(changeset.closed_at)}".html_safe
end
if params.key?(:display_name)
t "browse.#{action}_html",
:time => time,
:title => title
else
t "browse.#{action}_by_html",
:time => time,
:title => title,
:user => changeset_user_link(changeset)
end
end
end

View file

@ -2,7 +2,9 @@ module GeocoderHelper
def result_to_html(result)
html_options = { :class => "set_position", :data => {} }
if result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat]
if result[:type] and result[:id]
url = url_for(:controller => :browse, :action => result[:type], :id => result[:id])
elsif result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat]
url = "?minlon=#{result[:min_lon]}&minlat=#{result[:min_lat]}&maxlon=#{result[:max_lon]}&maxlat=#{result[:max_lat]}"
else
url = "?mlat=#{result[:lat]}&mlon=#{result[:lon]}&zoom=#{result[:zoom]}"
@ -17,14 +19,7 @@ module GeocoderHelper
html << " " if result[:prefix] and result[:name]
html << link_to(result[:name], url, html_options) if result[:name]
html << result[:suffix] if result[:suffix]
if result[:type] and result[:id]
html << content_tag(:small, :class => ["deemphasize", "search_details"]) do
link_to(t("browse.#{result[:type]}_history.view_details"), :controller => :browse, :action => result[:type], :id => result[:id])
end
end
return raw(html)
html.html_safe
end
def describe_location(lat, lon, zoom = nil, language = nil)

View file

@ -1,9 +1,16 @@
module NoteHelper
def note_event(at, by)
def note_event(event, at, by)
if by.nil?
I18n.t("browse.note.at_html", :when => friendly_date(at)).html_safe
I18n.t("browse.note." + event + "_by_anonymous",
:when => friendly_date(at),
:exact_time => l(at)
).html_safe
else
I18n.t("browse.note.at_by_html", :when => friendly_date(at), :user => note_author(by)).html_safe
I18n.t("browse.note." + event + "_by",
:when => friendly_date(at),
:exact_time => l(at),
:user => note_author(by)
).html_safe
end
end
@ -14,4 +21,5 @@ module NoteHelper
link_to h(author.display_name), link_options.merge({:controller => "user", :action => "view", :display_name => author.display_name})
end
end
end

View file

@ -0,0 +1,6 @@
module TitleHelper
def set_title(title = false)
response.headers["X-Page-Title"] = t('layouts.project_name.title') + (title ? ' | ' + title : '')
@title = title
end
end

View file

@ -1,78 +0,0 @@
<div class='column-1'>
<div class='browse-section common'>
<div>
<h4><%= t 'browse.changeset_details.created_at' %></h4>
<p><%= l changeset_details.created_at %></p>
</div>
<div>
<h4><%= t 'browse.changeset_details.closed_at' %></h4>
<p><%= l changeset_details.closed_at %></p>
</div>
<% if changeset_details.user.data_public? %>
<div>
<h4><%= t 'browse.changeset_details.belongs_to' %></h4>
<p><%= link_to h(changeset_details.user.display_name), :controller => "user", :action => "view", :display_name => changeset_details.user.display_name %></p>
</div>
<% end %>
</div>
<%= render :partial => "tag_details", :object => changeset_details %>
<div class='browse-section clearfix'>
<h4><%= t 'browse.changeset_details.bounding_box' %></h4>
<% unless changeset_details.has_valid_bbox? %>
<p><%= t 'browse.changeset_details.no_bounding_box' %></p>
<% else bbox = changeset_details.bbox.to_unscaled %>
<div class='bbox'>
<div class='max_lat'><%=bbox.max_lat -%></div>
<div class='min_lon'><%=bbox.min_lon -%></div>
<div class='box'>(<%= link_to t('browse.changeset_details.box'), root_path(:minlon => bbox.min_lon, :minlat => bbox.min_lat, :maxlon => bbox.max_lon, :maxlat => bbox.max_lat, :box => 'yes'), :title => t('browse.changeset_details.show_area_box') %>)</div>
<div class='max_lon'><%=bbox.max_lon -%></div>
<div class='min_lat'><%= bbox.min_lat -%></div>
</div>
<% end %>
</div>
<% unless @nodes.empty? %>
<div class='browse-section clearfix'>
<h4><%= t 'browse.changeset_details.has_nodes', :count => @node_pages.item_count %></h4>
<ul>
<% @nodes.each do |node| %>
<li><%= link_to h(printable_name(node, true)), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %></li>
<% end %>
</ul>
</div>
<%= render :partial => 'paging_nav', :locals => { :pages => @node_pages, :page_param => "node_page"} %>
<% end %>
<% unless @ways.empty? %>
<div class='browse-section clearfix'>
<h4><%= t 'browse.changeset_details.has_ways', :count => @way_pages.item_count %></h4>
<ul>
<% @ways.each do |way| %>
<li><%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
<%=
#render :partial => "containing_relation", :collection => changeset_details.containing_relation_members
%>
</ul>
</div>
<%= render :partial => 'paging_nav', :locals => { :pages => @way_pages, :page_param => "way_page" } %>
<% end %>
<% unless @relations.empty? %>
<div class='browse-section clearfix'>
<h4><%= t 'browse.changeset_details.has_relations', :count => @relation_pages.item_count %></h4>
<ul>
<% @relations.each do |relation| %>
<li><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></li>
<% end %>
</ul>
</div>
<%= render :partial => 'paging_nav', :locals => { :pages => @relation_pages, :page_param => "relation_page" } %>
<% end %>
</div>

View file

@ -1,39 +1,33 @@
<div class='browse-section common'>
<div>
<% if common_details.visible? %>
<h4><%= t 'browse.common_details.edited_at' %></h4>
<% else %>
<h4><%= t 'browse.common_details.deleted_at' %></h4>
<% end %>
<p><%= l common_details.timestamp %></p>
</div>
<% if common_details.changeset.user.data_public? %>
<div>
<% if common_details.visible? %>
<h4><%= t 'browse.common_details.edited_by' %></h4>
<% else %>
<h4><%= t 'browse.common_details.deleted_by' %></h4>
<% end %>
<p><%= link_to h(common_details.changeset.user.display_name), :controller => "user", :action => "view", :display_name => common_details.changeset.user.display_name %></p>
</div>
<% end %>
<div>
<h4><%= t 'browse.common_details.version' %></h4>
<p><%= h(common_details.version) %></p>
</div>
<div>
<h4><%= t 'browse.common_details.in_changeset' %></h4>
<p><%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %></p>
</div>
<h4>
<% if common_details.changeset.tags['comment'].present? %>
<div>
<h4><%= t 'browse.common_details.changeset_comment' %></h4>
<p><%= linkify(h(common_details.changeset.tags['comment'])) %></p>
</div>
<%= linkify(h(common_details.changeset.tags['comment'])) %>
<% else %>
<%= t 'browse.no_comment' %>
<% end %>
</h4>
<div class="details">
<%=
t "browse.#{common_details.visible? ? :edited : :deleted}_by_html",
:time => distance_of_time_in_words_to_now(common_details.timestamp),
:user => changeset_user_link(common_details.changeset),
:title => l(common_details.timestamp)
%>
</div>
<%= render :partial => "tag_details", :object => common_details %>
<div class="details">
<%= t 'browse.version' %>
#<%= h(common_details.version) %>
&middot;
<%= t 'browse.in_changeset' %>
#<%= link_to common_details.changeset_id, :action => :changeset, :id => common_details.changeset_id %>
</div>
<% if @type == "node" %>
<div class="details geo">
Location:
<%= link_to(content_tag(:span, number_with_delimiter(common_details.lat), :class => "latitude") + ", " + content_tag(:span, number_with_delimiter(common_details.lon), :class => "longitude"), {:controller => 'site', :action => 'index', :lat => h(common_details.lat), :lon => h(common_details.lon), :zoom => "18"}) %>
</div>
<% end %>
<%= render :partial => "tag_details", :object => common_details.tags %>

View file

@ -1,78 +0,0 @@
<div id="browse_map" class='clearfix content_map'>
<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible? %>
<% content_for :head do %>
<%= javascript_include_tag "browse" %>
<% end %>
<%
if map.instance_of? Changeset
bbox = map.bbox.to_unscaled
data = {
:type => "changeset",
:id => map.id,
:minlon => bbox.min_lon,
:minlat => bbox.min_lat,
:maxlon => bbox.max_lon,
:maxlat => bbox.max_lat
}
elsif map.instance_of? Note
data = {
:type => "note",
:id => map.id,
:lon => map.lon,
:lat => map.lat
}
else
data = {
:type => map.class.name.downcase,
:id => map.id,
:version => map.version,
:visible => map.visible
}
end
%>
<%= content_tag "div", "", :id => "small_map", :data => data %>
<span id="loading"><%= t 'browse.map.loading' %></span>
<ul class='secondary-actions clearfix'>
<li>
<% if map.instance_of? Note -%>
<%= link_to t("browse.map.larger.area"),
root_path(:notes => "yes"),
:id => "area_larger_map",
:class => "geolink bbox" %>
<% else -%>
<%= link_to t("browse.map.larger.area"),
root_path(:box => "yes"),
:id => "area_larger_map",
:class => "geolink bbox" %>
<% end -%>
</li>
<li>
<%= render :partial => 'layouts/edit_menu',
:locals => { :link_text => t("browse.map.edit.area"),
:link_class => 'bbox' } %>
</li>
</ul>
<% unless map.instance_of? Changeset %>
<ul class='secondary-actions clearfix'>
<li>
<%= link_to t("browse.map.larger." + map.class.to_s.downcase),
root_path,
:id => "object_larger_map",
:class => "geolink object" %>
</li>
<li>
<%= render :partial => 'layouts/edit_menu',
:locals => { :link_text => t("browse.map.edit." + map.class.to_s.downcase),
:link_class => 'object' } %>
</li>
</ul>
<% end %>
<% else %>
<%= t 'browse.map.deleted' %>
<% end %>
</div>

View file

@ -1,43 +0,0 @@
<% type = (@next || @prev).class.name.downcase %>
<ul class='secondary-actions clearfix pager'>
<% if @prev %>
<li>
<%= link_to t('browse.navigation.paging.all.prev', :id => @prev.id.to_s),
{ :id => @prev.id },
{ :title => t("browse.navigation.all.prev_#{type}_tooltip") } %>
</li>
<% end %>
<% if @next %>
<li>
<%= link_to t('browse.navigation.paging.all.next', :id => @next.id.to_s),
{ :id => @next.id },
{ :title => t("browse.navigation.all.next_#{type}_tooltip") } %>
</li>
<% end %>
</ul>
<% if @next_by_user or @prev_by_user %>
<ul class='secondary-actions pager clearfix'>
<% if @prev_by_user %>
<li>
<%= link_to t('browse.navigation.paging.user.prev', :id => @prev_by_user.id.to_s),
{ :id => @prev_by_user.id },
{ :title => t("browse.navigation.user.prev_#{type}_tooltip", :user => @prev_by_user.user.display_name) } %>
</li>
<% end %>
<li>
<%=
user = (@prev_by_user || @next_by_user).user.display_name
link_to h(user),
{ :controller => "changeset", :action => "list", :display_name => user },
{ :title => t("browse.navigation.user.name_#{type}_tooltip", :user => h(user)) }
%>
</li>
<% if @next_by_user %>
<li>
<%= link_to t('browse.navigation.paging.user.next', :id => @next_by_user.id.to_s),
{ :id => @next_by_user.id },
{ :title => t("browse.navigation.user.next_#{type}_tooltip", :user => @next_by_user.user.display_name) } %>
</li>
<% end %>
</ul>
<% end %>

View file

@ -0,0 +1,23 @@
<% if node.redacted? %>
<div class='browse-section browse-redacted'>
<%= t 'browse.redacted.message_html',
:type => t('browse.redacted.type.node'),
:version => node.version,
:redaction_link => link_to(t('browse.redacted.redaction',
:id => node.redaction.id), node.redaction) %>
</div>
<% else %>
<div class='browse-section browse-node'>
<%= render :partial => "common_details", :object => node %>
<% unless node.ways.empty? and node.containing_relation_members.empty? %>
<h4><%= t 'browse.part_of' %></h4>
<ul>
<% node.ways.each do |way| %>
<li><%= link_to h(printable_name(way)), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
<%= render :partial => "containing_relation", :collection => node.containing_relation_members %>
</ul>
<% end %>
</div>
<% end %>

View file

@ -1,28 +0,0 @@
<div class="browse_details" id="<%= node_details.version %>">
<% if node_details.redacted? %>
<div class='browse-section'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.node'), :redaction_link => link_to(t('browse.redacted.redaction', :id => node_details.redaction.id), node_details.redaction), :version => node_details.version %>
</div>
<% else %>
<%= render :partial => "common_details", :object => node_details %>
<% if node_details.visible -%>
<div class='browse-section'>
<h4><%= t 'browse.node_details.coordinates' %></h4>
<div class="geo"><%= link_to(content_tag(:span, number_with_delimiter(node_details.lat), :class => "latitude") + ", " + content_tag(:span, number_with_delimiter(node_details.lon), :class => "longitude"), {:controller => 'site', :action => 'index', :lat => h(node_details.lat), :lon => h(node_details.lon), :zoom => "18"}) %></div>
</div>
<% end -%>
<% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %>
<div class='browse-section'>
<h4><%= t 'browse.node_details.part_of' %></h4>
<ul>
<% node_details.ways.each do |way| %>
<li><%= link_to h(printable_name(way)), { :action => "way", :id => way.id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
<%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %>
</ul>
</div>
<% end %>
<% end %>
</div>

View file

@ -1,14 +1,5 @@
<div>
<% current_page = pages.current_page %>
<%= t'browse.paging_nav.showing_page' %>
<%= current_page.number %> (<%= current_page.first_item %><%
if (current_page.first_item < current_page.last_item) # if more than 1 trace on page
%>-<%= current_page.last_item %><%
end %>
<%= t'browse.paging_nav.of'%> <%= pages.item_count %>)
<% if pages.page_count > 1 %>
| <%= raw pagination_links_each(pages, {}) { |n| link_to_page(n, page_param) } %>
<span class="paginate">
<%= raw pagination_links_each(pages, {}) { |n| link_to(n, page_param => n) } %>
</span>
<% end %>
</div>

View file

@ -0,0 +1,23 @@
<% if relation.redacted? %>
<div class='browse-section browse-redacted'>
<%= t 'browse.redacted.message_html',
:type => t('browse.redacted.type.relation'),
:version => relation.version,
:redaction_link => link_to(t('browse.redacted.redaction',
:id => relation.redaction.id), relation.redaction) %><
</div>
<% else %>
<div class='browse-section browse-relation'>
<%= render :partial => "common_details", :object => relation %>
<% unless relation.relation_members.empty? %>
<h4><%= t'browse.relation.members' %></h4>
<ul><%= render :partial => "relation_member", :collection => relation.relation_members %></ul>
<% end %>
<% unless relation.containing_relation_members.empty? %>
<h4><%= t'browse.part_of' %></h4>
<ul><%= render :partial => "containing_relation", :collection => relation.containing_relation_members %></ul>
<% end %>
</div>
<% end %>

View file

@ -1,23 +0,0 @@
<div class="browse_details" id="<%= relation_details.version %>">
<% if relation_details.redacted? %>
<div class='browse-section'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.relation'), :redaction_link => link_to(t('browse.redacted.redaction', :id => relation_details.redaction.id), relation_details.redaction), :version => relation_details.version %><
</div>
<% else %>
<%= render :partial => "common_details", :object => relation_details %>
<% unless relation_details.relation_members.empty? %>
<div class='browse-section'>
<h4><%= t'browse.relation_details.members' %></h4>
<ul><%= render :partial => "relation_member", :collection => relation_details.relation_members %></ul>
</div>
<% end %>
<% unless relation_details.containing_relation_members.empty? %>
<div class='browse-section'>
<h4><%= t'browse.relation_details.part_of' %></h4>
<ul><%= render :partial => "containing_relation", :collection => relation_details.containing_relation_members %></ul>
</div>
<% end %>
<% end %>
</div>

View file

@ -1 +1,4 @@
<li><%= format_key(tag[0]) %> = <%= format_value(tag[0], tag[1]) %></li>
<li class='clearfix'>
<span class='browse-tag-k'><%= format_key(tag[0]) %></span>
<span class='browse-tag-v'><%= format_value(tag[0], tag[1]) %></span>
</li>

View file

@ -1,6 +1,6 @@
<% unless tag_details.tags.empty? %>
<div class='browse-section'>
<h4><%= t'browse.tag_details.tags' %></h4>
<ul><%= render :partial => "tag", :collection => tag_details.tags.sort %></ul>
</div>
<% end %>
<% unless tag_details.empty? %>
<h4><%= t 'browse.tag_details.tags' %></h4>
<ul class='browse-tag-list'>
<%= render :partial => "tag", :collection => tag_details.sort %>
</ul>
<% end %>

View file

@ -0,0 +1,35 @@
<% if way.redacted? %>
<div class='browse-section browse-redacted'>
<%= t 'browse.redacted.message_html',
:type => t('browse.redacted.type.way'),
:version => way.version,
:redaction_link => link_to(t('browse.redacted.redaction',
:id => way.redaction.id), way.redaction) %>
</div>
<% else %>
<div class='browse-section browse-way'>
<%= render :partial => "common_details", :object => way %>
<% unless way.way_nodes.empty? %>
<h4><%= t'browse.way.nodes' %></h4>
<ul>
<% way.way_nodes.each do |wn| %>
<li>
<%= link_to h(printable_name(wn.node)), { :action => "node", :id => wn.node_id.to_s }, :class => link_class('node', wn.node), :title => link_title(wn.node) %>
<% related_ways = wn.node.ways.reject { |w| w.id == wn.way_id } %>
<% if related_ways.size > 0 then %>
(<%= raw t 'browse.way.also_part_of', :count => related_ways.size, :related_ways => related_ways.map { |w| link_to(h(printable_name(w)), { :action => "way", :id => w.id.to_s }, :class => link_class('way', w), :title => link_title(w) ) }.to_sentence %>)
<% end %>
</li>
<% end %>
</ul>
<% end %>
<% unless way.containing_relation_members.empty? %>
<h4><%= t'browse.part_of' %></h4>
<ul>
<%= render :partial => "containing_relation", :collection => way.containing_relation_members %>
</ul>
<% end %>
</div>
<% end %>

View file

@ -1,34 +0,0 @@
<div class="browse_details" id="<%= way_details.version %>">
<% if way_details.redacted? %>
<div class='browse-section'>
<%= t 'browse.redacted.message_html', :type => t('browse.redacted.type.way'), :redaction_link => link_to(t('browse.redacted.redaction', :id => way_details.redaction.id), way_details.redaction), :version => way_details.version %>
</div>
<% else %>
<%= render :partial => "common_details", :object => way_details %>
<% unless way_details.way_nodes.empty? %>
<div class='browse-section'>
<h4><%= t'browse.way_details.nodes' %></h4>
<ul>
<% way_details.way_nodes.each do |wn| %>
<li>
<%= link_to h(printable_name(wn.node)), { :action => "node", :id => wn.node_id.to_s }, :class => link_class('node', wn.node), :title => link_title(wn.node) %>
<% related_ways = wn.node.ways.reject { |w| w.id == wn.way_id } %>
<% if related_ways.size > 0 then %>
(<%= raw t 'browse.way_details.also_part_of', :count => related_ways.size, :related_ways => related_ways.map { |w| link_to(h(printable_name(w)), { :action => "way", :id => w.id.to_s }, :class => link_class('way', w), :title => link_title(w) ) }.to_sentence %>)
<% end %>
</li>
<% end %>
</ul>
</div>
<% end %>
<% unless way_details.containing_relation_members.empty? %>
<div class='browse-section'>
<h4><%= t'browse.way_details.part_of' %></h4>
<ul>
<%= render :partial => "containing_relation", :collection => way_details.containing_relation_members %>
</ul>
<% end %>
<% end %>
</div>

View file

@ -1,18 +1,72 @@
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% set_title(t('browse.changeset.title', :id => @changeset.id)) %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t('browse.changeset.title', :id => @changeset.id) %>
</h2>
<div class="browse-section">
<h4><%= @changeset.tags['comment'].to_s.presence || t('browse.no_comment') %></h4>
<div class="details"><%= changeset_details(@changeset) %></div>
<%= render :partial => "tag_details", :object => @changeset.tags.except('comment') %>
<% unless @ways.empty? %>
<h4>
<%= type_and_paginated_count('way', @way_pages) %>
<%= render :partial => 'paging_nav', :locals => { :pages => @way_pages, :page_param => "way_page" } %>
</h4>
<ul>
<% @ways.each do |way| %>
<li><%= link_to h(printable_name(way, true)), { :action => "way", :id => way.way_id.to_s }, :class => link_class('way', way), :title => link_title(way) %></li>
<% end %>
</ul>
<% end %>
<% unless @relations.empty? %>
<h4>
<%= type_and_paginated_count('relation', @relation_pages) %>
<%= render :partial => 'paging_nav', :locals => { :pages => @relation_pages, :page_param => "relation_page" } %>
</h4>
<ul>
<% @relations.each do |relation| %>
<li><%= link_to h(printable_name(relation, true)), { :action => "relation", :id => relation.relation_id.to_s }, :class => link_class('relation', relation), :title => link_title(relation) %></li>
<% end %>
</ul>
<% end %>
<% unless @nodes.empty? %>
<h4>
<%= type_and_paginated_count('node', @node_pages) %>
<%= render :partial => 'paging_nav', :locals => { :pages => @node_pages, :page_param => "node_page"} %>
</h4>
<ul>
<% @nodes.each do |node| %>
<li><%= link_to h(printable_name(node, true)), { :action => "node", :id => node.node_id.to_s }, :class => link_class('node', node), :title => link_title(node) %></li>
<% end %>
</ul>
<% end %>
</div>
<% if @next_by_user || @prev_by_user %>
<div class='secondary-actions'>
<% if @prev_by_user %>
<%= link_to "<< #{@prev_by_user.id}", :id => @prev_by_user.id %>
&middot;
<% end %>
<%=
user = (@prev_by_user || @next_by_user).user.display_name
link_to user, :controller => "changeset", :action => "list", :display_name => user
%>
<% if @next_by_user %>
&middot;
<%= link_to "#{@next_by_user.id} >>", :id => @next_by_user.id %>
<% end %>
</div>
<% end %>
<% content_for :heading do %>
<h2><%= t 'browse.changeset.changeset', :id => @changeset.id %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %></li>
<li><%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %></li>
</ul>
<% end %>
<%= render :partial => "navigation" %>
<% if @changeset.has_valid_bbox? %>
<%= render :partial => "map", :object => @changeset %>
<% end %>
<%= render :partial => "changeset_details", :object => @changeset %>
<div class='secondary-actions'>
<%= link_to(t('browse.changeset.changesetxml'), :controller => "changeset", :action => "read") %>
&middot;
<%= link_to(t('browse.changeset.osmchangexml'), :controller => "changeset", :action => "download") %>
</div>

View file

@ -0,0 +1,14 @@
<% set_title(t("browse.#{@type}.title", :name => printable_name(@feature))) %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t("browse.#{@type}.title", :name => printable_name(@feature)) %>
</h2>
<%= render :partial => @type, :object => @feature %>
<div class='secondary-actions'>
<%= link_to(t('browse.download_xml'), :controller => @type, :action => "read") %>
&middot;
<%= link_to(t('browse.view_history'), :action => "#{@type}_history") %>
</div>

View file

@ -0,0 +1,14 @@
<% set_title(t("browse.#{@type}.history_title", :name => printable_name(@feature))) %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t("browse.#{@type}.history_title", :name => printable_name(@feature)) %>
</h2>
<%= render :partial => @type, :collection => @feature.send("old_#{@type}s").reverse %>
<div class='secondary-actions'>
<%= link_to(t('browse.download_xml'), :controller => "old_#{@type}", :action => "history") %>
&middot;
<%= link_to(t('browse.view_details'), :action => @type) %>
</div>

View file

@ -0,0 +1,18 @@
<% set_title(t "browse.note.new_note") %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t "browse.note.new_note" %>
</h2>
<div class="note browse-section">
<p class="warning"><%= t('javascripts.notes.new.intro') %></p>
<form action="#">
<input type="hidden" name="lon">
<input type="hidden" name="lat">
<textarea class="comment" name="text" cols="40" rows="10"></textarea>
<div class="buttons clearfix">
<input type="submit" name="add" value="<%= t('javascripts.notes.new.add') %>" disabled="1">
</div>
</form>
</div>

View file

@ -1,27 +0,0 @@
<%
@name = printable_name @node
@title = t('browse.node.node') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= t'browse.node.node_title', :node_name => @name %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.node.download_xml'), :controller => "node", :action => "read") %></li>
<li><%= link_to(t('browse.node.view_history'), :action => "node_history") %></li>
<% if @node.visible -%>
<li><%= link_to(t('browse.node.edit'), :controller => "site", :action => "edit", :lat => @node.lat, :lon => @node.lon, :zoom => 18, :node => @node.id) %></li>
<% end -%>
</ul>
<% end %>
<%= render :partial => "navigation" %>
<% if @node.visible -%>
<%= render :partial => "map", :object => @node %>
<% end -%>
<div class='column-1'>
<%= render :partial => "node_details", :object => @node %>
</div>

View file

@ -1,25 +0,0 @@
<%
@name = printable_name @node
@title = t('browse.node_history.node_history') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= raw t'browse.node_history.node_history_title', :node_name => link_to(h(@name), :action => "node", :id => @node.id) %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.node_history.download_xml'), :controller => "old_node", :action => "history") %></li>
<li><%= link_to(t('browse.node_history.view_details'), :action => "node") %></li>
</ul>
<% end %>
<% if @node.visible -%>
<%= render :partial => "map", :object => @node %>
<% end -%>
<div class='column-1'>
<% @node.old_nodes.reverse.each do |node| %>
<%= render :partial => "node_details", :object => node %>
<% end %>
</div>

View file

@ -6,4 +6,7 @@
'changeset' => I18n.t('browse.not_found.type.changeset'),
};
%>
<p><%= t'browse.not_found.sorry', :type=> browse_not_found_type[@type] , :id => params[:id] %></p>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t'browse.not_found.sorry', :type=> browse_not_found_type[@type] , :id => params[:id] %></h2>

View file

@ -1,67 +1,57 @@
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% set_title(t('browse.note.title', :id => @note.id)) %>
<% content_for :heading do %>
<h2>
<%= image_tag "#{@note.status}_note_marker.png", :alt => @note.status %>
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
</h2>
<% end %>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t "browse.note.#{@note.status}_title", :note_name => @note.id %>
</h2>
<%= render :partial => "navigation" %>
<div class="browse-section">
<h4><%= t('browse.note.mine.description') %></h4>
<div class="note-description">
<%= h(@note.comments.first.body.to_html) %>
</div>
<%= render :partial => "map", :object => @note %>
<div class='column-1'>
<div class="details" data-coordinates="<%= @note.lat %>,<%= @note.lon %>" data-status="<%= @note.status %>">
<%= note_event('open', @note.created_at, @note.author) %>
<% if @note.status == "closed" %>
<br/>
<%= note_event(@note.status, @note.closed_at, @note.comments.last.author) %>
<% end %>
</div>
<% if @note.comments.find { |comment| comment.author.nil? } -%>
<div class='browse-section common'>
<p class="warning"><%= t "javascripts.notes.show.anonymous_warning" %></p>
</div>
<p class='warning'><%= t "javascripts.notes.show.anonymous_warning" %></p>
<% end -%>
<div class='browse-section common'>
<div>
<h4><%= t "browse.note.opened" %></h4>
<p><%= note_event(@note.created_at, @note.author) %></p>
</div>
<% if @note.status == "closed" %>
<div>
<h4><%= t "browse.note.closed" %></h4>
<p><%= note_event(@note.closed_at, @note.comments.last.author) %></p>
</div>
<% elsif @note.comments.length > 1 %>
<div>
<h4><%= t "browse.note.last_modified" %></h4>
<p><%= note_event(@note.updated_at, @note.comments.last.author) %></p>
</div>
<% end %>
<div id="c<%= @note.comments.first.id %>">
<h4><%= t "browse.note.description" %></h4>
<p><%= h(@note.comments.first.body.to_html) %></p>
</div>
<div>
<h4><%= t "browse.node_details.coordinates" %></h4>
<p class="geo"><%= link_to ("<span class='latitude'>#{number_with_delimiter(@note.lat)}</span>, <span class='longitude'>#{number_with_delimiter(@note.lon)}</span>".html_safe), {:controller => 'site', :action => 'index', :lat => h(@note.lat), :lon => h(@note.lon), :zoom => "18"} %></p>
</div>
</div>
<% if @note.comments.length > 1 %>
<div class='browse-section clearfix'>
<h4><%= t "browse.note.comments" %></h4>
<div class='note-comments'>
<ul>
<% @note.comments[1..-1].each do |comment| %>
<li id="c<%= comment.id %>">
<small class='deemphasize'><%= note_event(comment.event, comment.created_at, comment.author) %></small>
<%= comment.body.to_html %>
<small class="deemphasize"><%= note_event(comment.created_at, comment.author) %></small>
</li>
<% end %>
</ul>
</div>
<% end %>
<% if @note.status == "open" %>
<form action="#">
<textarea class="comment" name="text" cols="40" rows="5"></textarea>
<div class="buttons clearfix">
<input type="submit" name="hide" value="<%= t('javascripts.notes.show.hide') %>" class="hide_unless_moderator deemphasize" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, 'json') %>">
<input type="submit" name="close" value="<%= t('javascripts.notes.show.resolve') %>" class="hide_unless_logged_in" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= close_note_url(@note, 'json') %>">
<input type="submit" name="comment" value="<%= t('javascripts.notes.show.comment') %>" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= comment_note_url(@note, 'json') %>" disabled="1">
</div>
</form>
<% else %>
<form action="#">
<input type="hidden" name="text" value="">
<div class="buttons clearfix">
<input type="submit" name="hide" value="<%= t('javascripts.notes.show.hide') %>" class="hide_unless_moderator deemphasize" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, 'json') %>">
<input type="submit" name="reopen" value="<%= t('javascripts.notes.show.reactivate') %>" class="hide_unless_logged_in" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= reopen_note_url(@note, 'json') %>">
</div>
</form>
<% end %>
</div>

View file

@ -1,21 +0,0 @@
<%
@name = printable_name @relation
@title = t('browse.relation.relation') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= t'browse.relation.relation_title', :relation_name => @name %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.relation.download_xml'), :controller => "relation", :action => "read") %></li>
<li><%= link_to(t('browse.relation.view_history'), :action => "relation_history") %></li>
</ul>
<% end %>
<%= render :partial => "navigation" %>
<%= render :partial => "map", :object => @relation %>
<div class='column-1'>
<%= render :partial => "relation_details", :object => @relation %>
</div>

View file

@ -1,22 +0,0 @@
<%
@name = printable_name @relation
@title = t('browse.relation_history.relation_history') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= raw t'browse.relation_history.relation_history_title', :relation_name => link_to(h(@name), :action => "relation", :id => @relation.id) %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.relation_history.download_xml'), :controller => "old_relation", :action => "history") %></li>
<li><%= link_to(t('browse.relation_history.view_details'), :action => "relation") %></li>
</ul>
<% end %>
<%= render :partial => "map", :object => @relation %>
<div class='column-1'>
<% @relation.old_relations.reverse.each do |relation| %>
<%= render :partial => "relation_details", :object => relation %>
<% end %>
</div>

View file

@ -1,6 +0,0 @@
<div id="browse_controls" class='inner12'>
<a id="browse_filter_toggle" class="button" href="#"><%= t'browse.start_rjs.manually_select' %></a>
<a id="browse_hide_areas_box" class="button" href="#"><%= t'browse.start_rjs.hide_areas' %></a>
</div>
<div id="browse_status" class='inner12'></div>
<div id="browse_content"></div>

View file

@ -1,23 +0,0 @@
<%
@name = printable_name @way
@title = t('browse.way.way') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= t'browse.way.way_title', :way_name => @name %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.way.download_xml'), :controller => "way", :action => "read") %></li>
<li><%= link_to(t('browse.way.view_history'), :action => "way_history") %></li>
<li><%= link_to(t('browse.way.edit'), :controller => "site", :action => "edit", :way => @way.id) %></li>
</ul>
<% end %>
<%= render :partial => "navigation" %>
<%= render :partial => "map", :object => @way %>
<div class='column-1'>
<%= render :partial => "way_details", :object => @way %>
</div>

View file

@ -1,22 +0,0 @@
<%
@name = printable_name @way
@title = t('browse.way_history.way_history') + ' | ' + @name
%>
<% content_for :head do %>
<%= stylesheet_link_tag 'browse' %>
<% end %>
<% content_for :heading do %>
<h2><%= raw t'browse.way_history.way_history_title', :way_name => link_to(h(@name), :action => "way", :id => @way.id) %></h2>
<ul class='secondary-actions clearfix'>
<li><%= link_to(t('browse.way_history.download_xml'), :controller => "old_way", :action => "history") %></li>
<li><%= link_to(t('browse.way_history.view_details'), :action => "way") %></li>
</ul>
<% end %>
<%= render :partial => "map", :object => @way %>
<div class='column-1'>
<% @way.old_ways.reverse.each do |way| %>
<%= render :partial => "way_details", :object => way %>
<% end %>
</div>

View file

@ -1 +0,0 @@
xml.a(bbox.to_s, :href => url_for(:controller => "site", :action => "index", :minlon => bbox.min_lon, :minlat => bbox.min_lat, :maxlon => bbox.max_lon, :maxlat => bbox.max_lat, :box => "yes"))

View file

@ -1 +0,0 @@
<%= link_to bbox.to_s, :controller => "site", :action => "index", :minlon => bbox.min_lon, :minlat => bbox.min_lat, :maxlon => bbox.max_lon, :maxlat => bbox.max_lat, :box => "yes" %>

View file

@ -12,39 +12,19 @@
end
%>
<%= content_tag "ul", :class => 'changeset_item', :id => "changeset_#{changeset.id}", :data => {:changeset => changeset_data} do %>
<li>
<span class="changeset_id">
<%=
link_to(changeset.id,
{:controller => 'browse', :action => 'changeset', :id => changeset.id},
{:title => t('changeset.changeset.view_changeset_details')})
%>
</span>
<span class='date'>
<% if changeset.closed_at > DateTime.now %> <%= t'changeset.changeset.still_editing' %>
<% else %><%= l changeset.closed_at, :format => :long %><% end %>
</span>
<%if showusername %>
<span class="user">
<% if changeset.user.data_public? %>
<%= link_to h(changeset.user.display_name), :controller => "changeset", :action => "list", :display_name => changeset.user.display_name %>
<% else %>
<i><%= t'changeset.changeset.anonymous' %></i>
<% end %>
</span>
<% end %>
</li>
<li class="comment deemphasize">
<% if changeset.tags['comment'].to_s != '' %>
<%= linkify(h(changeset.tags['comment'])) %>
<% else %>
<%= t'changeset.changeset.no_comment' %>
<% end %>
</li>
<%= content_tag "li", :id => "changeset_#{changeset.id}", :data => {:changeset => changeset_data} do %>
<h4>
<a class="changeset_id" href="<%= changeset_path(changeset.id) %>">
<% if changeset.tags['comment'].to_s != '' %>
<%= linkify(h(changeset.tags['comment'])) %>
<% else %>
<%= t 'browse.no_comment' %>
<% end %>
</a>
</h4>
<div class="details">
<%= changeset_details(changeset) %>
&middot;
#<%= changeset.id %>
</div>
<% end %>

View file

@ -1,15 +0,0 @@
<ul class='secondary-actions pager clearfix'>
<% if @page > 1 %>
<li><%= link_to t('changeset.changeset_paging_nav.previous'), params.merge({ :page => @page - 1 }) %></li>
<% else %>
<li><%= t('changeset.changeset_paging_nav.previous') %></li>
<% end %>
<li><%= t('changeset.changeset_paging_nav.showing_page', :page => @page) %></li>
<% if @edits.size < @page_size %>
<li><%= t('changeset.changeset_paging_nav.next') %></li>
<% else %>
<li><%= link_to t('changeset.changeset_paging_nav.next'), params.merge({ :page => @page + 1 }) %></li>
<% end %>
</ul>

View file

@ -1,4 +0,0 @@
<% showusername = true if showusername.nil? %>
<div id="changeset_list">
<%= render :partial => 'changeset', :locals => {:showusername => showusername}, :collection => @edits unless @edits.nil? %>
</div>

View file

@ -1,2 +0,0 @@
<div id="changeset_list_map">
</div>

View file

@ -1 +0,0 @@
<%= link_to user.display_name, :controller => "user", :action => "view", :display_name => user.display_name %>

View file

@ -0,0 +1,30 @@
<% content_for :auto_discovery_link_tag do -%>
<% unless params[:friends] or params[:nearby] -%>
<%= auto_discovery_link_tag :atom, params.merge(:max_id => nil, :xhr => nil, :action => :feed) %>
<% end -%>
<% end -%>
<%
if params[:friends] and @user
set_title(t 'changeset.list.title_friend')
@heading = t 'changeset.list.title_friend'
elsif params[:nearby] and @user
set_title(t 'changeset.list.title_nearby')
@heading = t 'changeset.list.title_nearby'
elsif params[:display_name]
set_title(t 'changeset.list.title_user', :user => params[:display_name])
@heading = t('changeset.list.title_user', :user => link_to(params[:display_name], :controller => "user", :action => "view", :display_name => params[:display_name])).html_safe
else
set_title(t 'changeset.list.title')
@heading = t 'changeset.list.title'
end
%>
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= @heading %>
</h2>
<div class="changesets">
<%= image_tag "searching.gif", :class => "loader" %>
</div>

View file

@ -4,12 +4,6 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
"xmlns:georss" => "http://www.georss.org/georss") do |feed|
feed.title @title
feed.subtitle :type => 'xhtml' do |xhtml|
xhtml.p do |p|
p << @description
end
end
feed.updated @edits.map {|e| [e.created_at, e.closed_at].max }.max
feed.icon "http://#{SERVER_URL}/favicon.ico"
feed.logo "http://#{SERVER_URL}/images/mag_map-rss2.0.png"
@ -46,16 +40,16 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
xhtml.style "th { text-align: left } tr { vertical-align: top }"
xhtml.table do |table|
table.tr do |tr|
tr.th t("browse.changeset_details.created_at")
tr.th t("browse.created")
tr.td l(changeset.created_at)
end
table.tr do |tr|
tr.th t("browse.changeset_details.closed_at")
tr.th t("browse.closed")
tr.td l(changeset.closed_at)
end
if changeset.user.data_public?
table.tr do |tr|
tr.th t("browse.changeset_details.belongs_to")
tr.th t("browse.changeset.belongs_to")
tr.td do |td|
td.a h(changeset.user.display_name), :href => url_for(:controller => "user", :action => "view", :display_name => changeset.user.display_name, :only_path => false)
end

View file

@ -1,37 +1,15 @@
<% content_for :head do -%>
<%= javascript_include_tag "changeset" %>
<% end -%>
<% content_for :heading do %>
<h1><%= @heading %></h1>
<ul class='secondary-actions clearfix'>
<li><%= raw(@description) %></li>
<% unless params[:friends] or params[:nearby] -%>
<li><%= atom_link_to params.merge({ :page => nil, :action => :feed }) %></li>
<% end -%>
</ul>
<% end %>
<%= render :partial => 'changeset_paging_nav' %>
<% if @edits.size > 0 %>
<div id='changeset_list_map_wrapper'>
<%= render :partial => 'map' %>
<% if @edits.present? %>
<ol class="changesets">
<%= render :partial => 'changeset', :collection => @edits %>
</ol>
<div class="changeset_more">
<%= link_to t('changeset.list.load_more'), url_for(params.merge(:max_id => @edits.last.id - 1)), :class => "button load_more" %>
<%= image_tag "searching.gif", :class => "loader", :style => "display: none;" %>
</div>
<div class='column-1'>
<%= render :partial => 'changesets', :locals => { :showusername => !params.has_key?(:display_name) } %>
</div>
<%= render :partial => 'changeset_paging_nav' %>
<% elsif @user and @user.display_name == params[:display_name] %>
<h4><%= t('changeset.list.empty_user_html') %></h4>
<% elsif params[:bbox] %>
<div class="inner22"><%= t(params[:max_id] ? 'changeset.list.no_more_area' : 'changeset.list.empty_area') %></div>
<% elsif params[:display_name] %>
<div class="inner22"><%= t(params[:max_id] ? 'changeset.list.no_more_user' : 'changeset.list.empty_user') %></div>
<% else %>
<h4><%= t('changeset.list.empty_anon_html') %></h4>
<div class="inner22"><%= t(params[:max_id] ? 'changeset.list.no_more' : 'changeset.list.empty') %></div>
<% end %>
<% unless params[:friends] or params[:nearby] -%>
<% content_for :head do -%>
<%= auto_discovery_link_tag :atom, params.merge({ :page => nil, :action => :feed }) %>
<% end -%>
<% end -%>

View file

@ -18,7 +18,7 @@
<% end -%>
</table>
<ul class='secondary-actions clearfix'>
<li><%= link_to t('diary_entry.comments.older_comments') , { :page => @comment_pages.current.next} if @comment_pages.current.next %></li>
<li><%= link_to t('diary_entry.comments.newer_comments'), { :page => @comment_pages.current.previous } if @comment_pages.current.previous %></li>
</ul>
<div class='secondary-actions clearfix'>
<span><%= link_to t('diary_entry.comments.older_comments') , { :page => @comment_pages.current.next} if @comment_pages.current.next %>
<%= link_to t('diary_entry.comments.newer_comments'), { :page => @comment_pages.current.previous } if @comment_pages.current.previous %></span>
</div>

View file

@ -3,7 +3,7 @@
<% if @this_user %>
<%= user_image @this_user %>
<% end %>
<h2><%= h(@title) %></h2>
<h1><%= h(@title) %></h1>
<ul class='secondary-actions clearfix'>
<% unless params[:friends] or params[:nearby] -%>

View file

@ -1,48 +0,0 @@
<%= form_tag :controller => "export", :action => "finish" do %>
<%= hidden_field_tag 'format', 'osm' %>
<div class="export_bounds inner12">
<div class='export_area_inputs'>
<%= text_field_tag('maxlat', nil, :size => 10, :class => "export_bound") %>
<br/>
<%= text_field_tag('minlon', nil, :size => 10, :class => "export_bound") %>
<%= text_field_tag('maxlon', nil, :size => 10, :class => "export_bound") %>
<br/>
<%= text_field_tag('minlat', nil, :size => 10, :class => "export_bound") %>
</div>
<a id="drag_box" class='export_hint button' href="#"><%= t'export.start.manually_select' %></a>
</div>
<div id="export_osm">
<h4><%= t'export.start.licence' %></h4>
<div class="export_details inner12">
<p><%= raw t'export.start.export_details' %></p>
</div>
<div id="export_osm_too_large">
<h4><%= t'export.start.too_large.heading' %></h4>
<div class="export_details inner12">
<p><%= t'export.start.too_large.body' %></p>
<dl>
<dt><a href="http://planet.openstreetmap.org/"><%= t'export.start.too_large.planet.title' %></a></dt>
<dd><%= t'export.start.too_large.planet.description' %></dd>
<dt><a href="http://download.geofabrik.de/"><%= t'export.start.too_large.geofabrik.title' %></a></dt>
<dd><%= t'export.start.too_large.geofabrik.description' %></dd>
<dt><a href="http://metro.teczno.com/"><%= t'export.start.too_large.metro.title' %></a></dt>
<dd><%= t'export.start.too_large.metro.description' %></dd>
<dt><a href="http://wiki.openstreetmap.org/wiki/Download"><%= t'export.start.too_large.other.title' %></a></dt>
<dd><%= t'export.start.too_large.other.description' %></dd>
</dl>
</div>
</div>
</div>
<div class="inner12">
<%= submit_tag t('export.start.export_button'), :id => "export_commit" %>
</div>
<% end %>

View file

@ -2,16 +2,14 @@
<p class="search_results_entry inner12"><%= t 'geocoder.results.no_results' %></p>
<% else %>
<ul class='results-list'>
<% @results.each do |result| %>
<li><p class="inner12 search_results_entry clearfix"><%= result_to_html(result) %></p></li>
<% end %>
</ul>
<% @results.each do |result| %>
<li><p class="inner12 search_results_entry clearfix"><%= result_to_html(result) %></p></li>
<% end %>
</ul>
<% if @more_params %>
<div class="search_more">
<div class="inner12 search_results_entry">
<%= link_to t('geocoder.results.more_results'), url_for(@more_params), :class => "button" %>
</div>
<%= image_tag "searching.gif", :class => ["search_searching", "hidden"] %>
<%= link_to t('geocoder.results.more_results'), url_for(@more_params), :class => "button load_more" %>
<%= image_tag "searching.gif", :class => "loader", :style => "display: none;" %>
</div>
<% end %>
<% end %>

View file

@ -1,9 +1,10 @@
<h2>
<a class="geolink" href="<%= root_path %>"><span class="icon close"></span></a>
<%= t('site.sidebar.search_results') %>
</h2>
<% @sources.each do |source| %>
<h4><%= raw(t "geocoder.search.title.#{source}") %></h4>
<div class="search_results_entry" id="<%= "search_#{source}" %>">
<%= image_tag "searching.gif", :class => "search_searching" %>
<h4 class="inner12"><%= raw(t "geocoder.search.title.#{source}") %></h4>
<div class="search_results_entry" data-href="<%= url_for params.merge(:action => "search_#{source}") %>">
<%= image_tag "searching.gif", :class => "loader" %>
</div>
<script type="text/javascript">
$("#search_<%= source %>").load("<%= raw url_for params.merge(:action => "search_#{source}") %>");
</script>
<% end %>

View file

@ -0,0 +1,19 @@
<div id="content" class="<%= content_for :content_class %>">
<% if content_for? :content %>
<%= yield :content %>
<% else %>
<%= render :partial => "layouts/flash", :locals => { :flash => flash } %>
<% if content_for? :heading %>
<div class="content-heading">
<div class="content-inner">
<%= yield :heading %>
</div>
</div>
<% end %>
<div class="content-body">
<div class="content-inner">
<%= yield %>
</div>
</div>
<% end %>
</div>

View file

@ -1,19 +0,0 @@
<div class="dropdown edit_menu">
<%= link_to link_text, edit_path,
:id => 'editanchor',
:data => { :editor => preferred_editor },
:class => "geolink tab #{link_class}" %>
<a class='dropdown-toggle' data-toggle='dropdown' href='#'>
<b class="caret"></b>
</a>
<ul class='dropdown-menu'>
<% Editors::RECOMMENDED_EDITORS.each do |editor| %>
<li>
<%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
edit_path(:editor => editor),
:data => { :editor => editor },
:class => "geolink #{link_class}" %>
</li>
<% end %>
</ul>
</div>

View file

@ -1,11 +1,20 @@
<% if flash[:error] %>
<div id="error" class="flash"><%=image_tag("notice.png", :class => "small_icon", :border=>0)%><%= raw flash[:error] %></div>
<p class="error">
<%= image_tag("notice.png", :class => "small_icon", :border => 0) %>
<%= raw flash[:error] %>
</p>
<% end %>
<% if flash[:warning] %>
<div id="warning" class="flash"><%=image_tag("notice.png", :class => "small_icon", :border=>0)%><%= raw flash[:warning] %></div>
<p class="warning">
<%= image_tag("notice.png", :class => "small_icon", :border => 0) %>
<%= raw flash[:warning] %>
</p>
<% end %>
<% if flash[:notice] %>
<div id="notice" class="flash"><%=image_tag("notice.png", :class => "small_icon", :border=>0)%><%= raw flash[:notice] %></div>
<p class="notice">
<%= image_tag("notice.png", :class => "small_icon", :border => 0) %>
<%= raw flash[:notice] %>
</p>
<% end %>

View file

@ -1,9 +1,10 @@
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
<!--[if lt IE 9]><%= javascript_include_tag "html5shiv" %><![endif]-->
<%= javascript_include_tag "application" %>
<%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:641px)" %>
<%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 642px)" %>
<%= stylesheet_link_tag "small-#{dir}", :media => "only screen and (max-width:721px)" %>
<%= stylesheet_link_tag "large-#{dir}", :media => "screen and (min-width: 722px)" %>
<%= stylesheet_link_tag "print-#{dir}", :media => "print" %>
<%= stylesheet_link_tag "leaflet-all", :media => "screen, print" %>
<!--[if IE]>
@ -25,6 +26,7 @@
<% end -%>
<%= style_rules %>
<%= yield :head %>
<%= yield :auto_discovery_link_tag %>
<%= csrf_meta_tag %>
<script type="text/javascript">
I18n.defaultLocale = "<%= I18n.default_locale %>";
@ -44,5 +46,5 @@
OSM.oauth_consumer_secret = "<%= @oauth.client_application.secret %>";
<% end -%>
</script>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ @title if @title %></title>
<title><%= t 'layouts.project_name.title' %><%= ' | ' + @title if @title %></title>
</head>

View file

@ -0,0 +1,89 @@
<header class="closed">
<h1>
<a href="<%= root_path %>" class="geolink">
<%= image_tag "osm_logo.png", :alt => t('layouts.logo.alt_text'), :class => 'logo' %>
<%= t 'layouts.project_name.h1' %>
</a>
</h1>
<a href="#" id="menu-icon"></a>
<nav class='primary'>
<%= content_for :header %>
<ul>
<li id="edit_tab" class="dropdown <%= current_page_class(edit_path) %>">
<%= link_to t('layouts.edit'), edit_path, :class => "tab geolink editlink",
:id => 'editanchor',
:data => { :editor => preferred_editor }
%><a class='dropdown-toggle' data-toggle='dropdown' href='#'><b class="caret"></b></a>
<ul class='dropdown-menu'>
<% Editors::RECOMMENDED_EDITORS.each do |editor| %>
<li>
<%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
edit_path(:editor => editor),
:data => { :editor => editor },
:class => "geolink editlink" %>
</li>
<% end %>
</ul>
</li>
<li id="history_tab" class="<%= current_page_class(history_path) %>">
<%= link_to t('layouts.history'), history_path, :class => 'tab geolink' %>
</li>
<li id="export_tab" class="<%= current_page_class(export_path) %>">
<%= link_to t('layouts.export'), export_path, :class => 'tab geolink' %>
</li>
</ul>
</nav>
<nav class='secondary'>
<ul>
<li class="compact-hide <%= current_page_class(traces_path) %>"><%= link_to t('layouts.gps_traces'), traces_path %></li>
<li class="compact-hide <%= current_page_class(diary_path) %>"><%= link_to t('layouts.user_diaries'), diary_path %></li>
<li class="compact-hide <%= current_page_class(help_path) %>"><%= link_to t('layouts.help'), help_path %></li>
<li class="compact-hide <%= current_page_class(about_path) %>"><%= link_to t('layouts.about'), about_path %></li>
<li id="compact-secondary-nav" class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">More <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="<%= current_page_class(traces_path) %>"><%= link_to t('layouts.gps_traces'), traces_path %></li>
<li class="<%= current_page_class(diary_path) %>"><%= link_to t('layouts.user_diaries'), diary_path %></li>
<li class="<%= current_page_class(help_path) %>"><%= link_to t('layouts.help'), help_path %></li>
<li class="<%= current_page_class(about_path) %>"><%= link_to t('layouts.about'), about_path %></li>
</ul>
</li>
</ul>
<% if @user && @user.id %>
<div class='dropdown user-menu logged-in'>
<a class='dropdown-toggle' data-toggle='dropdown' href="#">
<%= user_thumbnail_tiny(@user, :size => 25, :width => 25, :height => 25)
%><%= render :partial => 'layouts/inbox'
%><span class="user-button"><span class='username'><%= @user.display_name %></span>
<b class="caret"></b></span>
</a>
<ul class='dropdown-menu'>
<li>
<%= link_to inbox_path(:display_name => @user.display_name) do %>
<span class='count-number'><%= number_with_delimiter(@user.new_messages.size) %></span>
<%= t('message.inbox.my_inbox') %>
<% end %>
</li>
<li>
<%= link_to t('user.view.my profile'), user_path(:display_name => @user.display_name) %>
</li>
<li>
<%= link_to t('user.view.my settings'), :controller => 'user', :action => 'account', :display_name => @user.display_name %>
</li>
<li class="divider"></li>
<li>
<%= yield :greeting %>
</li>
<li>
<%= link_to t('layouts.logout'), logout_path(:session => request.session_options[:id], :referer => request.fullpath) %>
</li>
</ul>
</div>
<% else %>
<ul class="user-menu clearfix">
<li><%= link_to t('layouts.log_in'), login_path(:referer => request.fullpath) %></li>
<li><%= link_to t('layouts.sign_up'), user_new_path %></li>
</ul>
<% end %>
</nav>
</header>

View file

@ -1,3 +1,3 @@
<span id="inboxanchor" class="count-number">
<%= user_thumbnail_tiny(@user, :size => 20, :width => 20, :height => 20) %><span><%= @user.new_messages.size %></span>
</span>
<% if @user.new_messages.size > 0 %>
<span id="inboxanchor" class="count-number"><%= @user.new_messages.size %></span>
<% end %>

Some files were not shown because too many files have changed in this diff Show more