From: John Firebaugh Date: Sun, 26 Aug 2012 01:40:37 +0000 (-0700) Subject: Extract export.js static asset X-Git-Tag: live~5415 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/cc4f133e64a1f0d963f60fb40045145a530d5dbb?hp=c2333c603e1ad3352109a05150f2c47ad468f7ef Extract export.js static asset --- diff --git a/app/views/export/start.js.erb b/app/assets/javascripts/export.js similarity index 99% rename from app/views/export/start.js.erb rename to app/assets/javascripts/export.js index a7c6ff580..bc1a87910 100644 --- a/app/views/export/start.js.erb +++ b/app/assets/javascripts/export.js @@ -330,5 +330,3 @@ function mapnikSizeChanged() { validateControls(); } - -startExport("<%=j render :partial => "sidebar" %>"); diff --git a/app/assets/javascripts/site.js b/app/assets/javascripts/site.js index 0a9a4af9c..978e84e3d 100644 --- a/app/assets/javascripts/site.js +++ b/app/assets/javascripts/site.js @@ -4,6 +4,7 @@ //= require jquery.timers //= require i18n/translations //= require globals +//= require export /* * Called as the user scrolls/zooms around to aniplate hrefs of the diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index 2102a5704..736efec19 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -4,6 +4,7 @@ class ExportController < ApplicationController before_filter :set_locale def start + render :partial => "sidebar" end #When the user clicks 'Export' we redirect to a URL which generates the export download diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index f604267d8..5eb8ae228 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -285,12 +285,14 @@ end $(document).ready(function () { $("#exportanchor").click(function (e) { - $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>" }); + $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>", success: function (sidebarHtml) { + startExport(sidebarHtml); + }}); e.preventDefault(); }); <% if params[:action] == 'export' -%> - $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>" }); + $("#exportanchor").click(); <% end -%> <% if params[:query] -%> diff --git a/test/functional/export_controller_test.rb b/test/functional/export_controller_test.rb index 6b49700d8..8e4282b8f 100644 --- a/test/functional/export_controller_test.rb +++ b/test/functional/export_controller_test.rb @@ -18,7 +18,7 @@ class ExportControllerTest < ActionController::TestCase def test_start xhr :get, :start assert_response :success - assert_template 'start' + assert_template 'export/_sidebar' end def test_finish_osm