@@ -1,398 +1,403 | |||
|
1 | 1 | # encoding: utf-8 |
|
2 | 2 | # |
|
3 | 3 | # Redmine - project management software |
|
4 | 4 | # Copyright (C) 2006-2012 Jean-Philippe Lang |
|
5 | 5 | # |
|
6 | 6 | # This program is free software; you can redistribute it and/or |
|
7 | 7 | # modify it under the terms of the GNU General Public License |
|
8 | 8 | # as published by the Free Software Foundation; either version 2 |
|
9 | 9 | # of the License, or (at your option) any later version. |
|
10 | 10 | # |
|
11 | 11 | # This program is distributed in the hope that it will be useful, |
|
12 | 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 | 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 | 14 | # GNU General Public License for more details. |
|
15 | 15 | # |
|
16 | 16 | # You should have received a copy of the GNU General Public License |
|
17 | 17 | # along with this program; if not, write to the Free Software |
|
18 | 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 | 19 | |
|
20 | 20 | module IssuesHelper |
|
21 | 21 | include ApplicationHelper |
|
22 | 22 | |
|
23 | 23 | def issue_list(issues, &block) |
|
24 | 24 | ancestors = [] |
|
25 | 25 | issues.each do |issue| |
|
26 | 26 | while (ancestors.any? && !issue.is_descendant_of?(ancestors.last)) |
|
27 | 27 | ancestors.pop |
|
28 | 28 | end |
|
29 | 29 | yield issue, ancestors.size |
|
30 | 30 | ancestors << issue unless issue.leaf? |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | # Renders a HTML/CSS tooltip |
|
35 | 35 | # |
|
36 | 36 | # To use, a trigger div is needed. This is a div with the class of "tooltip" |
|
37 | 37 | # that contains this method wrapped in a span with the class of "tip" |
|
38 | 38 | # |
|
39 | 39 | # <div class="tooltip"><%= link_to_issue(issue) %> |
|
40 | 40 | # <span class="tip"><%= render_issue_tooltip(issue) %></span> |
|
41 | 41 | # </div> |
|
42 | 42 | # |
|
43 | 43 | def render_issue_tooltip(issue) |
|
44 | 44 | @cached_label_status ||= l(:field_status) |
|
45 | 45 | @cached_label_start_date ||= l(:field_start_date) |
|
46 | 46 | @cached_label_due_date ||= l(:field_due_date) |
|
47 | 47 | @cached_label_assigned_to ||= l(:field_assigned_to) |
|
48 | 48 | @cached_label_priority ||= l(:field_priority) |
|
49 | 49 | @cached_label_project ||= l(:field_project) |
|
50 | 50 | |
|
51 | 51 | link_to_issue(issue) + "<br /><br />".html_safe + |
|
52 | 52 | "<strong>#{@cached_label_project}</strong>: #{link_to_project(issue.project)}<br />".html_safe + |
|
53 | 53 | "<strong>#{@cached_label_status}</strong>: #{h(issue.status.name)}<br />".html_safe + |
|
54 | 54 | "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />".html_safe + |
|
55 | 55 | "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />".html_safe + |
|
56 | 56 | "<strong>#{@cached_label_assigned_to}</strong>: #{h(issue.assigned_to)}<br />".html_safe + |
|
57 | 57 | "<strong>#{@cached_label_priority}</strong>: #{h(issue.priority.name)}".html_safe |
|
58 | 58 | end |
|
59 | 59 | |
|
60 | 60 | def issue_heading(issue) |
|
61 | 61 | h("#{issue.tracker} ##{issue.id}") |
|
62 | 62 | end |
|
63 | 63 | |
|
64 | 64 | def render_issue_subject_with_tree(issue) |
|
65 | 65 | s = '' |
|
66 | 66 | ancestors = issue.root? ? [] : issue.ancestors.visible.all |
|
67 | 67 | ancestors.each do |ancestor| |
|
68 | 68 | s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id))) |
|
69 | 69 | end |
|
70 | 70 | s << '<div>' |
|
71 | 71 | subject = h(issue.subject) |
|
72 | 72 | if issue.is_private? |
|
73 | 73 | subject = content_tag('span', l(:field_is_private), :class => 'private') + ' ' + subject |
|
74 | 74 | end |
|
75 | 75 | s << content_tag('h3', subject) |
|
76 | 76 | s << '</div>' * (ancestors.size + 1) |
|
77 | 77 | s.html_safe |
|
78 | 78 | end |
|
79 | 79 | |
|
80 | 80 | def render_descendants_tree(issue) |
|
81 | 81 | s = '<form><table class="list issues">' |
|
82 | 82 | issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level| |
|
83 | 83 | css = "issue issue-#{child.id} hascontextmenu" |
|
84 | 84 | css << " idnt idnt-#{level}" if level > 0 |
|
85 | 85 | s << content_tag('tr', |
|
86 | 86 | content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') + |
|
87 | 87 | content_tag('td', link_to_issue(child, :truncate => 60, :project => (issue.project_id != child.project_id)), :class => 'subject') + |
|
88 | 88 | content_tag('td', h(child.status)) + |
|
89 | 89 | content_tag('td', link_to_user(child.assigned_to)) + |
|
90 | 90 | content_tag('td', progress_bar(child.done_ratio, :width => '80px')), |
|
91 | 91 | :class => css) |
|
92 | 92 | end |
|
93 | 93 | s << '</table></form>' |
|
94 | 94 | s.html_safe |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | # Returns a link for adding a new subtask to the given issue | |
|
98 | def link_to_new_subtask(issue) | |
|
99 | link_to(l(:button_add), {:controller => 'issues', :action => 'new', :project_id => issue.project, :issue => {:parent_issue_id => issue}}) | |
|
100 | end | |
|
101 | ||
|
97 | 102 | class IssueFieldsRows |
|
98 | 103 | include ActionView::Helpers::TagHelper |
|
99 | 104 | |
|
100 | 105 | def initialize |
|
101 | 106 | @left = [] |
|
102 | 107 | @right = [] |
|
103 | 108 | end |
|
104 | 109 | |
|
105 | 110 | def left(*args) |
|
106 | 111 | args.any? ? @left << cells(*args) : @left |
|
107 | 112 | end |
|
108 | 113 | |
|
109 | 114 | def right(*args) |
|
110 | 115 | args.any? ? @right << cells(*args) : @right |
|
111 | 116 | end |
|
112 | 117 | |
|
113 | 118 | def size |
|
114 | 119 | @left.size > @right.size ? @left.size : @right.size |
|
115 | 120 | end |
|
116 | 121 | |
|
117 | 122 | def to_html |
|
118 | 123 | html = ''.html_safe |
|
119 | 124 | blank = content_tag('th', '') + content_tag('td', '') |
|
120 | 125 | size.times do |i| |
|
121 | 126 | left = @left[i] || blank |
|
122 | 127 | right = @right[i] || blank |
|
123 | 128 | html << content_tag('tr', left + right) |
|
124 | 129 | end |
|
125 | 130 | html |
|
126 | 131 | end |
|
127 | 132 | |
|
128 | 133 | def cells(label, text, options={}) |
|
129 | 134 | content_tag('th', "#{label}:", options) + content_tag('td', text, options) |
|
130 | 135 | end |
|
131 | 136 | end |
|
132 | 137 | |
|
133 | 138 | def issue_fields_rows |
|
134 | 139 | r = IssueFieldsRows.new |
|
135 | 140 | yield r |
|
136 | 141 | r.to_html |
|
137 | 142 | end |
|
138 | 143 | |
|
139 | 144 | def render_custom_fields_rows(issue) |
|
140 | 145 | return if issue.custom_field_values.empty? |
|
141 | 146 | ordered_values = [] |
|
142 | 147 | half = (issue.custom_field_values.size / 2.0).ceil |
|
143 | 148 | half.times do |i| |
|
144 | 149 | ordered_values << issue.custom_field_values[i] |
|
145 | 150 | ordered_values << issue.custom_field_values[i + half] |
|
146 | 151 | end |
|
147 | 152 | s = "<tr>\n" |
|
148 | 153 | n = 0 |
|
149 | 154 | ordered_values.compact.each do |value| |
|
150 | 155 | s << "</tr>\n<tr>\n" if n > 0 && (n % 2) == 0 |
|
151 | 156 | s << "\t<th>#{ h(value.custom_field.name) }:</th><td>#{ simple_format_without_paragraph(h(show_value(value))) }</td>\n" |
|
152 | 157 | n += 1 |
|
153 | 158 | end |
|
154 | 159 | s << "</tr>\n" |
|
155 | 160 | s.html_safe |
|
156 | 161 | end |
|
157 | 162 | |
|
158 | 163 | def issues_destroy_confirmation_message(issues) |
|
159 | 164 | issues = [issues] unless issues.is_a?(Array) |
|
160 | 165 | message = l(:text_issues_destroy_confirmation) |
|
161 | 166 | descendant_count = issues.inject(0) {|memo, i| memo += (i.right - i.left - 1)/2} |
|
162 | 167 | if descendant_count > 0 |
|
163 | 168 | issues.each do |issue| |
|
164 | 169 | next if issue.root? |
|
165 | 170 | issues.each do |other_issue| |
|
166 | 171 | descendant_count -= 1 if issue.is_descendant_of?(other_issue) |
|
167 | 172 | end |
|
168 | 173 | end |
|
169 | 174 | if descendant_count > 0 |
|
170 | 175 | message << "\n" + l(:text_issues_destroy_descendants_confirmation, :count => descendant_count) |
|
171 | 176 | end |
|
172 | 177 | end |
|
173 | 178 | message |
|
174 | 179 | end |
|
175 | 180 | |
|
176 | 181 | def sidebar_queries |
|
177 | 182 | unless @sidebar_queries |
|
178 | 183 | @sidebar_queries = Query.visible.all( |
|
179 | 184 | :order => "#{Query.table_name}.name ASC", |
|
180 | 185 | # Project specific queries and global queries |
|
181 | 186 | :conditions => (@project.nil? ? ["project_id IS NULL"] : ["project_id IS NULL OR project_id = ?", @project.id]) |
|
182 | 187 | ) |
|
183 | 188 | end |
|
184 | 189 | @sidebar_queries |
|
185 | 190 | end |
|
186 | 191 | |
|
187 | 192 | def query_links(title, queries) |
|
188 | 193 | # links to #index on issues/show |
|
189 | 194 | url_params = controller_name == 'issues' ? {:controller => 'issues', :action => 'index', :project_id => @project} : params |
|
190 | 195 | |
|
191 | 196 | content_tag('h3', h(title)) + |
|
192 | 197 | queries.collect {|query| |
|
193 | 198 | css = 'query' |
|
194 | 199 | css << ' selected' if query == @query |
|
195 | 200 | link_to(h(query.name), url_params.merge(:query_id => query), :class => css) |
|
196 | 201 | }.join('<br />').html_safe |
|
197 | 202 | end |
|
198 | 203 | |
|
199 | 204 | def render_sidebar_queries |
|
200 | 205 | out = ''.html_safe |
|
201 | 206 | queries = sidebar_queries.select {|q| !q.is_public?} |
|
202 | 207 | out << query_links(l(:label_my_queries), queries) if queries.any? |
|
203 | 208 | queries = sidebar_queries.select {|q| q.is_public?} |
|
204 | 209 | out << query_links(l(:label_query_plural), queries) if queries.any? |
|
205 | 210 | out |
|
206 | 211 | end |
|
207 | 212 | |
|
208 | 213 | # Returns the textual representation of a journal details |
|
209 | 214 | # as an array of strings |
|
210 | 215 | def details_to_strings(details, no_html=false, options={}) |
|
211 | 216 | options[:only_path] = (options[:only_path] == false ? false : true) |
|
212 | 217 | strings = [] |
|
213 | 218 | values_by_field = {} |
|
214 | 219 | details.each do |detail| |
|
215 | 220 | if detail.property == 'cf' |
|
216 | 221 | field_id = detail.prop_key |
|
217 | 222 | field = CustomField.find_by_id(field_id) |
|
218 | 223 | if field && field.multiple? |
|
219 | 224 | values_by_field[field_id] ||= {:added => [], :deleted => []} |
|
220 | 225 | if detail.old_value |
|
221 | 226 | values_by_field[field_id][:deleted] << detail.old_value |
|
222 | 227 | end |
|
223 | 228 | if detail.value |
|
224 | 229 | values_by_field[field_id][:added] << detail.value |
|
225 | 230 | end |
|
226 | 231 | next |
|
227 | 232 | end |
|
228 | 233 | end |
|
229 | 234 | strings << show_detail(detail, no_html, options) |
|
230 | 235 | end |
|
231 | 236 | values_by_field.each do |field_id, changes| |
|
232 | 237 | detail = JournalDetail.new(:property => 'cf', :prop_key => field_id) |
|
233 | 238 | if changes[:added].any? |
|
234 | 239 | detail.value = changes[:added] |
|
235 | 240 | strings << show_detail(detail, no_html, options) |
|
236 | 241 | elsif changes[:deleted].any? |
|
237 | 242 | detail.old_value = changes[:deleted] |
|
238 | 243 | strings << show_detail(detail, no_html, options) |
|
239 | 244 | end |
|
240 | 245 | end |
|
241 | 246 | strings |
|
242 | 247 | end |
|
243 | 248 | |
|
244 | 249 | # Returns the textual representation of a single journal detail |
|
245 | 250 | def show_detail(detail, no_html=false, options={}) |
|
246 | 251 | multiple = false |
|
247 | 252 | case detail.property |
|
248 | 253 | when 'attr' |
|
249 | 254 | field = detail.prop_key.to_s.gsub(/\_id$/, "") |
|
250 | 255 | label = l(("field_" + field).to_sym) |
|
251 | 256 | case detail.prop_key |
|
252 | 257 | when 'due_date', 'start_date' |
|
253 | 258 | value = format_date(detail.value.to_date) if detail.value |
|
254 | 259 | old_value = format_date(detail.old_value.to_date) if detail.old_value |
|
255 | 260 | |
|
256 | 261 | when 'project_id', 'status_id', 'tracker_id', 'assigned_to_id', |
|
257 | 262 | 'priority_id', 'category_id', 'fixed_version_id' |
|
258 | 263 | value = find_name_by_reflection(field, detail.value) |
|
259 | 264 | old_value = find_name_by_reflection(field, detail.old_value) |
|
260 | 265 | |
|
261 | 266 | when 'estimated_hours' |
|
262 | 267 | value = "%0.02f" % detail.value.to_f unless detail.value.blank? |
|
263 | 268 | old_value = "%0.02f" % detail.old_value.to_f unless detail.old_value.blank? |
|
264 | 269 | |
|
265 | 270 | when 'parent_id' |
|
266 | 271 | label = l(:field_parent_issue) |
|
267 | 272 | value = "##{detail.value}" unless detail.value.blank? |
|
268 | 273 | old_value = "##{detail.old_value}" unless detail.old_value.blank? |
|
269 | 274 | |
|
270 | 275 | when 'is_private' |
|
271 | 276 | value = l(detail.value == "0" ? :general_text_No : :general_text_Yes) unless detail.value.blank? |
|
272 | 277 | old_value = l(detail.old_value == "0" ? :general_text_No : :general_text_Yes) unless detail.old_value.blank? |
|
273 | 278 | end |
|
274 | 279 | when 'cf' |
|
275 | 280 | custom_field = CustomField.find_by_id(detail.prop_key) |
|
276 | 281 | if custom_field |
|
277 | 282 | multiple = custom_field.multiple? |
|
278 | 283 | label = custom_field.name |
|
279 | 284 | value = format_value(detail.value, custom_field.field_format) if detail.value |
|
280 | 285 | old_value = format_value(detail.old_value, custom_field.field_format) if detail.old_value |
|
281 | 286 | end |
|
282 | 287 | when 'attachment' |
|
283 | 288 | label = l(:label_attachment) |
|
284 | 289 | end |
|
285 | 290 | call_hook(:helper_issues_show_detail_after_setting, |
|
286 | 291 | {:detail => detail, :label => label, :value => value, :old_value => old_value }) |
|
287 | 292 | |
|
288 | 293 | label ||= detail.prop_key |
|
289 | 294 | value ||= detail.value |
|
290 | 295 | old_value ||= detail.old_value |
|
291 | 296 | |
|
292 | 297 | unless no_html |
|
293 | 298 | label = content_tag('strong', label) |
|
294 | 299 | old_value = content_tag("i", h(old_value)) if detail.old_value |
|
295 | 300 | old_value = content_tag("del", old_value) if detail.old_value and detail.value.blank? |
|
296 | 301 | if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key) |
|
297 | 302 | # Link to the attachment if it has not been removed |
|
298 | 303 | value = link_to_attachment(atta, :download => true, :only_path => options[:only_path]) |
|
299 | 304 | if options[:only_path] != false && atta.is_text? |
|
300 | 305 | value += link_to( |
|
301 | 306 | image_tag('magnifier.png'), |
|
302 | 307 | :controller => 'attachments', :action => 'show', |
|
303 | 308 | :id => atta, :filename => atta.filename |
|
304 | 309 | ) |
|
305 | 310 | end |
|
306 | 311 | else |
|
307 | 312 | value = content_tag("i", h(value)) if value |
|
308 | 313 | end |
|
309 | 314 | end |
|
310 | 315 | |
|
311 | 316 | if detail.property == 'attr' && detail.prop_key == 'description' |
|
312 | 317 | s = l(:text_journal_changed_no_detail, :label => label) |
|
313 | 318 | unless no_html |
|
314 | 319 | diff_link = link_to 'diff', |
|
315 | 320 | {:controller => 'journals', :action => 'diff', :id => detail.journal_id, |
|
316 | 321 | :detail_id => detail.id, :only_path => options[:only_path]}, |
|
317 | 322 | :title => l(:label_view_diff) |
|
318 | 323 | s << " (#{ diff_link })" |
|
319 | 324 | end |
|
320 | 325 | s.html_safe |
|
321 | 326 | elsif detail.value.present? |
|
322 | 327 | case detail.property |
|
323 | 328 | when 'attr', 'cf' |
|
324 | 329 | if detail.old_value.present? |
|
325 | 330 | l(:text_journal_changed, :label => label, :old => old_value, :new => value).html_safe |
|
326 | 331 | elsif multiple |
|
327 | 332 | l(:text_journal_added, :label => label, :value => value).html_safe |
|
328 | 333 | else |
|
329 | 334 | l(:text_journal_set_to, :label => label, :value => value).html_safe |
|
330 | 335 | end |
|
331 | 336 | when 'attachment' |
|
332 | 337 | l(:text_journal_added, :label => label, :value => value).html_safe |
|
333 | 338 | end |
|
334 | 339 | else |
|
335 | 340 | l(:text_journal_deleted, :label => label, :old => old_value).html_safe |
|
336 | 341 | end |
|
337 | 342 | end |
|
338 | 343 | |
|
339 | 344 | # Find the name of an associated record stored in the field attribute |
|
340 | 345 | def find_name_by_reflection(field, id) |
|
341 | 346 | association = Issue.reflect_on_association(field.to_sym) |
|
342 | 347 | if association |
|
343 | 348 | record = association.class_name.constantize.find_by_id(id) |
|
344 | 349 | return record.name if record |
|
345 | 350 | end |
|
346 | 351 | end |
|
347 | 352 | |
|
348 | 353 | # Renders issue children recursively |
|
349 | 354 | def render_api_issue_children(issue, api) |
|
350 | 355 | return if issue.leaf? |
|
351 | 356 | api.array :children do |
|
352 | 357 | issue.children.each do |child| |
|
353 | 358 | api.issue(:id => child.id) do |
|
354 | 359 | api.tracker(:id => child.tracker_id, :name => child.tracker.name) unless child.tracker.nil? |
|
355 | 360 | api.subject child.subject |
|
356 | 361 | render_api_issue_children(child, api) |
|
357 | 362 | end |
|
358 | 363 | end |
|
359 | 364 | end |
|
360 | 365 | end |
|
361 | 366 | |
|
362 | 367 | def issues_to_csv(issues, project, query, options={}) |
|
363 | 368 | decimal_separator = l(:general_csv_decimal_separator) |
|
364 | 369 | encoding = l(:general_csv_encoding) |
|
365 | 370 | columns = (options[:columns] == 'all' ? query.available_columns : query.columns) |
|
366 | 371 | |
|
367 | 372 | export = FCSV.generate(:col_sep => l(:general_csv_separator)) do |csv| |
|
368 | 373 | # csv header fields |
|
369 | 374 | csv << [ "#" ] + columns.collect {|c| Redmine::CodesetUtil.from_utf8(c.caption.to_s, encoding) } + |
|
370 | 375 | (options[:description] ? [Redmine::CodesetUtil.from_utf8(l(:field_description), encoding)] : []) |
|
371 | 376 | |
|
372 | 377 | # csv lines |
|
373 | 378 | issues.each do |issue| |
|
374 | 379 | col_values = columns.collect do |column| |
|
375 | 380 | s = if column.is_a?(QueryCustomFieldColumn) |
|
376 | 381 | cv = issue.custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id} |
|
377 | 382 | show_value(cv) |
|
378 | 383 | else |
|
379 | 384 | value = column.value(issue) |
|
380 | 385 | if value.is_a?(Date) |
|
381 | 386 | format_date(value) |
|
382 | 387 | elsif value.is_a?(Time) |
|
383 | 388 | format_time(value) |
|
384 | 389 | elsif value.is_a?(Float) |
|
385 | 390 | ("%.2f" % value).gsub('.', decimal_separator) |
|
386 | 391 | else |
|
387 | 392 | value |
|
388 | 393 | end |
|
389 | 394 | end |
|
390 | 395 | s.to_s |
|
391 | 396 | end |
|
392 | 397 | csv << [ issue.id.to_s ] + col_values.collect {|c| Redmine::CodesetUtil.from_utf8(c.to_s, encoding) } + |
|
393 | 398 | (options[:description] ? [Redmine::CodesetUtil.from_utf8(issue.description, encoding)] : []) |
|
394 | 399 | end |
|
395 | 400 | end |
|
396 | 401 | export |
|
397 | 402 | end |
|
398 | 403 | end |
@@ -1,160 +1,160 | |||
|
1 | 1 | <%= render :partial => 'action_menu' %> |
|
2 | 2 | |
|
3 | 3 | <h2><%= issue_heading(@issue) %></h2> |
|
4 | 4 | |
|
5 | 5 | <div class="<%= @issue.css_classes %> details"> |
|
6 | 6 | <% if @prev_issue_id || @next_issue_id %> |
|
7 | 7 | <div class="next-prev-links contextual"> |
|
8 | 8 | <%= link_to_if @prev_issue_id, |
|
9 | 9 | "\xc2\xab #{l(:label_previous)}", |
|
10 | 10 | (@prev_issue_id ? issue_path(@prev_issue_id) : nil), |
|
11 | 11 | :title => "##{@prev_issue_id}" %> | |
|
12 | 12 | <% if @issue_position && @issue_count %> |
|
13 | 13 | <span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> | |
|
14 | 14 | <% end %> |
|
15 | 15 | <%= link_to_if @next_issue_id, |
|
16 | 16 | "#{l(:label_next)} \xc2\xbb", |
|
17 | 17 | (@next_issue_id ? issue_path(@next_issue_id) : nil), |
|
18 | 18 | :title => "##{@next_issue_id}" %> |
|
19 | 19 | </div> |
|
20 | 20 | <% end %> |
|
21 | 21 | |
|
22 | 22 | <%= avatar(@issue.author, :size => "50") %> |
|
23 | 23 | |
|
24 | 24 | <div class="subject"> |
|
25 | 25 | <%= render_issue_subject_with_tree(@issue) %> |
|
26 | 26 | </div> |
|
27 | 27 | <p class="author"> |
|
28 | 28 | <%= authoring @issue.created_on, @issue.author %>. |
|
29 | 29 | <% if @issue.created_on != @issue.updated_on %> |
|
30 | 30 | <%= l(:label_updated_time, time_tag(@issue.updated_on)).html_safe %>. |
|
31 | 31 | <% end %> |
|
32 | 32 | </p> |
|
33 | 33 | |
|
34 | 34 | <table class="attributes"> |
|
35 | 35 | <%= issue_fields_rows do |rows| |
|
36 | 36 | rows.left l(:field_status), h(@issue.status.name), :class => 'status' |
|
37 | 37 | rows.left l(:field_priority), h(@issue.priority.name), :class => 'priority' |
|
38 | 38 | |
|
39 | 39 | unless @issue.disabled_core_fields.include?('assigned_to_id') |
|
40 | 40 | rows.left l(:field_assigned_to), avatar(@issue.assigned_to, :size => "14").to_s.html_safe + (@issue.assigned_to ? link_to_user(@issue.assigned_to) : "-"), :class => 'assigned-to' |
|
41 | 41 | end |
|
42 | 42 | unless @issue.disabled_core_fields.include?('category_id') |
|
43 | 43 | rows.left l(:field_category), h(@issue.category ? @issue.category.name : "-"), :class => 'category' |
|
44 | 44 | end |
|
45 | 45 | unless @issue.disabled_core_fields.include?('fixed_version_id') |
|
46 | 46 | rows.left l(:field_fixed_version), (@issue.fixed_version ? link_to_version(@issue.fixed_version) : "-"), :class => 'fixed-version' |
|
47 | 47 | end |
|
48 | 48 | |
|
49 | 49 | unless @issue.disabled_core_fields.include?('start_date') |
|
50 | 50 | rows.right l(:field_start_date), format_date(@issue.start_date), :class => 'start-date' |
|
51 | 51 | end |
|
52 | 52 | unless @issue.disabled_core_fields.include?('due_date') |
|
53 | 53 | rows.right l(:field_due_date), format_date(@issue.due_date), :class => 'due-date' |
|
54 | 54 | end |
|
55 | 55 | unless @issue.disabled_core_fields.include?('done_ratio') |
|
56 | 56 | rows.right l(:field_done_ratio), progress_bar(@issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%"), :class => 'progress' |
|
57 | 57 | end |
|
58 | 58 | unless @issue.disabled_core_fields.include?('estimated_hours') |
|
59 | 59 | unless @issue.estimated_hours.nil? |
|
60 | 60 | rows.right l(:field_estimated_hours), l_hours(@issue.estimated_hours), :class => 'estimated-hours' |
|
61 | 61 | end |
|
62 | 62 | end |
|
63 | 63 | if User.current.allowed_to?(:view_time_entries, @project) |
|
64 | 64 | rows.right l(:label_spent_time), (@issue.total_spent_hours > 0 ? (link_to l_hours(@issue.total_spent_hours), {:controller => 'timelog', :action => 'index', :project_id => @project, :issue_id => @issue}) : "-"), :class => 'spent-time' |
|
65 | 65 | end |
|
66 | 66 | end %> |
|
67 | 67 | <%= render_custom_fields_rows(@issue) %> |
|
68 | 68 | <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> |
|
69 | 69 | </table> |
|
70 | 70 | |
|
71 | 71 | <% if @issue.description? || @issue.attachments.any? -%> |
|
72 | 72 | <hr /> |
|
73 | 73 | <% if @issue.description? %> |
|
74 | 74 | <div class="contextual"> |
|
75 | 75 | <%= link_to l(:button_quote), |
|
76 | 76 | {:controller => 'journals', :action => 'new', :id => @issue}, |
|
77 | 77 | :remote => true, |
|
78 | 78 | :method => 'post', |
|
79 | 79 | :class => 'icon icon-comment' if authorize_for('issues', 'edit') %> |
|
80 | 80 | </div> |
|
81 | 81 | |
|
82 | 82 | <p><strong><%=l(:field_description)%></strong></p> |
|
83 | 83 | <div class="wiki"> |
|
84 | 84 | <%= textilizable @issue, :description, :attachments => @issue.attachments %> |
|
85 | 85 | </div> |
|
86 | 86 | <% end %> |
|
87 | 87 | <%= link_to_attachments @issue, :thumbnails => true %> |
|
88 | 88 | <% end -%> |
|
89 | 89 | |
|
90 | 90 | <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> |
|
91 | 91 | |
|
92 | 92 | <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> |
|
93 | 93 | <hr /> |
|
94 | 94 | <div id="issue_tree"> |
|
95 | 95 | <div class="contextual"> |
|
96 |
<%= link_to |
|
|
96 | <%= link_to_new_subtask(@issue) if User.current.allowed_to?(:manage_subtasks, @project) %> | |
|
97 | 97 | </div> |
|
98 | 98 | <p><strong><%=l(:label_subtask_plural)%></strong></p> |
|
99 | 99 | <%= render_descendants_tree(@issue) unless @issue.leaf? %> |
|
100 | 100 | </div> |
|
101 | 101 | <% end %> |
|
102 | 102 | |
|
103 | 103 | <% if @relations.present? || User.current.allowed_to?(:manage_issue_relations, @project) %> |
|
104 | 104 | <hr /> |
|
105 | 105 | <div id="relations"> |
|
106 | 106 | <%= render :partial => 'relations' %> |
|
107 | 107 | </div> |
|
108 | 108 | <% end %> |
|
109 | 109 | |
|
110 | 110 | </div> |
|
111 | 111 | |
|
112 | 112 | <% if @changesets.present? %> |
|
113 | 113 | <div id="issue-changesets"> |
|
114 | 114 | <h3><%=l(:label_associated_revisions)%></h3> |
|
115 | 115 | <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> |
|
116 | 116 | </div> |
|
117 | 117 | <% end %> |
|
118 | 118 | |
|
119 | 119 | <% if @journals.present? %> |
|
120 | 120 | <div id="history"> |
|
121 | 121 | <h3><%=l(:label_history)%></h3> |
|
122 | 122 | <%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> |
|
123 | 123 | </div> |
|
124 | 124 | <% end %> |
|
125 | 125 | |
|
126 | 126 | |
|
127 | 127 | <div style="clear: both;"></div> |
|
128 | 128 | <%= render :partial => 'action_menu' %> |
|
129 | 129 | |
|
130 | 130 | <div style="clear: both;"></div> |
|
131 | 131 | <% if authorize_for('issues', 'edit') %> |
|
132 | 132 | <div id="update" style="display:none;"> |
|
133 | 133 | <h3><%= l(:button_update) %></h3> |
|
134 | 134 | <%= render :partial => 'edit' %> |
|
135 | 135 | </div> |
|
136 | 136 | <% end %> |
|
137 | 137 | |
|
138 | 138 | <% other_formats_links do |f| %> |
|
139 | 139 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> |
|
140 | 140 | <%= f.link_to 'PDF' %> |
|
141 | 141 | <% end %> |
|
142 | 142 | |
|
143 | 143 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
144 | 144 | |
|
145 | 145 | <% content_for :sidebar do %> |
|
146 | 146 | <%= render :partial => 'issues/sidebar' %> |
|
147 | 147 | |
|
148 | 148 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || |
|
149 | 149 | (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> |
|
150 | 150 | <div id="watchers"> |
|
151 | 151 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> |
|
152 | 152 | </div> |
|
153 | 153 | <% end %> |
|
154 | 154 | <% end %> |
|
155 | 155 | |
|
156 | 156 | <% content_for :header_tags do %> |
|
157 | 157 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> |
|
158 | 158 | <% end %> |
|
159 | 159 | |
|
160 | 160 | <%= context_menu issues_context_menu_path %> |
General Comments 0
You need to be logged in to leave comments.
Login now