]> git.openstreetmap.org Git - rails.git/blobdiff - app/helpers/application_helper.rb
Try and patch up poor browser language selections
[rails.git] / app / helpers / application_helper.rb
index 3d2c70a132d566b36d6770226c2d8bbd4c919bb6..c24e7ff5be26b7a504c620ede19ea95d66ba30b5 100644 (file)
@@ -85,8 +85,8 @@ module ApplicationHelper
     url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
 
     begin
     url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}"
 
     begin
-      Timeout::timeout(4) do
-        response = REXML::Document.new(Net::HTTP.get(URI.parse(url)))
+      response = Timeout::timeout(4) do
+        REXML::Document.new(Net::HTTP.get(URI.parse(url)))
       end
     rescue Exception
       response = nil
       end
     rescue Exception
       response = nil
@@ -119,6 +119,16 @@ module ApplicationHelper
     end
   end
 
     end
   end
 
+  def preferred_editor
+    if params[:editor]
+      params[:editor]
+    elsif @user and @user.preferred_editor
+      @user.preferred_editor
+    else
+      DEFAULT_EDITOR
+    end
+  end
+
 private
 
   def javascript_strings_for_key(key)
 private
 
   def javascript_strings_for_key(key)