181 |
181 |
def render_custom_fields_rows(issue)
|
182 |
182 |
values = issue.visible_custom_field_values
|
183 |
183 |
return if values.empty?
|
|
184 |
|
|
185 |
#Don't take long text fields
|
|
186 |
non_longtext_values = []
|
|
187 |
values.compact.each do |value|
|
|
188 |
if !(value.custom_field.format.is_a?(Redmine::FieldFormat::TextFormat)) then
|
|
189 |
non_longtext_values << value
|
|
190 |
end
|
|
191 |
end
|
|
192 |
|
184 |
193 |
ordered_values = []
|
185 |
|
half = (values.size / 2.0).ceil
|
|
194 |
half = (non_longtext_values.size / 2.0).ceil
|
186 |
195 |
half.times do |i|
|
187 |
|
ordered_values << values[i]
|
188 |
|
ordered_values << values[i + half]
|
|
196 |
ordered_values << non_longtext_values[i]
|
|
197 |
ordered_values << non_longtext_values[i + half]
|
189 |
198 |
end
|
190 |
199 |
s = "<tr>\n"
|
191 |
200 |
n = 0
|
192 |
201 |
ordered_values.compact.each do |value|
|
193 |
202 |
css = "cf_#{value.custom_field.id}"
|
194 |
203 |
s << "</tr>\n<tr>\n" if n > 0 && (n % 2) == 0
|
195 |
|
s << "\t<th class=\"#{css}\">#{ h(value.custom_field.name) }:</th><td class=\"#{css}\">#{ h(show_value(value)) }</td>\n"
|
|
204 |
s << "\t<th class=\"#{css}\">#{ h(value.custom_field.name) }:</th><td class=\"#{css}\">#{ h(show_value(value)) }</td>\n"
|
196 |
205 |
n += 1
|
197 |
206 |
end
|
198 |
207 |
s << "</tr>\n"
|
199 |
208 |
s.html_safe
|
200 |
209 |
end
|
201 |
210 |
|
|
211 |
|
|
212 |
def render_custom_fields_long_text_rows(issue)
|
|
213 |
values = issue.visible_custom_field_values
|
|
214 |
return if values.empty?
|
|
215 |
|
|
216 |
#Only take long text fields
|
|
217 |
longtext_values = []
|
|
218 |
values.compact.each do |value|
|
|
219 |
if value.custom_field.format.is_a?(Redmine::FieldFormat::TextFormat) then
|
|
220 |
longtext_values << value
|
|
221 |
end
|
|
222 |
end
|
|
223 |
|
|
224 |
s = "<tr>\n</tr>\n"
|
|
225 |
longtext_values.compact.each do |value|
|
|
226 |
css = "cf_#{value.custom_field.id}"
|
|
227 |
s << "<tr>\n<td class=\"#{css}\"></td>\n</tr>\n"
|
|
228 |
s << "<tr>\n\t<th class=\"#{css}\">#{ h(value.custom_field.name) }:</th>\n</tr>\n"
|
|
229 |
s << "<tr>\n\t<td class=\"#{css}\">#{ h(show_value(value)) }</td>\n</tr>\n"
|
|
230 |
s << "<tr>\n<td class=\"#{css}\"></td>\n</tr>\n"
|
|
231 |
end
|
|
232 |
s << "<tr>\n</tr>\n"
|
|
233 |
s.html_safe
|
|
234 |
end
|
|
235 |
|
|
236 |
|
202 |
237 |
# Returns the path for updating the issue form
|
203 |
238 |
# with project as the current project
|
204 |
239 |
def update_issue_form_path(project, issue)
|