From 984ef3838266ca16c5eba89e1c5c6cab6aaa1819 Mon Sep 17 00:00:00 2001 From: mantykora-net <54579864+mantykora-net@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:57:58 +0100 Subject: [PATCH 1/7] Update view_hook.rb added hook for view_issues_context_menu_end --- lib/redmine_view_customize/view_hook.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/redmine_view_customize/view_hook.rb b/lib/redmine_view_customize/view_hook.rb index c28ba8f..b2dc336 100644 --- a/lib/redmine_view_customize/view_hook.rb +++ b/lib/redmine_view_customize/view_hook.rb @@ -50,6 +50,10 @@ def view_issues_show_details_bottom(context={}) return html end + + def view_issues_context_menu_end(context={}) + return "\n" + create_view_customize_html(context, ViewCustomize::INSERTION_POSITION_CONTEXT_MENU_END) + end private From 38e82faa2567791a22370f07c37ce02f3b1de4c7 Mon Sep 17 00:00:00 2001 From: mantykora-net <54579864+mantykora-net@users.noreply.github.com> Date: Wed, 11 Jan 2023 13:59:28 +0100 Subject: [PATCH 2/7] Update view_customize.rb Added insertion position for context_menu_end --- app/models/view_customize.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/view_customize.rb b/app/models/view_customize.rb index 592c1a2..c4bbea0 100644 --- a/app/models/view_customize.rb +++ b/app/models/view_customize.rb @@ -22,12 +22,14 @@ class ViewCustomize < ActiveRecord::Base INSERTION_POSITION_HTML_BOTTOM = "html_bottom" INSERTION_POSITION_ISSUE_FORM = "issue_form" INSERTION_POSITION_ISSUE_SHOW = "issue_show" + INSERTION_POSITION_CONTEXT_MENU_END = "context_menu_end" @@insertion_positions = { :label_insertion_position_html_head => INSERTION_POSITION_HTML_HEAD, :label_insertion_position_issue_form => INSERTION_POSITION_ISSUE_FORM, :label_insertion_position_issue_show => INSERTION_POSITION_ISSUE_SHOW, - :label_insertion_position_html_bottom => INSERTION_POSITION_HTML_BOTTOM + :label_insertion_position_html_bottom => INSERTION_POSITION_HTML_BOTTOM, + :label_insertion_position_context_menu_end => INSERTION_POSITION_CONTEXT_MENU_END } def customize_types From 856112e7d059158d870c1468ec80215c433b08e7 Mon Sep 17 00:00:00 2001 From: mantykora-net <54579864+mantykora-net@users.noreply.github.com> Date: Wed, 11 Jan 2023 14:00:13 +0100 Subject: [PATCH 3/7] Update en.yml Lang entry for context_menu_end label. --- config/locales/en.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/locales/en.yml b/config/locales/en.yml index 76b1171..6f2b75d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -11,6 +11,7 @@ en: label_insertion_position_html_bottom: "Bottom of all pages" label_insertion_position_issue_form: "Bottom of issue form" label_insertion_position_issue_show: "Bottom of issue detail" + label_insertion_position_context_menu_end: "End of context menu" field_path_pattern: "Path pattern" field_project_pattern: "Project pattern" field_insertion_position: "Insertion position" From aa5c0ecdb306db6de039d4d84bd627a44eebb58a Mon Sep 17 00:00:00 2001 From: onozaty Date: Mon, 16 Jan 2023 21:35:45 +0900 Subject: [PATCH 4/7] Add unit test #98 --- test/fixtures/view_customizes.yml | 11 +++++++++++ test/unit/view_customize_view_hook_test.rb | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/test/fixtures/view_customizes.yml b/test/fixtures/view_customizes.yml index e0a8ad8..142ae48 100644 --- a/test/fixtures/view_customizes.yml +++ b/test/fixtures/view_customizes.yml @@ -97,3 +97,14 @@ view_customize_009: customize_type: javascript comments: comment_009 project_pattern: "" +view_customize_010: + id: 10 + path_pattern: "" + code: code_010 + is_enabled: true + is_private: false + author_id: 1 + insertion_position: context_menu_end + customize_type: javascript + comments: comment_010 + project_pattern: "" diff --git a/test/unit/view_customize_view_hook_test.rb b/test/unit/view_customize_view_hook_test.rb index 531c547..082c633 100644 --- a/test/unit/view_customize_view_hook_test.rb +++ b/test/unit/view_customize_view_hook_test.rb @@ -115,6 +115,24 @@ def test_view_layouts_base_body_bottom assert_equal expected, html end + def test_view_issues_context_menu_end + + User.current = User.find(1) + + expected = < + +HTML + + html = @hook.view_issues_context_menu_end({:request => Request.new("/issues")}) + assert_equal expected, html + end + def test_view_issues_form_details_bottom User.current = User.find(1) From e2315f353f9e0b8d5faa4f2450c66097391ed20e Mon Sep 17 00:00:00 2001 From: onozaty Date: Mon, 16 Jan 2023 21:52:25 +0900 Subject: [PATCH 5/7] Change insertion position name #98 --- app/models/view_customize.rb | 4 ++-- config/locales/en.yml | 2 +- config/locales/ja.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + lib/redmine_view_customize/view_hook.rb | 2 +- test/fixtures/view_customizes.yml | 2 +- 7 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/models/view_customize.rb b/app/models/view_customize.rb index c4bbea0..ce9e5d9 100644 --- a/app/models/view_customize.rb +++ b/app/models/view_customize.rb @@ -22,14 +22,14 @@ class ViewCustomize < ActiveRecord::Base INSERTION_POSITION_HTML_BOTTOM = "html_bottom" INSERTION_POSITION_ISSUE_FORM = "issue_form" INSERTION_POSITION_ISSUE_SHOW = "issue_show" - INSERTION_POSITION_CONTEXT_MENU_END = "context_menu_end" + INSERTION_POSITION_ISSUES_CONTEXT_MENU = "issues_context_menu" @@insertion_positions = { :label_insertion_position_html_head => INSERTION_POSITION_HTML_HEAD, :label_insertion_position_issue_form => INSERTION_POSITION_ISSUE_FORM, :label_insertion_position_issue_show => INSERTION_POSITION_ISSUE_SHOW, :label_insertion_position_html_bottom => INSERTION_POSITION_HTML_BOTTOM, - :label_insertion_position_context_menu_end => INSERTION_POSITION_CONTEXT_MENU_END + :label_insertion_position_issues_context_menu => INSERTION_POSITION_ISSUES_CONTEXT_MENU } def customize_types diff --git a/config/locales/en.yml b/config/locales/en.yml index 6f2b75d..a4e82f0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -11,7 +11,7 @@ en: label_insertion_position_html_bottom: "Bottom of all pages" label_insertion_position_issue_form: "Bottom of issue form" label_insertion_position_issue_show: "Bottom of issue detail" - label_insertion_position_context_menu_end: "End of context menu" + label_insertion_position_issues_context_menu: "Issues context menu" field_path_pattern: "Path pattern" field_project_pattern: "Project pattern" field_insertion_position: "Insertion position" diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 4626452..273af7e 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -11,6 +11,7 @@ ja: label_insertion_position_html_bottom: "全ページの末尾" label_insertion_position_issue_form: "チケット入力欄の下" label_insertion_position_issue_show: "チケット詳細の下" + label_insertion_position_issues_context_menu: "チケット一覧のコンテキストメニュー" field_path_pattern: "パスのパターン" field_project_pattern: "プロジェクトのパターン" field_insertion_position: "挿入位置" diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index daad9c4..93326b7 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -11,6 +11,7 @@ zh-TW: label_insertion_position_html_bottom: "所有頁面的底部" label_insertion_position_issue_form: "議題清單底部" label_insertion_position_issue_show: "議題詳情頁面" + label_insertion_position_issues_context_menu: "議題上下文菜單" field_path_pattern: "路徑表達式" field_project_pattern: "專案表達式" field_insertion_position: "嵌入位置" diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2f65e31..79a6380 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -11,6 +11,7 @@ zh: label_insertion_position_html_bottom: "所有页面的底部" label_insertion_position_issue_form: "问题(issue)表单底部" label_insertion_position_issue_show: "问题(issue)详情页面" + label_insertion_position_issues_context_menu: "问题(issue)上下文菜单" field_path_pattern: "路径表达式" field_project_pattern: "项目表达式" field_insertion_position: "嵌入位置" diff --git a/lib/redmine_view_customize/view_hook.rb b/lib/redmine_view_customize/view_hook.rb index b2dc336..37e5d08 100644 --- a/lib/redmine_view_customize/view_hook.rb +++ b/lib/redmine_view_customize/view_hook.rb @@ -52,7 +52,7 @@ def view_issues_show_details_bottom(context={}) end def view_issues_context_menu_end(context={}) - return "\n" + create_view_customize_html(context, ViewCustomize::INSERTION_POSITION_CONTEXT_MENU_END) + return "\n" + create_view_customize_html(context, ViewCustomize::INSERTION_POSITION_ISSUES_CONTEXT_MENU) end private diff --git a/test/fixtures/view_customizes.yml b/test/fixtures/view_customizes.yml index 142ae48..820a0f1 100644 --- a/test/fixtures/view_customizes.yml +++ b/test/fixtures/view_customizes.yml @@ -104,7 +104,7 @@ view_customize_010: is_enabled: true is_private: false author_id: 1 - insertion_position: context_menu_end + insertion_position: issues_context_menu customize_type: javascript comments: comment_010 project_pattern: "" From 48969cbd9e80ad70600197cf28220e7d3312c773 Mon Sep 17 00:00:00 2001 From: onozaty Date: Mon, 16 Jan 2023 22:12:28 +0900 Subject: [PATCH 6/7] Change README #98 --- README.ja.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.ja.md b/README.ja.md index 92806b2..ab1f06c 100644 --- a/README.ja.md +++ b/README.ja.md @@ -55,6 +55,7 @@ bundle exec rake redmine:plugins:migrate RAILS_ENV=production チケットの入力欄は、トラッカーやステータスを変えると再構成されますが、「Bottom of issue form」を指定しておくと再構成された際に再度実行されるので、入力欄に対する処理はこれを指定すると便利です。 * 「Bottom of issue detail」 : チケットの詳細表示の下部。 * 「Bottom of all pages」 : 全てのページの末尾(HTML body内で一番下の部分)。 +* 「Issues context menu」 : チケット一覧のコンテキストメニュー。 該当ページにコードの挿入位置に該当する箇所が無かった場合、コードは埋め込まれません。たとえば、「Path pattern」と「Project pattern」の設定が無く、全ページが対象となっても、「Insertion position」に「Bottom of issue detail」を指定していると、チケットの詳細表示画面でしかコードが実行されないことになります。 diff --git a/README.md b/README.md index f609142..7a4e212 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ If the project pattern was set, the code will not be inserted if the current pro Issue input fields are reconstructed when trackers or statuses are changed. If "Bottom of issue form" is specified, it will be executed again when reconstructed. * "Bottom of issue detail" * "Bottom of all pages" (Last in HTML body) +* "Issues context menu" If there is no part corresponding to the insertion position of the code on the page, the code is not insert. For example, even if there are no "Path pattern" and "Project pattern" settings and all pages are targeted, if "Bottom of issue detail" is specified for "Insertion position", it will be executed only on the issue detail page. From 1ee381d52a6bddebf19e2595e34d8e92bf770d00 Mon Sep 17 00:00:00 2001 From: onozaty Date: Mon, 16 Jan 2023 22:13:13 +0900 Subject: [PATCH 7/7] Update version number to 3.3.0 --- init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.rb b/init.rb index e2d6039..aa739b8 100644 --- a/init.rb +++ b/init.rb @@ -3,7 +3,7 @@ name 'View Customize plugin' author 'onozaty' description 'View Customize plugin for Redmine' - version '3.2.0' + version '3.3.0' url 'https://github.com/onozaty/redmine-view-customize' author_url 'https://github.com/onozaty'