]> git.openstreetmap.org Git - rails.git/blob - app/views/user/account.rhtml
Force new users to enter their email address twice to try and avoid so
[rails.git] / app / views / user / account.rhtml
1 <h2>User details</h2>
2 <%= error_messages_for 'user' %>
3 <% form_for :user, @user do |f| %>
4 <table style="width : 100%">
5   <tr><td>Email</td><td><%= @user.email %></td></tr>
6   <tr><td>Mapper since</td><td><%= @user.creation_time %> (<%= time_ago_in_words(@user.creation_time) %> ago)</td></tr>
7   <tr><td>Display Name</td><td><%= f.text_field :display_name %></td></tr>
8   <tr><td>Password</td><td><%= f.password_field :pass_crypt, {:value => '', :size => 50, :maxlength => 255} %></td></tr>
9   <tr><td>Confirm Password</td><td><%= f.password_field :pass_crypt_confirmation, {:value => '', :size => 50, :maxlength => 255} %></td></tr>
10
11   <tr><td valign="top">Description</td><td><%= f.text_area :description, :class => "editDescription" %></td></tr>
12
13   <tr id="homerow" <% unless @user.home_lat and @user.home_lon %> class="nohome" <%end%> ><td>Your home</td><td><em class="message">You have not entered your home location.</em><span class="location">Latitude: <%= f.text_field :home_lat, :size => 20, :id => "home_lat" %> Longitude <%= f.text_field :home_lon, :size => 20, :id => "home_lon" %></span></td></tr>
14
15   <tr><td></td><td>
16   <p>Update home location when I click on the map? <input type="checkbox" value="1" <% unless @user.home_lat and @user.home_lon %> checked="checked" <% end %> id="updatehome" /> </p>
17   <div id="map" style="border: 1px solid black; position: relative; width : 90%; height : 300px;"></div>
18   </td></tr>
19 </table>
20 <%= submit_tag 'Save Changes' %>
21 <% end %>
22
23 <% nearest_str = "" %>
24 <% if !@user.home_lat.nil? and !@user.home_lon.nil? %>
25   <% if !@user.nearby.empty? %>
26     <% @user.nearby.each do |nearby| %>
27     <% nearest_str += "nearest.push( { 'display_name' : '#{nearby.display_name}', 'home_lat' : #{nearby.home_lat}, 'home_lon' : #{nearby.home_lon} } );\n" %>
28     <% end %>
29   <% end %>
30 <% end %>
31 <script type="text/javascript">
32     var nearest = [], friends = [];
33     <%= nearest_str %>
34 </script>
35
36 <% if @user.home_lat.nil? or @user.home_lon.nil? %>
37   <% lon = h(params['lon'] || '-0.1') %>
38   <% lat = h(params['lat'] || '51.5') %>
39   <% zoom = h(params['zoom'] || '4') %> 
40 <% else %>
41   <% marker = true %>
42   <% mlon = @user.home_lon %> 
43   <% mlat = @user.home_lat %>
44   <% lon =  @user.home_lon %>
45   <% lat =  @user.home_lat %>
46   <% zoom =  '12' %>
47 <% end %>
48
49 <script type="text/javascript" src="/openlayers/OpenLayers.js"></script>
50 <%= javascript_include_tag 'map.js' %>
51
52 <script type="text/javascript">
53   <!--
54   var marker;
55
56   function init(){
57     var centre = lonLatToMercator(new OpenLayers.LonLat(<%= lon %>, <%= lat %>));
58     var zoom = <%= zoom %>;
59
60     <% if params['scale'] and params['scale'].length > 0 then %>
61     zoom = scaleToZoom(<%= params['scale'].to_f() %>);
62     <% end %>
63
64     var map = createMap("map");
65
66     map.setCenter(centre, zoom);
67
68     <% if marker %>
69     marker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)), null, "Your location");
70     <% end %>
71
72     var near_icon = OpenLayers.Marker.defaultIcon();
73     near_icon.url = OpenLayers.Util.getImagesLocation() + "marker-green.png";;
74     var i = nearest.length;
75     while( i-- ) {
76       var description = 'Nearby mapper: <a href="/user/'+nearest[i].display_name+'">'+nearest[i].display_name+'</a>'
77       var nearmarker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(nearest[i].home_lon, nearest[i].home_lat)), near_icon.clone(), description);
78     }
79
80     map.events.register("click", map, setHome);
81   }        
82
83   function setHome( e ) { 
84     closeMapPopup();
85
86     if (document.getElementById('updatehome').checked) {
87       var merc = map.getLonLatFromViewPortPx(e.xy);
88       var lonlat = mercatorToLonLat(merc);
89
90       document.getElementById('homerow').className = '';
91       document.getElementById('home_lat').value = lonlat.lat;
92       document.getElementById('home_lon').value = lonlat.lon;
93
94       if (marker) {
95         removeMarkerFromMap(marker);
96       }
97
98       marker = addMarkerToMap(merc, null, "Your location");
99     }
100   }
101
102   window.onload = init;
103 // -->
104 </script>
105
106 <h2>Public editing</h2>
107 <% if @user.data_public? %>
108   All your edits are public.
109 <% else %>
110   Currently your edits are anonymous and people can't send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. <b>You will need to do this if you want to use the online editor</b> (<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">find out why</a>). This action cannot be reversed.
111   <br /><br />
112   <%= button_to "Make all my edits public, forever", :action => :go_public %>
113 <% end %>