Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Redmine >= 2.5 and Rails 3, FR translation merge. #32

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions assets/javascripts/prototype-stealth.js

This file was deleted.

6 changes: 6 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# French strings go here for Rails i18n
fr:
stealth: "Redmine Furtif"
enable_stealth_mode: "Activer le mode furtif"
disable_stealth_mode: "Désactiver le mode furtif"
failed_to_toggle_stealth_mode: "Impossible de changer le mode furtif"
20 changes: 2 additions & 18 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

require 'redmine_stealth'

unless RedmineStealth::USE_UJS
require 'redmine_ext/menu_manager_extensions'
end

if Rails::VERSION::MAJOR >= 3
require 'redmine_stealth/mail_interceptor'
else
Expand All @@ -21,7 +17,7 @@
extend Redmine::I18n

plugin_locale_glob = respond_to?(:directory) ?
File.join(directory, 'config', 'locales', '*.yml') :
File.join( File.dirname(__FILE__) , 'config', 'locales', '*.yml') :
File.join(Rails.root, 'vendor', 'plugins',
'redmine_stealth', 'config', 'locales', '*.yml')

Expand Down Expand Up @@ -64,19 +60,7 @@
RedmineStealth.status_label(is_cloaked)
end

if RedmineStealth::USE_UJS
menu_options[:html].update('remote' => true, 'method' => :post)
else
menu_options[:remote] = {
:method => :post,
:failure => 'RedmineStealth.notifyFailure();',
:with => %q{(function() {
var $toggle = $('stealth_toggle');
var params = $toggle.readAttribute('data-params-toggle');
return params ? ('toggle=' + params) : '';
})()}
}
end
menu_options[:html].update('remote' => true, 'method' => :post)

menu :account_menu, :stealth, toggle_url, {
:first => true,
Expand Down
6 changes: 3 additions & 3 deletions lib/redmine_ext/menu_manager_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def render_single_menu_node_with_remote(item, caption, url, is_sel)
if remote_options = item.remote_options
non_html_options = remote_options.kind_of?(Hash) ?
remote_options.reverse_merge(:url => url) : { :url => url }
link_to_remote(h(caption),
non_html_options,
item.html_options(:selected => is_sel))
link_to(h(caption),
url,
:selected => is_sel)
else
render_single_menu_node_without_remote(item, caption, url, is_sel)
end
Expand Down
2 changes: 0 additions & 2 deletions lib/redmine_stealth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ module RedmineStealth

include Redmine::I18n

USE_UJS = defined?(::Jquery)

PREF_STEALTH_ENABLED = :stealth_mode

MESSAGE_ACTION_CLOAK = 'enable_stealth_mode'
Expand Down
14 changes: 3 additions & 11 deletions lib/redmine_stealth/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,9 @@ def view_layouts_base_body_bottom(context={})
is_cloaked = RedmineStealth.cloaked?
init_state = RedmineStealth.javascript_toggle_statement(is_cloaked)

if RedmineStealth::USE_UJS
js_lib = 'stealth'
javascript_include_tag(js_lib, :plugin => 'redmine_stealth') +
javascript_tag("jQuery(function($) { #{init_state} });")
else
js_lib = 'prototype-stealth'
javascript_include_tag(js_lib, :plugin => 'redmine_stealth') +
javascript_tag(%Q{
document.observe("dom:loaded", function() { #{init_state} });
})
end
js_lib = 'stealth'
javascript_include_tag(js_lib, :plugin => 'redmine_stealth') +
javascript_tag("jQuery(function($) { #{init_state} });")
end

end
Expand Down