修复里程碑进度条数据显示错误的问题

This commit is contained in:
huang 2016-07-15 16:28:33 +08:00
parent 87e1e0c4b1
commit b2a8a0fed6
4 changed files with 68 additions and 68 deletions

View File

@ -1765,20 +1765,21 @@ module ApplicationHelper
link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)")
end
# 本次修改,修改为只显示关闭的所占%比
def progress_bar(pcts, options={})
pcts = [pcts, pcts] unless pcts.is_a?(Array)
pcts = [pcts] unless pcts.is_a?(Array)
pcts = pcts.collect(&:round)
pcts[1] = pcts[1] - pcts[0]
pcts << (100 - pcts[1] - pcts[0])
# pcts[1] = pcts[1] + pcts[0]
pcts << (100 - pcts[0])
width = options[:width] || '100px;'
legend = options[:legend] || ''
content_tag('table',
content_tag('tr',
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : ''.html_safe) +
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : ''.html_safe) +
(pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : ''.html_safe)
), :class => 'progress', :style => "width: #{width};").html_safe +
content_tag('p', legend, :class => 'percent').html_safe
(pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed', :title => "已关闭:#{pcts[0]}%") : ''.html_safe) +
# (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done', :title => "开发中:#{pcts[1]}%") : ''.html_safe) +
(pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'todo', :title => "未完成:#{pcts[1]}%") : ''.html_safe), :style => "width: #{width}"
), :class => 'progress').html_safe
# + content_tag('p', legend, :class => 'percent').html_safe
end
def checked_image(checked=true)

View File

