Skip to content

Commit 33491bb

Browse files
authored
Merge pull request #39 from onozaty/develop-2.1.0
Develop 2.1.0
2 parents 916cd30 + fa0786f commit 33491bb

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

README.ja.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## 機能
66

7-
条件に一致した画面に対して、JavaScript、CSSを埋め込むことで、画面をカスタマイズします。
7+
条件に一致した画面に対して、JavaScript、CSS、HTMLを埋め込むことで、画面をカスタマイズします。
88

99
## インストール方法
1010

@@ -50,7 +50,7 @@ bundle exec rake redmine:plugins:migrate RAILS_ENV=production
5050

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

53-
「Type」にてコードの種類(「JavaScript」または「CSS」)を選択し、「Code」に実際のコードを入力します。
53+
「Type」にてコードの種類(「JavaScript」「CSS」または「HTML」)を選択し、「Code」に実際のコードを入力します。
5454

5555
「Comment」にはカスタマイズに対する概要を記載できます。ここで入力した内容は、一覧表示で表示されます。(Commentが入力されていればComment、Commentが入力されていない場合はCodeが一覧に表示)
5656

@@ -127,7 +127,7 @@ ViewCustomize = {
127127

128128
## サポートバージョン
129129

130-
* 最新バージョン : Redmine 3.1.x 以降
130+
* 最新バージョン : Redmine 3.1.x から 3.4.x、4.0.x 以降
131131
* 1.2.2 : Redmine 2.0.x から 3.4.x
132132

133133
## ライセンス

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This a plugin allows you to customize the view for the [Redmine](http://www.redm
44

55
## Features
66

7-
Customize the page by inserting JavaScript or CSS on the page that matched the condition.
7+
Customize the page by inserting JavaScript, CSS or HTML on the page that matched the condition.
88

99
## Installation
1010

@@ -53,7 +53,7 @@ Issue input fields are reconstructed when trackers or statuses are changed. If "
5353
If there is no part corresponding to the insertion position of the code on the page, the code is not insert.
5454
For example, even if you specify `.*` in "Path pattern", if "Bottom of issue detail" is specified for "Insertion position", it will be executed only on the issue detail page.
5555

56-
In "Type", select the type of code ("JavaScript" or "CSS") and enter the actual code in "Code".
56+
In "Type", select the type of code ("JavaScript", "CSS" or "HTML") and enter the actual code in "Code".
5757

5858
For "Comment" you can put an overview on customization. The contents entered here are displayed in the list display.
5959
When "Comment" is entered, "Comment" is displayed on the list.
@@ -133,7 +133,7 @@ For example, to access the user's API key is `ViewCustomize.context.user.apiKey`
133133

134134
## Supported versions
135135

136-
* Current version : Redmine 3.1.x or later
136+
* Current version : Redmine 3.1.x - 3.4.x, 4.0.x or later
137137
* 1.2.2 : Redmine 2.0.x - 3.4.x
138138

139139
## License

app/models/view_customize.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ class ViewCustomize < ActiveRecord::Base
1010

1111
TYPE_JAVASCRIPT = "javascript"
1212
TYPE_CSS = "css"
13+
TYPE_HTML = "html"
1314

1415
@@customize_types = {
1516
:label_javascript => TYPE_JAVASCRIPT,
16-
:label_css => TYPE_CSS
17+
:label_css => TYPE_CSS,
18+
:label_html => TYPE_HTML
1719
}
1820

1921
INSERTION_POSITION_HTML_HEAD = "html_head"
@@ -50,6 +52,10 @@ def is_css?
5052
customize_type == TYPE_CSS
5153
end
5254

55+
def is_html?
56+
customize_type == TYPE_HTML
57+
end
58+
5359
def available?(user=User.current)
5460
is_enabled && (!is_private || author == user)
5561
end

app/views/view_customizes/show.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<tr>
2929
<th><%=h l(:field_code) %></th>
3030
<td><div><%= highlight_by_language(
31-
@view_customize.code, @view_customize.is_javascript? ? :js : :css) %></div></td>
31+
@view_customize.code, @view_customize.customize_type.to_sym) %></div></td>
3232
</tr>
3333
<tr>
3434
<th><%=h l(:field_comments) %></th>

config/locales/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ en:
55
label_view_customizes_new: "New view customize"
66
label_javascript: "JavaScript"
77
label_css: "CSS"
8+
label_html: "HTML"
89
label_insertion_position_html_head: "Head of all pages"
910
label_insertion_position_issue_form: "Bottom of issue form"
1011
label_insertion_position_issue_show: "Bottom of issue detail"

config/locales/ja.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ja:
44
label_view_customizes_new: "新しい表示のカスタマイズ"
55
label_javascript: "JavaScript"
66
label_css: "CSS"
7+
label_html: "HTML"
78
label_insertion_position_html_head: "全てのページのヘッダ"
89
label_insertion_position_issue_form: "チケット入力欄の下"
910
label_insertion_position_issue_show: "チケット詳細の下"

init.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
name 'View Customize plugin'
66
author 'onozaty'
77
description 'View Customize plugin for Redmine'
8-
version '2.0.1'
8+
version '2.1.0'
99
url 'https://github.com/onozaty/redmine-view-customize'
1010
author_url 'https://github.com/onozaty'
1111

lib/view_customize/view_hook.rb

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def to_html(view_customize)
6363
html << "<style type=\"text/css\">\n"
6464
html << view_customize.code
6565
html << "\n</style>"
66+
elsif view_customize.is_html?
67+
html << view_customize.code
6668
end
6769

6870
return html

0 commit comments

Comments
 (0)