From 81e6d6b74c3f2edd3cf143776b46ad62c938b1e2 Mon Sep 17 00:00:00 2001 From: tanaka ken Date: Thu, 28 Sep 2023 20:29:12 +0900 Subject: [PATCH] =?UTF-8?q?refs=20#2=20Annotate=E7=94=BB=E9=9D=A2=E3=81=AB?= =?UTF-8?q?Github=E3=81=B8=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF=E3=82=92?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository/github.rb | 2 +- app/views/repositories/_annotate_link_patch.js.erb | 11 +++++++++++ init.rb | 1 + lib/hooks.rb | 5 +++++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/views/repositories/_annotate_link_patch.js.erb create mode 100644 lib/hooks.rb diff --git a/app/models/repository/github.rb b/app/models/repository/github.rb index 985cacf..7869ba0 100644 --- a/app/models/repository/github.rb +++ b/app/models/repository/github.rb @@ -18,7 +18,7 @@ def supports_revision_graph? end def supports_annotate? - false + true end def repo_log_encoding diff --git a/app/views/repositories/_annotate_link_patch.js.erb b/app/views/repositories/_annotate_link_patch.js.erb new file mode 100644 index 0000000..4d1a0d6 --- /dev/null +++ b/app/views/repositories/_annotate_link_patch.js.erb @@ -0,0 +1,11 @@ +<% if @repository && @repository.class.name == "Repository::Github" && action_name == 'annotate' %> + + +<% end %> diff --git a/init.rb b/init.rb index 80bd07e..8424c89 100644 --- a/init.rb +++ b/init.rb @@ -1,5 +1,6 @@ require 'redmine' require File.expand_path('../lib/github_repositories_helper_patch', __FILE__) +require File.expand_path('../lib/hooks', __FILE__) Redmine::Plugin.register :redmine_github_adapter do name 'Redmine Github Adapter plugin' diff --git a/lib/hooks.rb b/lib/hooks.rb new file mode 100644 index 0000000..750e020 --- /dev/null +++ b/lib/hooks.rb @@ -0,0 +1,5 @@ +module RedmineGithubAdapter + class Hooks < Redmine::Hook::ViewListener + render_on :view_repositories_show_contextual, partial: 'annotate_link_patch.js' + end +end