@ -1,7 +1,7 @@
<!--Modified by young-->
<% if version.issues_count > 0 %>
<p class="f14 mb5">&#187;<%= l(:label_versions_progress)%></p>
<%= progress_bar([version.closed_percent, version.completed_percent], :width => '82%', :legend => ('%0.0f%' % version.completed_percent)) %>
<%= progress_bar([version.closed_percent], :width => '648px;', :legend => ('%0.0f%' % version.completed_percent)) %>
<p class="progress-info">
<%= link_to(l(:label_x_issues, :count => version.issues_count),
project_issues_path(version.project, :status_id => '*', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue",) %>

View File

@ -2,69 +2,68 @@
<h2 class="project_h2"><%= l(:label_roadmap) %></h2>
</div>
<div class="roadmap">
<fieldset id="filters" class="collapsible collapsed" >
<legend><%= l(:label_version_display_settings)%></legend>
<%= form_tag({}, :method => :get) do %>
<% @trackers.each do |tracker| %>
<label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
<%=h tracker.name %></label>
<% end %>
<label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
<% if @project.descendants.active.any? %>
<%= hidden_field_tag 'with_subprojects', 0 %>
<label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
<% end %>
<%= submit_tag l(:button_apply), :class => 'sub_btn ml10', :name => nil %>
<%= link_to l(:label_version_new), new_project_version_path(@project), :class => 'green_u_btn fr' if User.current.allowed_to?(:manage_versions, @project) %>
<% end %>
</fieldset>
<fieldset id="filters" class="collapsible collapsed" >
<legend><%= l(:label_version_display_settings)%></legend>
<%= form_tag({}, :method => :get) do %>
<% @trackers.each do |tracker| %>
<label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s), :id => nil %>
<%=h tracker.name %></label>
<% end %>
<label for="completed"><%= check_box_tag "completed", 1, params[:completed] %> <%= l(:label_show_completed_versions) %></label>
<% if @project.descendants.active.any? %>
<%= hidden_field_tag 'with_subprojects', 0 %>
<label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
<% end %>
<%= submit_tag l(:button_apply), :class => 'sub_btn ml10', :name => nil %>
<%= link_to l(:label_version_new), new_project_version_path(@project), :class => 'green_u_btn fr' if User.current.allowed_to?(:manage_versions, @project) %>
<% end %>
</fieldset>
<% if @versions.empty? %>
<% if @versions.empty? %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% else %>
<% else %>
<% @versions.each do |version| %>
<div class="roadmap_box">
<p><a href="javascript:void(0)" class=" f16 fb c_dblue " target="_blank">
<%= link_to_version_show version, :name => version_anchor(version) %>
<% if version.completed? %>
<span style="color: #E8770D;float:right;"><%= format_date(version.effective_date) %></span>
<% elsif version.effective_date %>
<span style="color: #E8770D;float:right;"><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</span>
<% end %>
</a>
</p>
<div class="roadmap_pro mb10">
<%= render :partial => 'versions/overview', :locals => {:version => version} %>
<%= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
<div class="roadmap_box">
<p><a href="javascript:void(0)" class=" f16 fb c_dblue " target="_blank">
<%= link_to_version_show version, :name => version_anchor(version) %>
<% if version.completed? %>
<span style="color: #E8770D;float:right;"><%= format_date(version.effective_date) %></span>
<% elsif version.effective_date %>
<span style="color: #E8770D;float:right;"><strong><%= due_date_distance_in_words(version.effective_date) %></strong> (<%= format_date(version.effective_date) %>)</span>
<% end %>
</a>
</p>
<div class="roadmap_pro mb10">
<%= render :partial => 'versions/overview', :locals => {:version => version} %>
<%#= render(:partial => "wiki/content", :locals => {:content => version.wiki_page.content}) if version.wiki_page %>
</div><!--roadmap_pro end-->
<% if (issues = @issues_by_version[version]) && issues.size > 0 %>
<div class="roadmap_list">
<%= form_tag({}) do -%>
<p class="f14 mb5">&#187;<%= l(:label_related_issues) %></p>
<ul class="roadmap_list_ul">
<% issues.each do |issue| -%>
<li style="overflow:hidden">
<%= link_to_issue_version(issue, :project => (@project != issue.project)) %>
</li>
<% end -%>
</ul>
<% end %>
</div>
<% end %><!--roadmap_list end-->
<div class="roadmap_list">
<p class="f14 mb5">&#187;<%= l(:label_versions_description)%></p>
<p><%=h version.description %></p>
</div><!--roadmap_list end-->
</div><!--roadmap_box end-->
<% end %>
</div><!--roadmap_pro end-->
<% if (issues = @issues_by_version[version]) && issues.size > 0 %>
<div class="roadmap_list">
<%= form_tag({}) do -%>
<p class="f14 mb5">&#187;<%= l(:label_related_issues) %></p>
<ul class="roadmap_list_ul">
<% issues.each do |issue| -%>
<li style="overflow:hidden">
<%= link_to_issue_version(issue, :project => (@project != issue.project)) %>
</li>
<% end -%>
</ul>
<% end %>
</div>
<% end %><!--roadmap_list end-->
<div class="roadmap_list">
<p class="f14 mb5">&#187;<%= l(:label_versions_description)%></p>
<p><%=h version.description %></p>
</div><!--roadmap_list end-->
</div><!--roadmap_box end-->
<% end %>
<ul class="wlist" >
<%= pagination_links_full @versions_pages%>
</ul>
<div class="cl"></div>
<ul class="wlist" >
<%= pagination_links_full @versions_pages%>
</ul>
<div class="cl"></div>
<% end %>
</div><!--roadmap end-->

View File

@ -605,8 +605,8 @@ img.ui-datepicker-trigger {
/* 里程碑 */
.roadmap_box{ background:#f8f8f8; width:648px; padding:10px; margin-top:5px; border:1px solid #ddd; color:#555;}
.progress{ width:520px; height:20px; margin-bottom:5px; background:#e9e9e9;}
.closed{ background:#bae0ba; display:block;height:20px; float:left;}
.progress{ width:648px; height:20px; margin-bottom:5px; background:#e9e9e9;}
.closed{ background:#bae0ba; height:20px;}
.done{ background:#d3edd3; display:block;height:20px;float:left;}
.roadmap_box{ margin-bottom:10px;}
.roadmap_list_ul{border:1px solid #ddd; border-bottom:none; margin-bottom:10px;}