Skip to content

Commit 468d5f2

Browse files
authored
Merge pull request #28 from ncoders/redmine-4.2-compatibility
Redmine 4.2 compatibility
2 parents 3ca713e + a7ab591 commit 468d5f2

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ And restart your application server.
2222

2323
## Compatibility
2424

25-
This current version on github is compatible with Redmine 2.1 - 4.0.
25+
This current version on github is compatible with Redmine 2.1 - 4.2.
2626

2727
It has been imported from lp:redminelocalavatars
2828
incorporating the patch for 2.1 from chrisy at [https://bugs.launchpad.net/redminelocalavatars/+bug/1069808/comments/4](https://bugs.launchpad.net/redminelocalavatars/+bug/1069808/comments/4)

init.rb

+14-11
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,25 @@
2121
Redmine::Plugin.register :redmine_local_avatars do
2222
name 'Redmine Local Avatars plugin'
2323
author 'Andrew Chaika and Luca Pireddu'
24+
author_url 'https://github.com/ncoders/redmine_local_avatars'
2425
description 'This plugin lets users upload avatars directly into Redmine'
25-
version '1.0.5'
26+
version '1.0.6'
2627
end
2728

2829
receiver = Object.const_defined?('ActiveSupport::Reloader') ? ActiveSupport::Reloader : ActionDispatch::Callbacks
2930
receiver.to_prepare do
30-
require_dependency 'project'
31-
require_dependency 'principal'
32-
require_dependency 'user'
33-
34-
AccountController.send(:include, LocalAvatarsPlugin::AccountControllerPatch)
35-
ApplicationHelper.send(:include, LocalAvatarsPlugin::ApplicationAvatarPatch)
36-
MyController.send(:include, LocalAvatarsPlugin::MyControllerPatch)
37-
User.send(:include, LocalAvatarsPlugin::UsersAvatarPatch)
38-
UsersController.send(:include, LocalAvatarsPlugin::UsersControllerPatch)
39-
UsersHelper.send(:include, LocalAvatarsPlugin::UsersHelperPatch)
31+
require_dependency 'project'
32+
require_dependency 'principal'
33+
require_dependency 'user'
34+
35+
helper_klass = ApplicationHelper.method_defined?(:avatar) ? ApplicationHelper : AvatarsHelper
36+
37+
AccountController.send(:include, LocalAvatarsPlugin::AccountControllerPatch)
38+
helper_klass.send(:include, LocalAvatarsPlugin::ApplicationAvatarPatch)
39+
MyController.send(:include, LocalAvatarsPlugin::MyControllerPatch)
40+
User.send(:include, LocalAvatarsPlugin::UsersAvatarPatch)
41+
UsersController.send(:include, LocalAvatarsPlugin::UsersControllerPatch)
42+
UsersHelper.send(:include, LocalAvatarsPlugin::UsersHelperPatch)
4043
end
4144

4245
require 'local_avatars'

lib/application_helper_avatar_patch.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ def avatar_with_local(user, options = { })
3333
if av then
3434
image_url = url_for :only_path => true, :controller => 'account', :action => 'get_avatar', :id => user
3535
options[:size] = "64" unless options[:size]
36-
return "<img class=\"gravatar\" width=\"#{options[:size]}\" height=\"#{options[:size]}\" src=\"#{image_url}\" />".html_safe
36+
title = "#{user.name}"
37+
return "<img class=\"gravatar\" title=\"#{title}\" width=\"#{options[:size]}\" height=\"#{options[:size]}\" src=\"#{image_url}\" />".html_safe
3738
end
3839
end
3940
avatar_without_local(user, options)

0 commit comments

Comments
 (0)