##// END OF EJS Templates
Fixed: custom fields are not displayed in the same order on issue form and view....
Jean-Philippe Lang -
r2722:cfd7d07b69e2
parent child
Show More
@@ -33,6 +33,25 module IssuesHelper
33 "<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
33 "<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
34 end
34 end
35
35
36 def render_custom_fields_rows(issue)
37 return if issue.custom_field_values.empty?
38 ordered_values = []
39 half = (issue.custom_field_values.size / 2.0).ceil
40 half.times do |i|
41 ordered_values << issue.custom_field_values[i]
42 ordered_values << issue.custom_field_values[i + half]
43 end
44 s = "<tr>\n"
45 n = 0
46 ordered_values.compact.each do |value|
47 s << "</tr>\n<tr>\n" if n > 0 && (n % 2) == 0
48 s << "\t<th>#{ h(value.custom_field.name) }:</th><td>#{ simple_format_without_paragraph(h(show_value(value))) }</td>\n"
49 n += 1
50 end
51 s << "</tr>\n"
52 s
53 end
54
36 def sidebar_queries
55 def sidebar_queries
37 unless @sidebar_queries
56 unless @sidebar_queries
38 # User can see public queries and his own queries
57 # User can see public queries and his own queries
@@ -1,6 +1,6
1 <div class="splitcontentleft">
1 <div class="splitcontentleft">
2 <% i = 0 %>
2 <% i = 0 %>
3 <% split_on = @issue.custom_field_values.size / 2 %>
3 <% split_on = (@issue.custom_field_values.size / 2.0).ceil - 1 %>
4 <% @issue.custom_field_values.each do |value| %>
4 <% @issue.custom_field_values.each do |value| %>
5 <p><%= custom_field_tag_with_label :issue, value %></p>
5 <p><%= custom_field_tag_with_label :issue, value %></p>
6 <% if i == split_on -%>
6 <% if i == split_on -%>
@@ -45,17 +45,7
45 <th class="estimated-hours"><%=l(:field_estimated_hours)%>:</th><td><%= l_hours(@issue.estimated_hours) %></td>
45 <th class="estimated-hours"><%=l(:field_estimated_hours)%>:</th><td><%= l_hours(@issue.estimated_hours) %></td>
46 <% end %>
46 <% end %>
47 </tr>
47 </tr>
48 <tr>
48 <%= render_custom_fields_rows(@issue) %>
49 <% n = 0 -%>
50 <% @issue.custom_field_values.each do |value| -%>
51 <th><%=h value.custom_field.name %>:</th><td><%= simple_format_without_paragraph(h(show_value(value))) %></td>
52 <% n = n + 1
53 if (n > 1)
54 n = 0 %>
55 </tr><tr>
56 <%end
57 end %>
58 </tr>
59 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
49 <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %>
60 </table>
50 </table>
61 <hr />
51 <hr />
General Comments 0
You need to be logged in to leave comments. Login now