return url;
},
- mapParams: function (search) {
- var params = {}, mapParams = {}, bounds, loc;
+ params: function(search) {
+ var params = {};
search = (search || window.location.search).replace('?', '').split(/&|;/);
params[key] = decodeURIComponent(val);
}
+ return params;
+ },
+
+ mapParams: function (search) {
+ var params = OSM.params(search), mapParams = {}, bounds, loc;
+
if (params.mlon && params.mlat) {
mapParams.marker = true;
mapParams.mlon = parseFloat(params.mlon);
--- /dev/null
+$(document).ready(function() {
+ var params = OSM.params();
+
+ if (params.lat && params.lon) {
+ $('.edit-located').show();
+
+ $.ajax({
+ url: "http://nominatim.openstreetmap.org/reverse",
+ data: {
+ lat: params.lat,
+ lon: params.lon,
+ zoom: 10
+ },
+ success: function(xml) {
+ var result = $(xml).find('result');
+ if (result.length) {
+ $('.edit-located').hide();
+ $('.edit-geocoded').show();
+ $('.edit-geocoded-location').text(result.text());
+ }
+ }
+ });
+
+ $('.start-mapping').on('click', function(e) {
+ window.location = '/edit?zoom=17&lat=' + params.lat + '&lon=' + params.lon;
+ });
+
+ } else if (navigator.geolocation) {
+ $('.edit-geolocated').show();
+
+ function geoSuccess(position) {
+ window.location = '/edit?zoom=17&lat=' + position.coords.latitude + '&lon=' + position.coords.longitude;
+ }
+
+ function geoError() {
+ $('.start-mapping')
+ .removeClass('loading')
+ .addClass('error');
+ }
+
+ $('.start-mapping').on('click', function(e) {
+ e.preventDefault();
+
+ $('.start-mapping')
+ .addClass('loading');
+
+ // handle firefox's weird implementation
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=675533
+ window.setTimeout(geoError, 4000);
+
+ navigator.geolocation.getCurrentPosition(geoSuccess, geoError);
+ });
+ }
+});
padding: 20px;
}
+ .edit-located,
+ .edit-geocoded,
+ .edit-geolocated {
+ display: none;
+ }
+
+ .start-mapping {
+ background: #EB6F67;
+ color: #FFF;
+ display: block;
+ margin: auto;
+ cursor: pointer;
+ border: none;
+ border-radius: 5px;
+ border-bottom: 1px solid #A53931;
+ padding: 20px 40px;
+ font-size: 30px;
+ }
+
.note-box {
background-color: $offwhite;
}
+<% content_for :head do %>
+ <%= javascript_include_tag "welcome" %>
+<% end %>
+
<% content_for :heading do %>
<h2><%= t "welcome_page.title" %></h2>
<h3><%= t "welcome_page.subtitle" %></h3>
<div class='pad2 drop'>
<h3><%= t "welcome_page.section_6.title" %></h3>
<% if @user %>
- <p><%= t "welcome_page.section_6.paragraph_1_html" %></p>
+ <p>
+ <%= t "welcome_page.section_6.paragraph_1_html" %>
+ <span class='edit-located'><%= t "welcome_page.section_6.paragraph_located" %></span>
+ <span class='edit-geocoded'><%= t "welcome_page.section_6.paragraph_geocoded_html" %></span>
+ <span class='edit-geolocated'><%= t "welcome_page.section_6.paragraph_geolocated" %></span>
+ </p>
+ <button class="edit-located edit-geocoded edit-geolocated start-mapping">Start Mapping</button>
<% else %>
<p><%= t "welcome_page.section_6.paragraph_1_no_user_html" %></p>
<% end %>
# config.action_controller.asset_host = "http://assets.example.com"
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- config.assets.precompile += %w( index.js edit.js browse.js changeset.js )
+ config.assets.precompile += %w( index.js edit.js browse.js changeset.js welcome.js )
config.assets.precompile += %w( user.js diary_entry.js pngfix.js swfobject.js )
config.assets.precompile += %w( large-ltr.css small-ltr.css print-ltr.css )
config.assets.precompile += %w( large-rtl.css small-rtl.css print-rtl.css )
title: Start Editing
paragraph_1_html: |
You can zoom in anywhere in the world and click the <em>Edit</em> button to start editing.
+ paragraph_located: |
+ Or, start editing now:
+ paragraph_geocoded_html: |
+ Or, start near <span class='edit-geocoded-location'></span>:
+ paragraph_geolocated: |
+ Or, start directly at your current location:
paragraph_1_no_user_html: |
Once you have an account, you can zoom in anywhere in the world and click the <em>Edit</em>
button to start editing.