こんにちは。
> チケットの詳細画面で、説明の下に回答項目(カスタムフィールド)表示させるには、どのようにすればよいでしょうか?
カスタムフィールドそのものを説明の下に表示するようにすることは、ソースを書きかえれば可能です。
IssuesHelper#render_custom_fields_rows の<tr>の追加をやめて、
app/views/issues/show.rhtml の render_custom_fields_rows を追加している位置を
discriptionの後に来るようにしてはいかがでしょうか。
レイアウトは崩れてしまうかもしれませんが…
> また、CSV出力時に、カスタムフィールドを一番右に出力するには、どのようにすればよろしいでしょうか?
IssuesHelper#issues_to_csv で順番を変更できると思います。
description というのが説明にあたるので、カスタムフィールドの後ろに来るようにheadersとfieldsの順番を変更すれば大丈夫で
す。
また、
Journal.find(:all,
:conditions => ["journalized_id= ?",
issue.id],
:order => :created_on).map(&:notes).uniq.each do |note|
fields << "#{note}\x0D\x0A"
end
を、最後の方に書くことで注記をcsvに出力することも可能です。
実際に私が書いたパッチはこんな感じになっています。
Index: app/helpers/issues_helper.rb
===================================================================
--- app/helpers/issues_helper.rb (リビジョン 4033)
+++ app/helpers/issues_helper.rb (作業コピー)
@@ -199,7 +199,8 @@
l(:field_estimated_hours),
l(:field_parent_issue),
l(:field_created_on),
- l(:field_updated_on)
+ l(:field_updated_on),
+ l(:field_description)
]
# Export project custom fields if project is given
# otherwise export custom fields marked as "For all projects"
@@ -207,7 +208,8 @@
custom_fields.each {|f| headers <<
f.name}
# Description in the last column
headers << l(:field_description)
- csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue;
c.to_s; end }
+# csv << headers.collect {|c| begin; ic.iconv(c.to_s); rescue;
c.to_s; end }
+ csv << headers.collect {|c| begin; c.to_s.tosjis; rescue;
c.to_s; end }
# csv lines
issues.each do |issue|
fields = [
issue.id,
@@ -230,7 +232,13 @@
]
custom_fields.each {|f| fields <<
show_value(issue.custom_value_for(f)) }
fields << issue.description
- csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue;
c.to_s; end }
+ Journal.find(:all,
+ :conditions => ["journalized_id= ?",
issue.id],
+ :order => :created_on).map(&:notes).uniq.each do
|note|
+ fields << "#{note}\x0D\x0A"
+ end
+# csv << fields.collect {|c| begin; ic.iconv(c.to_s); rescue;
c.to_s; end }
+ csv << fields.collect {|c| begin; c.to_s.tosjis; rescue;
c.to_s; end }
end
end
export
参考になれば幸いです。