Skip to content

Commit d0db4f0

Browse files
committed
adds sample for custom_fields, journals and attachment json generation
1 parent d83a97b commit d0db4f0

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lib/redmine_gtt_print/issue_to_json.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,40 @@ def self.attributes_hash(issue, other_attributes)
6666
# priority: (IssuePriority.find issue.priority_id),
6767
# author: (User.find issue.author_id),
6868
# assigned_to: (User.find issue.assigned_to_id),
69+
70+
# custom_fields: issue.visible_custom_field_values.map {|cfv|
71+
# {
72+
# id: cfv.custom_field.id,
73+
# name: cfv.custom_field.name,
74+
# multiple: cfv.custom_field.multiple?,
75+
# value: cfv.value
76+
# }
77+
# },
78+
# journals: issue.visible_journals_with_index.map{|j|
79+
# {
80+
# user: { login: j.user&.login, id: j.user&.id, name: j.user&.name },
81+
# notes: j.notes,
82+
# created_on: j.created_on,
83+
# details: j.visible_details.map{|d|
84+
# {
85+
# property: d.property,
86+
# name: d.prop_key,
87+
# old_value: d.old_value,
88+
# new_value: d.new_value
89+
# }
90+
# }
91+
# }
92+
# },
93+
# attachments: issue.attachments.map{|a|
94+
# {
95+
# id: a.id,
96+
# filename: a.filename,
97+
# filesize: a.filesize,
98+
# content_type: a.content_type,
99+
# description: a.description,
100+
# content_url: nil, # this is a bit more complex as we do not have access to URL generation methods here.
101+
# }
102+
# }
69103
}
70104
end
71105

0 commit comments

Comments
 (0)