forked from peclik/clipboard_image_paste
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.rb
45 lines (40 loc) · 1.63 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#*******************************************************************************
# clipboard_image_paste Redmine plugin.
#
# Authors:
# - Richard Pecl & others (see README)
#
# Terms of use:
# - GNU GENERAL PUBLIC LICENSE Version 2
#*******************************************************************************
require 'redmine'
require 'dispatcher' unless Rails::VERSION::MAJOR >= 3
Redmine::Plugin.register :clipboard_image_paste do
name 'Clipboard image paste'
author 'Richard Pecl'
description 'Paste cropped image from clipboard as attachment'
url 'http://www.redmine.org/plugins/clipboard_image_paste'
version '1.13'
requires_redmine :version_or_higher => '1.4.0'
configfile = File.join(File.dirname(__FILE__), 'config', 'settings.yml')
$clipboard_image_paste_config = YAML::load_file(configfile)
redmineVer = Redmine::VERSION.to_a
$clipboard_image_paste_has_jquery = redmineVer[0] > 2 || (redmineVer[0] == 2 && redmineVer[1] >= 2)
$clipboard_image_paste_remove_alpha = redmineVer[0] < 2 || (redmineVer[0] == 2 && redmineVer[1] <= 5)
end
if Rails::VERSION::MAJOR >= 4
ActiveSupport::Reloader.to_prepare do
require_dependency 'clipboard_image_paste/hooks'
require_dependency 'clipboard_image_paste/attachment_patch'
end
elsif Rails::VERSION::MAJOR >= 3
ActionDispatch::Callbacks.to_prepare do
require_dependency 'clipboard_image_paste/hooks'
require_dependency 'clipboard_image_paste/attachment_patch'
end
else
Dispatcher.to_prepare :clipboard_image_paste do
require_dependency 'clipboard_image_paste/hooks'
require_dependency 'clipboard_image_paste/attachment_patch'
end
end