]> git.openstreetmap.org Git - rails.git/commitdiff
Extract export.js static asset
authorJohn Firebaugh <john.firebaugh@gmail.com>
Sun, 26 Aug 2012 01:40:37 +0000 (18:40 -0700)
committerTom Hughes <tom@compton.nu>
Mon, 27 Aug 2012 17:00:13 +0000 (18:00 +0100)
app/assets/javascripts/export.js [moved from app/views/export/start.js.erb with 99% similarity]
app/assets/javascripts/site.js
app/controllers/export_controller.rb
app/views/site/index.html.erb
test/functional/export_controller_test.rb

similarity index 99%
rename from app/views/export/start.js.erb
rename to app/assets/javascripts/export.js
index a7c6ff580fbe14db457cabbb02fcd9d3ea3c00b3..bc1a87910984a7fde74b22069c19a335668d20e7 100644 (file)
@@ -330,5 +330,3 @@ function mapnikSizeChanged() {
 
   validateControls();
 }
 
   validateControls();
 }
-
-startExport("<%=j render :partial => "sidebar" %>");
index 0a9a4af9c16009b469c98a263b19ac9dfc82e08c..978e84e3d24f564141cf78dee37118e562ba0b7a 100644 (file)
@@ -4,6 +4,7 @@
 //= require jquery.timers
 //= require i18n/translations
 //= require globals
 //= require jquery.timers
 //= require i18n/translations
 //= require globals
+//= require export
 
 /*
  * Called as the user scrolls/zooms around to aniplate hrefs of the
 
 /*
  * Called as the user scrolls/zooms around to aniplate hrefs of the
index 2102a5704f4b29560387f2a4a2c2e5c84639a4fb..736efec191f5ffc28db4d3c678a0ca076e573603 100644 (file)
@@ -4,6 +4,7 @@ class ExportController < ApplicationController
   before_filter :set_locale
 
   def start
   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
   end
 
   #When the user clicks 'Export' we redirect to a URL which generates the export download
index f604267d87c6b5da3fca1affe02631af954bd96f..5eb8ae228c3a3b4b53b743d4a3df22bc0279a8de 100644 (file)
@@ -285,12 +285,14 @@ end
 
   $(document).ready(function () {
     $("#exportanchor").click(function (e) {
 
   $(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' -%>
       e.preventDefault();
     });
 
     <% if params[:action] == 'export' -%>
-    $.ajax({ url: "<%= url_for :controller => :export, :action => :start %>" });
+    $("#exportanchor").click();
     <% end -%>
 
     <% if params[:query] -%>
     <% end -%>
 
     <% if params[:query] -%>
index 6b49700d80ddda6c2f3ef12125bbbffaa9b9d147..8e4282b8f1b5c1e45058f9393ae1d191370c0972 100644 (file)
@@ -18,7 +18,7 @@ class ExportControllerTest < ActionController::TestCase
   def test_start
     xhr :get, :start
     assert_response :success
   def test_start
     xhr :get, :start
     assert_response :success
-    assert_template 'start'
+    assert_template 'export/_sidebar'
   end
   
   def test_finish_osm
   end
   
   def test_finish_osm