@@ -313,6 +313,17 module ApplicationHelper | |||||
313 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") |
|
313 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") | |
314 | end |
|
314 | end | |
315 |
|
315 | |||
|
316 | def progress_bar(pct, options={}) | |||
|
317 | width = options[:width] || '100px;' | |||
|
318 | legend = options[:legend] || '' | |||
|
319 | content_tag('table', | |||
|
320 | content_tag('tr', | |||
|
321 | (pct > 0 ? content_tag('td', '', :width => "#{pct.floor}%;", :class => 'closed') : '') + | |||
|
322 | (pct < 100 ? content_tag('td', '', :width => "#{100-pct.floor}%;", :class => 'open') : '') | |||
|
323 | ), :class => 'progress', :style => "width: #{width};") + | |||
|
324 | content_tag('p', legend, :class => 'pourcent') | |||
|
325 | end | |||
|
326 | ||||
316 | def context_menu_link(name, url, options={}) |
|
327 | def context_menu_link(name, url, options={}) | |
317 | options[:class] ||= '' |
|
328 | options[:class] ||= '' | |
318 | if options.delete(:selected) |
|
329 | if options.delete(:selected) |
@@ -35,11 +35,16 module QueriesHelper | |||||
35 | format_date(value) |
|
35 | format_date(value) | |
36 | elsif value.is_a?(Time) |
|
36 | elsif value.is_a?(Time) | |
37 | format_time(value) |
|
37 | format_time(value) | |
38 | elsif column.name == :subject |
|
38 | else | |
|
39 | case column.name | |||
|
40 | when :subject | |||
39 | ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') + |
|
41 | ((@project.nil? || @project != issue.project) ? "#{issue.project.name} - " : '') + | |
40 | link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) |
|
42 | link_to(h(value), :controller => 'issues', :action => 'show', :id => issue) | |
41 | else |
|
43 | when :done_ratio | |
42 | h(value) |
|
44 | progress_bar(value, :width => '80px') | |
|
45 | else | |||
|
46 | h(value) | |||
|
47 | end | |||
43 | end |
|
48 | end | |
44 | end |
|
49 | end | |
45 | end |
|
50 | end |
@@ -39,6 +39,16 class Version < ActiveRecord::Base | |||||
39 | effective_date && (effective_date <= Date.today) && (open_issues_count == 0) |
|
39 | effective_date && (effective_date <= Date.today) && (open_issues_count == 0) | |
40 | end |
|
40 | end | |
41 |
|
41 | |||
|
42 | def completed_pourcent | |||
|
43 | if fixed_issues.count == 0 | |||
|
44 | 0 | |||
|
45 | elsif open_issues_count == 0 | |||
|
46 | 100 | |||
|
47 | else | |||
|
48 | (closed_issues_count * 100 + Issue.sum('done_ratio', :include => 'status', :conditions => ["fixed_version_id = ? AND is_closed = ?", id, false]).to_f) / fixed_issues.count | |||
|
49 | end | |||
|
50 | end | |||
|
51 | ||||
42 | # Returns true if the version is overdue: due date reached and some open issues |
|
52 | # Returns true if the version is overdue: due date reached and some open issues | |
43 | def overdue? |
|
53 | def overdue? | |
44 | effective_date && (effective_date < Date.today) && (open_issues_count > 0) |
|
54 | effective_date && (effective_date < Date.today) && (open_issues_count > 0) |
@@ -28,7 +28,7 | |||||
28 | </tr> |
|
28 | </tr> | |
29 | <tr> |
|
29 | <tr> | |
30 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> |
|
30 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> | |
31 |
<td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> |
|
31 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td> | |
32 | </tr> |
|
32 | </tr> | |
33 | <tr> |
|
33 | <tr> | |
34 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
34 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> |
@@ -14,44 +14,39 | |||||
14 | <p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p> |
|
14 | <p><strong><%=l(:label_roadmap_due_in)%> <%= distance_of_time_in_words Time.now, version.effective_date %> (<%= format_date(version.effective_date) %>)</strong></p> | |
15 | <% end %> |
|
15 | <% end %> | |
16 | <p><%=h version.description %></p> |
|
16 | <p><%=h version.description %></p> | |
17 | <% issues = version.fixed_issues.find(:all, |
|
17 | ||
18 | :include => [:status, :tracker], |
|
18 | <% if version.fixed_issues.count > 0 %> | |
19 | :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"], |
|
19 | <%= progress_bar(version.completed_pourcent, :width => '40em', :legend => ('%0.0f%' % version.completed_pourcent)) %> | |
20 | :order => "#{Tracker.table_name}.position") unless @selected_tracker_ids.empty? |
|
20 | <p class="progress-info"> | |
21 | issues ||= [] |
|
21 | <%= link_to(version.closed_issues_count, :controller => 'issues', :action => 'index', :project_id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> | |
22 |
|
22 | <%= lwr(:label_closed_issues, version.closed_issues_count) %> | ||
23 | total = issues.size |
|
23 | (<%= '%0.0f' % (version.closed_issues_count.to_f / version.fixed_issues.count * 100) %>%) | |
24 | complete = issues.inject(0) {|c,i| i.status.is_closed? ? c + 1 : c } |
|
24 |   | |
25 | percentComplete = total == 0 ? 100 : (100.0 / total * complete).floor |
|
25 | <%= link_to(version.open_issues_count, :controller => 'issues', :action => 'index', :project_id => @project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> | |
26 | percentIncomplete = 100 - percentComplete |
|
26 | <%= lwr(:label_open_issues, version.open_issues_count)%> | |
27 | %> |
|
27 | (<%= '%0.0f' % (version.open_issues_count.to_f / version.fixed_issues.count * 100) %>%) | |
28 | <table class="progress"> |
|
28 | </p> | |
29 | <tr> |
|
29 | <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %> | |
30 | <% if percentComplete > 0 %> |
|
30 | <% issues = version.fixed_issues.find(:all, | |
31 | <td class="closed" style="width: <%= percentComplete %>%"></td> |
|
31 | :include => [:status, :tracker], | |
32 | <% end; if percentIncomplete > 0 %> |
|
32 | :conditions => ["tracker_id in (#{@selected_tracker_ids.join(',')})"], | |
33 | <td class="open" style="width: <%= percentIncomplete %>%"></td> |
|
33 | :order => "#{Tracker.table_name}.position") unless @selected_tracker_ids.empty? | |
34 | <% end %> |
|
34 | issues ||= [] | |
35 |
|
|
35 | %> | |
36 | </table> |
|
36 | <ul> | |
37 | <em><%= link_to(complete, :controller => 'issues', :action => 'index', :project_id => @project, :status_id => 'c', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_closed_issues, complete) %> (<%= percentComplete %>%)   |
|
37 | <% if issues.size > 0 %> | |
38 | <%= link_to((total - complete), :controller => 'issues', :action => 'index', :project_id => @project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1) %> <%= lwr(:label_open_issues, total - complete)%> (<%= percentIncomplete %>%)</em> |
|
38 | <% issues.each do |issue| %> | |
39 | <br /> |
|
39 | <li> | |
40 | <br /> |
|
40 | <%= link = link_to_issue(issue) | |
41 | <%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %> |
|
41 | issue.status.is_closed? ? content_tag("del", link) : link %>: <%=h issue.subject %> | |
42 | <ul> |
|
42 | <%= content_tag "em", "(#{l(:label_closed_issues)})" if issue.status.is_closed? %> | |
43 | <% if total == 0 %> |
|
43 | </li> | |
44 | <li><%=l(:label_roadmap_no_issues)%></li> |
|
44 | <% end %> | |
45 |
<% e |
|
45 | <% end %> | |
46 | <% issues.each do |issue| %> |
|
46 | </ul> | |
47 | <li> |
|
47 | <% else %> | |
48 | <%= link = link_to_issue(issue) |
|
48 | <p><em><%= l(:label_roadmap_no_issues) %></em></p> | |
49 | issue.status.is_closed? ? content_tag("del", link) : link %>: <%=h issue.subject %> |
|
49 | <% end %> | |
50 | <%= content_tag "em", "(#{l(:label_closed_issues)})" if issue.status.is_closed? %> |
|
|||
51 | </li> |
|
|||
52 | <% end %> |
|
|||
53 | <% end %> |
|
|||
54 | </ul> |
|
|||
55 | <% end %> |
|
50 | <% end %> | |
56 |
|
51 | |||
57 | <% content_for :sidebar do %> |
|
52 | <% content_for :sidebar do %> |
@@ -75,6 +75,7 table.list td.checkbox { width: 15px; padding: 0px;} | |||||
75 | tr.issue { text-align: center; white-space: nowrap; } |
|
75 | tr.issue { text-align: center; white-space: nowrap; } | |
76 | tr.issue td.subject, tr.issue td.category { white-space: normal; } |
|
76 | tr.issue td.subject, tr.issue td.category { white-space: normal; } | |
77 | tr.issue td.subject { text-align: left; } |
|
77 | tr.issue td.subject { text-align: left; } | |
|
78 | tr.issue td.done_ratio table.progress { margin-left:auto; margin-right: auto;} | |||
78 |
|
79 | |||
79 | table.list tbody tr:hover { background-color:#ffffdd; } |
|
80 | table.list tbody tr:hover { background-color:#ffffdd; } | |
80 | table td {padding:2px;} |
|
81 | table td {padding:2px;} | |
@@ -242,19 +243,21 color:#505050; | |||||
242 | } |
|
243 | } | |
243 |
|
244 | |||
244 | /***** Progress bar *****/ |
|
245 | /***** Progress bar *****/ | |
245 | .progress { |
|
246 | table.progress { | |
246 | border: 1px solid #D7D7D7; |
|
247 | border: 1px solid #D7D7D7; | |
247 | border-collapse: collapse; |
|
248 | border-collapse: collapse; | |
248 | border-spacing: 0pt; |
|
249 | border-spacing: 0pt; | |
249 | empty-cells: show; |
|
250 | empty-cells: show; | |
250 | padding: 3px; |
|
|||
251 | width: 40em; |
|
|||
252 | text-align: center; |
|
251 | text-align: center; | |
|
252 | float:left; | |||
|
253 | margin: 1px 6px 1px 0px; | |||
253 | } |
|
254 | } | |
254 |
|
255 | |||
255 |
.progress td { height: |
|
256 | table.progress td { height: 0.9em; } | |
256 | .progress .closed { background: #BAE0BA none repeat scroll 0%; } |
|
257 | table.progress td.closed { background: #BAE0BA none repeat scroll 0%; } | |
257 | .progress .open { background: #FFF none repeat scroll 0%; } |
|
258 | table.progress td.open { background: #FFF none repeat scroll 0%; } | |
|
259 | p.pourcent {font-size: 80%;} | |||
|
260 | p.progress-info {clear: left; font-style: italic; font-size: 80%;} | |||
258 |
|
261 | |||
259 | /***** Tabs *****/ |
|
262 | /***** Tabs *****/ | |
260 | #content .tabs{height: 2.6em;} |
|
263 | #content .tabs{height: 2.6em;} |
General Comments 0
You need to be logged in to leave comments.
Login now