<% if session[:location] %>
OSM.location = <%= session[:location].to_json.html_safe %>;
<% end %>
+
+ OSM.preferred_editor = <%= preferred_editor.to_json.html_safe %>;
</script>
<title><%= t 'layouts.project_name.title' %><%= ' | '+ @title if @title %></title>
</head>
<li><%= link_to h(t('layouts.edit')) + content_tag(:span, "▾", :class => "menuicon"), edit_path, {
:id => 'editanchor',
:title => t('javascripts.site.edit_tooltip'),
- :data => { :minzoom => 13 },
+ :data => { :minzoom => 13, :editor => preferred_editor },
:class => 'geolink llz object disabled'
} %></li>
<li><%= link_to t('layouts.history'), browse_changesets_path, {
<li><%= link_to t('layouts.export'), export_path, {
:id => 'exportanchor',
:title => t('layouts.export_tooltip'),
+ :data => { :url => url_for(:controller => :export, :action => :start) },
:class => 'geolink llz layers'
} %></li>
</ul>
<li><%= link_to t('layouts.edit_with',
:editor => t("editor.#{editor}.description")),
edit_path(:editor => editor), {
- :id => editor + 'anchor',
+ :data => { :editor => editor },
:class => "geolink llz object"
} %></li>
<% end %>
$("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + extent.left + "&top=" + extent.top + "&right=" + extent.right + "&bottom=" + extent.bottom);
setTimeout(function () {
- if (!loaded) alert("<%=j t('site.index.remote_failed') %>");
+ if (!loaded) alert(I18n.t('site.index.remote_failed'));
}, 1000);
return false;
}
function installEditHandler() {
- $("#remoteanchor").click(remoteEditHandler);
+ $("a[data-editor=remote]").click(remoteEditHandler);
- <% if preferred_editor == "remote" %>
- $("#editanchor").click(remoteEditHandler);
-
- <% if params[:action] == "edit" %>
- remoteEditHandler();
- <% end %>
- <% end %>
+ if (OSM.preferred_editor == "remote" && $('body').hasClass("site-edit")) {
+ remoteEditHandler();
+ }
}
$(document).ready(mapInit);
$(document).ready(function () {
$("#exportanchor").click(function (e) {
- $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>", success: function (sidebarHtml) {
+ $.ajax({ url: $(this).data('url'), success: function (sidebarHtml) {
startExport(sidebarHtml);
}});
e.preventDefault();
});
- <% if params[:export] -%>
- $("#exportanchor").click();
- <% end -%>
+ if (window.location.pathname == "/export") {
+ $("#exportanchor").click();
+ }
- <% if params[:query] -%>
- doSearch("<%= params[:query] %>");
- <% end %>
+ var query;
+ if (query = getArgs(window.location.toString()).query) {
+ doSearch(query);
+ }
});
// -->
</script>
- "*.browse.start_rjs.*"
- "*.export.start_rjs.*"
- "*.javascripts.*"
+ - "*.site.index.remote_failed"