Ajaxify the country selection on the terms page
[rails.git] / app / controllers / user_controller.rb
index 603fb2a49aef8a61b0054b907e3bb4f3cd1d1ca5..27d124daeae3423e7bc22a4e1d50235f9b7a00d8 100644 (file)
@@ -25,7 +25,11 @@ class UserController < ApplicationController
     @legale = params[:legale] || OSM.IPToCountry(request.remote_ip) || APP_CONFIG['default_legale']
     @text = OSM.legal_text_for_country(@legale)
 
-    if @user.invalid?
+    if request.xhr?
+      render :update do |page|
+        page.replace_html "contributorTerms", :partial => "terms"
+      end
+    elsif @user.invalid?
       render :action => 'new'
     end
   end