]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'osmlab/id-default'
authorTom Hughes <tom@compton.nu>
Fri, 23 Aug 2013 16:41:09 +0000 (17:41 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 23 Aug 2013 16:41:09 +0000 (17:41 +0100)
app/controllers/application_controller.rb
app/controllers/site_controller.rb
app/helpers/application_helper.rb
config/example.application.yml

index 0cd850cc689c2469a6a529cc96076a7af4d0ed7d..aec6120808d8f202e4dcf7e6ed231e1ac431e568 100644 (file)
@@ -422,6 +422,24 @@ class ApplicationController < ActionController::Base
     request.body.rewind
   end
 
+  def preferred_editor
+    editor = if params[:editor]
+      params[:editor]
+    elsif @user and @user.preferred_editor
+      @user.preferred_editor
+    else
+      DEFAULT_EDITOR
+    end
+
+    if request.env['HTTP_USER_AGENT'] =~ /MSIE/ and editor == 'id'
+      editor = 'potlatch2'
+    end
+
+    editor
+  end
+
+  helper_method :preferred_editor
+
 private 
 
   # extract authorisation credentials from headers, returns user = nil if none
index 7c8ee32b3f9f382504d98768b8994404c515b050..94cc647543c0ff526d4a5cc4d93a6b6b014f278c 100644 (file)
@@ -36,7 +36,7 @@ class SiteController < ApplicationController
   end
 
   def edit
-    editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
+    editor = preferred_editor
 
     if editor == "remote"
       render :action => :index
index 160e25e3581aae47d488974dd49de6d95fe8f644..4765cb35b3b6fe1fbd506bfc248d32454fc8e09a 100644 (file)
@@ -57,16 +57,6 @@ module ApplicationHelper
     content_tag(tag, capture(&block), :class => "hide_unless_administrator")
   end
 
-  def preferred_editor
-    if params[:editor]
-      params[:editor]
-    elsif @user and @user.preferred_editor
-      @user.preferred_editor
-    else
-      DEFAULT_EDITOR
-    end
-  end
-
   def scale_to_zoom(scale)
     Math.log(360.0 / (scale.to_f * 512.0)) / Math.log(2.0)
   end
index 9a6d83aba9a2671643f65a8ac8c1c0ec30312d71..c6c15bb1d4003eb79409536b53ee19ea320ae499 100644 (file)
@@ -73,7 +73,7 @@ defaults: &defaults
   # URL of Nominatim instance to use for geocoding
   nominatim_url: "http://nominatim.openstreetmap.org/"
   # Default editor
-  default_editor: "potlatch2"
+  default_editor: "id"
   # OAuth consumer key for Potlatch 2
   #potlatch2_key: ""
   # OAuth consumer key for the web site