Skip to content

Commit cde3538

Browse files
committed
[新しいチケットタブを追加] サンプル作成
1 parent a0a2c85 commit cde3538

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ If this project serves you well, please support this project as a [sponsor](http
2727
* [Toggle the display of the sidebar / サイドバーの表示・非表示を切り替え](./examples/0004.toggle_sidebar/example.md)
2828
* [Add a link to the list of all issues on the header / 全てのチケット一覧のリンクをヘッダに追加](./examples/0005.add_issues_link_on_header/example.md)
2929
* [Change the URL of the link to each project in the project list / プロジェクト一覧の各プロジェクトへのリンクのURLを変更](./examples/0006.change_project_link_url/example.md)
30+
* [Add a new Issue tab (and "+" button available) / 新しいチケットタブを追加 ("+"ボタンと両立)](./examples/0009.add_new_issue_tab/example.md)
3031

3132
### Old
3233

33-
* [新しいチケットタブを表示する(Redmine3.3で"+"ボタンと両立した時)](./old-examples/add_new_issue_tab.js)
3434
* [チケット一覧の進捗率にて値も表示する](./old-examples/add_value_of_progress_on_issues_list.js)
3535
* [カスタムフィールドのチェックボックスを2列で表示](./old-examples/multi_column_checkbox.css)
3636
* [チケット一覧のコンテキストメニューにコマンド追加](./old-examples/add_command_to_issues_context_menu.js)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Add a new Issue tab
2+
3+
Add a new Issue tab.
4+
新しいチケットタブを追加します。
5+
6+
In the Redmine settings, you can only show either the new Issue tab or the "+" button, but this setting allows you to show both.
7+
Redmineの設定では、新しいチケットタブか"+"ボタンのどちらかしか表示できませんが、この設定により、両方を表示することができます。
8+
9+
## Setting
10+
11+
### Path Pattern
12+
13+
None
14+
15+
### Insert Position
16+
17+
Head of all pages
18+
<!--
19+
Head of all pages
20+
Bottom of issue form
21+
Bottom of issue detail
22+
Bottom of all pages
23+
-->
24+
25+
### Code
26+
27+
JavaScript
28+
<!--
29+
JavaScript
30+
CSS
31+
HTML
32+
-->
33+
34+
```javascript
35+
$(function() {
36+
const newIssueSub = $('.menu-children a.new-issue-sub');
37+
38+
if (newIssueSub.size() == 1) {
39+
// When "New Issue" exists in the "+" button, add it to the tab as well
40+
$('#main-menu > ul > li > a.issues').parent()
41+
.after($('<li>').append(newIssueSub.clone().attr('class', 'new-issue')));
42+
43+
if (location.pathname == newIssueSub.attr('href')) {
44+
// Switch the selection to the "New Issue" tab
45+
$('#main-menu > ul > li > a.issues').removeClass('selected');
46+
$('#main-menu > ul > li > a.new-issue').addClass('selected');
47+
}
48+
}
49+
});
50+
```
51+
52+
## Result
53+
54+
![result](./result.gif)
204 KB
Loading

0 commit comments

Comments
 (0)