Skip to content

Commit d03ffd6

Browse files
authored
Merge pull request #99 from onozaty/develop/v3.3.0
Develop v3.3.0
2 parents 0cb37b0 + 1ee381d commit d03ffd6

File tree

11 files changed

+43
-2
lines changed

11 files changed

+43
-2
lines changed

Diff for: README.ja.md

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ bundle exec rake redmine:plugins:migrate RAILS_ENV=production
5555
チケットの入力欄は、トラッカーやステータスを変えると再構成されますが、「Bottom of issue form」を指定しておくと再構成された際に再度実行されるので、入力欄に対する処理はこれを指定すると便利です。
5656
* 「Bottom of issue detail」 : チケットの詳細表示の下部。
5757
* 「Bottom of all pages」 : 全てのページの末尾(HTML body内で一番下の部分)。
58+
* 「Issues context menu」 : チケット一覧のコンテキストメニュー。
5859

5960
該当ページにコードの挿入位置に該当する箇所が無かった場合、コードは埋め込まれません。たとえば、「Path pattern」と「Project pattern」の設定が無く、全ページが対象となっても、「Insertion position」に「Bottom of issue detail」を指定していると、チケットの詳細表示画面でしかコードが実行されないことになります。
6061

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ If the project pattern was set, the code will not be inserted if the current pro
5656
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.
5757
* "Bottom of issue detail"
5858
* "Bottom of all pages" (Last in HTML body)
59+
* "Issues context menu"
5960

6061
If there is no part corresponding to the insertion position of the code on the page, the code is not insert.
6162
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.

Diff for: app/models/view_customize.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ class ViewCustomize < ActiveRecord::Base
2222
INSERTION_POSITION_HTML_BOTTOM = "html_bottom"
2323
INSERTION_POSITION_ISSUE_FORM = "issue_form"
2424
INSERTION_POSITION_ISSUE_SHOW = "issue_show"
25+
INSERTION_POSITION_ISSUES_CONTEXT_MENU = "issues_context_menu"
2526

2627
@@insertion_positions = {
2728
:label_insertion_position_html_head => INSERTION_POSITION_HTML_HEAD,
2829
:label_insertion_position_issue_form => INSERTION_POSITION_ISSUE_FORM,
2930
:label_insertion_position_issue_show => INSERTION_POSITION_ISSUE_SHOW,
30-
:label_insertion_position_html_bottom => INSERTION_POSITION_HTML_BOTTOM
31+
:label_insertion_position_html_bottom => INSERTION_POSITION_HTML_BOTTOM,
32+
:label_insertion_position_issues_context_menu => INSERTION_POSITION_ISSUES_CONTEXT_MENU
3133
}
3234

3335
def customize_types

Diff for: config/locales/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ en:
1111
label_insertion_position_html_bottom: "Bottom of all pages"
1212
label_insertion_position_issue_form: "Bottom of issue form"
1313
label_insertion_position_issue_show: "Bottom of issue detail"
14+
label_insertion_position_issues_context_menu: "Issues context menu"
1415
field_path_pattern: "Path pattern"
1516
field_project_pattern: "Project pattern"
1617
field_insertion_position: "Insertion position"

Diff for: config/locales/ja.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ja:
1111
label_insertion_position_html_bottom: "全ページの末尾"
1212
label_insertion_position_issue_form: "チケット入力欄の下"
1313
label_insertion_position_issue_show: "チケット詳細の下"
14+
label_insertion_position_issues_context_menu: "チケット一覧のコンテキストメニュー"
1415
field_path_pattern: "パスのパターン"
1516
field_project_pattern: "プロジェクトのパターン"
1617
field_insertion_position: "挿入位置"

Diff for: config/locales/zh-TW.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ zh-TW:
1111
label_insertion_position_html_bottom: "所有頁面的底部"
1212
label_insertion_position_issue_form: "議題清單底部"
1313
label_insertion_position_issue_show: "議題詳情頁面"
14+
label_insertion_position_issues_context_menu: "議題上下文菜單"
1415
field_path_pattern: "路徑表達式"
1516
field_project_pattern: "專案表達式"
1617
field_insertion_position: "嵌入位置"

Diff for: config/locales/zh.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ zh:
1111
label_insertion_position_html_bottom: "所有页面的底部"
1212
label_insertion_position_issue_form: "问题(issue)表单底部"
1313
label_insertion_position_issue_show: "问题(issue)详情页面"
14+
label_insertion_position_issues_context_menu: "问题(issue)上下文菜单"
1415
field_path_pattern: "路径表达式"
1516
field_project_pattern: "项目表达式"
1617
field_insertion_position: "嵌入位置"

Diff for: init.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name 'View Customize plugin'
44
author 'onozaty'
55
description 'View Customize plugin for Redmine'
6-
version '3.2.0'
6+
version '3.3.0'
77
url 'https://github.com/onozaty/redmine-view-customize'
88
author_url 'https://github.com/onozaty'
99

Diff for: lib/redmine_view_customize/view_hook.rb

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def view_issues_show_details_bottom(context={})
5050

5151
return html
5252
end
53+
54+
def view_issues_context_menu_end(context={})
55+
return "\n" + create_view_customize_html(context, ViewCustomize::INSERTION_POSITION_ISSUES_CONTEXT_MENU)
56+
end
5357

5458
private
5559

Diff for: test/fixtures/view_customizes.yml

+11
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,14 @@ view_customize_009:
9797
customize_type: javascript
9898
comments: comment_009
9999
project_pattern: ""
100+
view_customize_010:
101+
id: 10
102+
path_pattern: ""
103+
code: code_010
104+
is_enabled: true
105+
is_private: false
106+
author_id: 1
107+
insertion_position: issues_context_menu
108+
customize_type: javascript
109+
comments: comment_010
110+
project_pattern: ""

Diff for: test/unit/view_customize_view_hook_test.rb

+18
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,24 @@ def test_view_layouts_base_body_bottom
115115
assert_equal expected, html
116116
end
117117

118+
def test_view_issues_context_menu_end
119+
120+
User.current = User.find(1)
121+
122+
expected = <<HTML
123+
124+
<!-- view customize id:10 -->
125+
<script type=\"text/javascript\">
126+
//<![CDATA[
127+
code_010
128+
//]]>
129+
</script>
130+
HTML
131+
132+
html = @hook.view_issues_context_menu_end({:request => Request.new("/issues")})
133+
assert_equal expected, html
134+
end
135+
118136
def test_view_issues_form_details_bottom
119137

120138
User.current = User.find(1)

0 commit comments

Comments
 (0)