Show a popup listing available editors when hovering over the edit tab

This commit is contained in:
Tom Hughes 2010-11-15 00:44:17 +00:00
parent 6c3b5aa9d4
commit 04a6c41be9
8 changed files with 154 additions and 15 deletions

View file

@ -32,7 +32,7 @@ class SiteController < ApplicationController
end
def edit
editor = @user.preferred_editor || DEFAULT_EDITOR
editor = params[:editor] || @user.preferred_editor || DEFAULT_EDITOR
if editor == "josm"
render :action => :index

View file

@ -120,7 +120,9 @@ module ApplicationHelper
end
def preferred_editor
if @user and @user.preferred_editor
if params[:editor]
params[:editor]
elsif @user and @user.preferred_editor
@user.preferred_editor
else
DEFAULT_EDITOR

View file

@ -5,6 +5,7 @@
<%= javascript_strings %>
<%= javascript_include_tag 'prototype' %>
<%= javascript_include_tag 'site' %>
<%= javascript_include_tag 'menu' %>
<!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
<%= stylesheet_link_tag 'common' %>
<!--[if IE]><%= stylesheet_link_tag 'large', :media => "screen" %><![endif]--> <!-- IE is totally broken with CSS media queries -->
@ -73,6 +74,18 @@
</ul>
</div>
<div id="editmenu">
<ul>
<% Editors::ALL_EDITORS.each do |editor| %>
<li><%= link_to t('layouts.edit_with', :editor => t('user.account.editor.' + editor)), {:controller => 'site', :action => 'edit', :editor => editor}, {:id => editor + 'anchor'} %></li>
<% end %>
</ul>
</div>
<script type="text/javascript">
createMenu("editanchor", "editmenu", 1000);
</script>
<div id="left">
<div id="logo">

View file

@ -279,6 +279,8 @@ end
}
function installEditHandler() {
$("josmanchor").onclick =josmEditHandler;
<% if preferred_editor == "josm" %>
$("editanchor").onclick =josmEditHandler;