diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..223e5d3
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1 @@
+gem 'redmine_plugin_kit'
diff --git a/README.md b/README.md
index 9b07525..894a07d 100644
--- a/README.md
+++ b/README.md
@@ -20,11 +20,10 @@ I bare no responsibility in case of misuse of this plugin.
## Compatibility
-Redmine 2.1.x ~ 3.4.x stable
+Redmine 5.0.2 stable
Tested on:
-* 3.4.5
-* 2.5.0
+* 5.0.2
## Downloading and installing the plugin
@@ -47,6 +46,7 @@ Original plugin: @martin-denizet
Code contributions:
* @namezero111111
* @virtualmarc
+* @gong-bao-chicken
Thank to CodeMirror for their very cool editor! http://codemirror.net/ (MIT license)
diff --git a/init.rb b/init.rb
index 78a772e..7c4a082 100644
--- a/init.rb
+++ b/init.rb
@@ -1,10 +1,12 @@
-require_dependency 'redmine_custom_js/hooks'
+# frozen_string_literal: true
+
+loader = RedminePluginKit::Loader.new plugin_id: 'redmine_custom_js'
Redmine::Plugin.register :redmine_custom_js do
name 'Redmine Custom JS plugin'
- author 'Martin DENIZET'
+ author 'Philipp Hilpert'
description 'Allows to insert custom JavaScript in Redmine'
- version '0.1.1'
+ version '1.0.0'
url 'https://github.com/martin-denizet/redmine_custom_js'
author_url 'http://martin-denizet.com'
@@ -14,5 +16,6 @@
},
:partial => 'settings/custom_js'
-
end
+
+RedminePluginKit::Loader.persisting { loader.load_model_hooks! }
diff --git a/lib/redmine_custom_js.rb b/lib/redmine_custom_js.rb
new file mode 100644
index 0000000..71da5b5
--- /dev/null
+++ b/lib/redmine_custom_js.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+module RedmineCustomJs
+ VERSION = '1.0.0'
+
+ include RedminePluginKit::PluginBase
+
+ class << self
+
+ end
+end
\ No newline at end of file
diff --git a/lib/redmine_custom_js/hooks.rb b/lib/redmine_custom_js/hooks.rb
deleted file mode 100644
index badac9f..0000000
--- a/lib/redmine_custom_js/hooks.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-module RedmineCustomJs
- class RedmineCustomJsHookListener < Redmine::Hook::ViewListener
- def view_layouts_base_html_head(context)
- js = Setting.plugin_redmine_custom_js['js']
- "" unless js.nil? or js.empty?
-
- end
- end
-end
\ No newline at end of file
diff --git a/lib/redmine_custom_js/hooks/model_hook.rb b/lib/redmine_custom_js/hooks/model_hook.rb
new file mode 100644
index 0000000..c19129d
--- /dev/null
+++ b/lib/redmine_custom_js/hooks/model_hook.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module RedmineCustomJs
+ module Hooks
+ class ModelHook < Redmine::Hook::Listener
+ def after_plugins_loaded(_context = {})
+
+ end
+ end
+ end
+end
+
\ No newline at end of file
diff --git a/lib/redmine_custom_js/hooks/view_hook.rb b/lib/redmine_custom_js/hooks/view_hook.rb
new file mode 100644
index 0000000..eb549a6
--- /dev/null
+++ b/lib/redmine_custom_js/hooks/view_hook.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module RedmineCustomJs
+ module Hooks
+ class ViewHook < Redmine::Hook::ViewListener
+ def view_layouts_base_html_head(context)
+ js = Setting.plugin_redmine_custom_js['js']
+ "" unless js.nil? or js.empty?
+
+ end
+ end
+ end
+end
\ No newline at end of file