Skip to content
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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem 'redmine_plugin_kit'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down
11 changes: 7 additions & 4 deletions init.rb
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -14,5 +16,6 @@
},
:partial => 'settings/custom_js'


end

RedminePluginKit::Loader.persisting { loader.load_model_hooks! }
11 changes: 11 additions & 0 deletions lib/redmine_custom_js.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module RedmineCustomJs
VERSION = '1.0.0'

include RedminePluginKit::PluginBase

class << self

end
end
9 changes: 0 additions & 9 deletions lib/redmine_custom_js/hooks.rb

This file was deleted.

12 changes: 12 additions & 0 deletions lib/redmine_custom_js/hooks/model_hook.rb
Original file line number Diff line number Diff line change
@@ -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

13 changes: 13 additions & 0 deletions lib/redmine_custom_js/hooks/view_hook.rb
Original file line number Diff line number Diff line change
@@ -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']
"<script type=\"text/javascript\">#{javascript_cdata_section(js)}</script>" unless js.nil? or js.empty?

end
end
end
end