mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-01 04:32:16 +08:00
Merge pull request #663 from ZmagoD/zd_SCI_1328
fixes bug with smart annotations in reports [fixes SCI-1328]
This commit is contained in:
commit
6cdf37041f
1 changed files with 18 additions and 4 deletions
|
@ -233,11 +233,25 @@ module ApplicationHelper
|
|||
raw(user_description) + raw('" >') + user_name + raw('</a>')
|
||||
end
|
||||
|
||||
# Dirty, dirty hack for displaying images in reports
|
||||
def user_avatar_absolute_url(user, style)
|
||||
unless user.avatar(style) == '/images/icon_small/missing.png'
|
||||
return user.avatar(style)
|
||||
prefix = ''
|
||||
if ENV['PAPERCLIP_STORAGE'].present? &&
|
||||
ENV['MAIL_SERVER_URL'].present? &&
|
||||
ENV['PAPERCLIP_STORAGE'] != 'filesystem'
|
||||
prefix = ENV['MAIL_SERVER_URL']
|
||||
end
|
||||
URI.join(Rails.application.routes.url_helpers.root_url,
|
||||
"/images/#{style}/missing.png").to_s
|
||||
# for development
|
||||
prefix = 'localhost:3000' if ENV['MAIL_SERVER_URL'] == 'localhost'
|
||||
if !prefix.empty? &&
|
||||
!prefix.include?('http://') &&
|
||||
!prefix.include?('https://')
|
||||
prefix = request.ssl? ? "https://#{prefix}" : "http://#{prefix}"
|
||||
end
|
||||
|
||||
unless user.avatar(style) == '/images/icon_small/missing.png'
|
||||
return user.avatar(style, timeout: Constants::URL_LONG_EXPIRE_TIME)
|
||||
end
|
||||
url_for(prefix + "/images/#{style}/missing.png")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue