3 <%= error_messages_for 'diary_entry' %>
5 <%= form_for :diary_entry do |f| %>
6 <table class="diary_entry">
8 <td class="fieldName"><%= t 'diary_entry.edit.subject' -%></td>
9 <td><%= f.text_field :title, :size => 60 %></td>
12 <td class="fieldName"><%= t 'diary_entry.edit.body' -%></td>
13 <td><%= richtext_area :diary_entry, :body, :cols => 80, :format => @diary_entry.body_format %></td>
16 <td class="fieldName"><%= t 'diary_entry.edit.language' -%></td>
17 <td><%= f.collection_select :language_code, Language.order(:english_name), :code, :name %></td>
20 <td class="fieldName"><%= t 'diary_entry.edit.location' -%></td>
23 <span class="location"><%= t 'diary_entry.edit.latitude' -%> <%= f.text_field :latitude, :size => 20, :id => "latitude" %> <%= t 'diary_entry.edit.longitude' -%> <%= f.text_field :longitude, :size => 20, :id => "longitude" %></span>
24 <a href="javascript:openMap()" id="usemap"><%= t 'diary_entry.edit.use_map_link' -%></a>
31 <%= submit_tag t('diary_entry.edit.save_button') %>
32 <%# TODO: button should say 'publish' or 'save changes' depending on new/edit state %>
38 <% if @diary_entry.latitude and @diary_entry.longitude %>
39 <% lon = @diary_entry.longitude %>
40 <% lat = @diary_entry.latitude %>
42 <% elsif @user.home_lat.nil? or @user.home_lon.nil? %>
43 <% lon = h(params['lon'] || '-0.1') %>
44 <% lat = h(params['lat'] || '51.5') %>
45 <% zoom = h(params['zoom'] || '4') %>
47 <% lon = @user.home_lon %>
48 <% lat = @user.home_lat %>
52 <%= javascript_include_tag 'openlayers.js' %>
53 <%= javascript_include_tag 'map.js' %>
55 <script type="text/javascript">
59 OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
61 function setLocation( e ) {
64 var lonlat = getEventPosition(e);
66 $("#latitude").val(lonlat.lat);
67 $("#longitude").val(lonlat.lon);
70 removeMarkerFromMap(marker);
73 marker = addMarkerToMap(lonlat, null, "<%= t 'diary_entry.edit.marker_text' -%>");
80 var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
81 var zoom = <%= zoom %>;
83 var map = createMap("map");
85 setMapCenter(centre, zoom);
87 <% if @diary_entry.latitude and @diary_entry.longitude %>
88 marker = addMarkerToMap(centre, null, "<%= t 'diary_entry.edit.marker_text' -%>");
91 map.events.register("click", map, setLocation);