修复:里程碑关闭,编辑issue,里程碑被清空的情况

This commit is contained in:
daiao 2016-11-22 16:51:16 +08:00
parent 196d3b31a1
commit 85f9f636a2
3 changed files with 9 additions and 7 deletions

View File

@ -268,13 +268,14 @@ module ProjectsHelper
grouped = Hash.new {|h,k| h[k] = []} grouped = Hash.new {|h,k| h[k] = []}
grouped[project_name] << ["请选择里程碑", 0] grouped[project_name] << ["请选择里程碑", 0]
=begin
unless selected.nil? unless selected.nil?
if (params[:action] == "show" ) && Version.find(selected.id).status == "closed" if (params[:action] == "show" ) && Version.find(selected.id).status == "closed"
version_name = Version.find(selected.id).name version_name = Version.find(selected.id).name
grouped[project_name] << [version_name, selected.id] grouped[project_name] << [version_name, selected.id]
end end
end end
=end
versions.each do |version| versions.each do |version|
grouped[version.project.name] << [version.name, version.id] grouped[version.project.name] << [version.name, version.id]

View File

@ -854,7 +854,8 @@ class Issue < ActiveRecord::Base
return @assignable_versions if @assignable_versions return @assignable_versions if @assignable_versions
# versions = project.shared_versions.open.all # versions = project.shared_versions.open.all
versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc") # versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc")
versions = Version.where(:project_id => project.id).order("created_on desc")
if fixed_version if fixed_version
if fixed_version_id_changed? if fixed_version_id_changed?
# nothing to do # nothing to do

View File

@ -98,8 +98,8 @@
<li class=" clear" style="border:1px solid #c8c8c8;"> <li class=" clear" style="border:1px solid #c8c8c8;">
<% if @issue.safe_attribute? 'start_date' %> <% if @issue.safe_attribute? 'start_date' %>
<%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, <%= f.text_field :start_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('start_date'), :onchange=>"issue_start_date_change();", :required => @issue.required_attribute?('start_date'), :onchange => "issue_start_date_change();",
:class=>"fl calendar_input", :style=>"width:170px;" %> :class => "fl calendar_input", :style => "width:170px;" %>
<%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %> <%= calendar_for('issue_start_date', 'start_date') if @issue.leaf? %>
<% end %> <% end %>
</li> </li>
@ -110,8 +110,8 @@
<label class="label02" ></label> <label class="label02" ></label>
<% if @issue.safe_attribute? 'due_date' %> <% if @issue.safe_attribute? 'due_date' %>
<%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true, <%= f.text_field :due_date, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('due_date'), :onchange=>"issue_end_date_change();", :required => @issue.required_attribute?('due_date'), :onchange => "issue_end_date_change();",
:class=>"fl calendar_input",:style=>"width: 170px;", :placeholder=> "请选择结束日期" %> :class => "fl calendar_input",:style => "width: 170px;", :placeholder => "请选择结束日期" %>
<%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %> <%= calendar_for('issue_due_date', 'start_date') if @issue.leaf? %>
<% end %> <% end %>
</li> </li>
@ -121,7 +121,7 @@
<li class=" clear"> <li class=" clear">
<% if @issue.safe_attribute? 'estimated_hours' %> <% if @issue.safe_attribute? 'estimated_hours' %>
<%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true, <%= f.text_field :estimated_hours, :size => 22, :disabled => !@issue.leaf?, :no_label => true,
:required => @issue.required_attribute?('estimated_hours'), :placeholder=> "请填写预计工时" %> :required => @issue.required_attribute?('estimated_hours'), :placeholder => "请填写预计工时" %>
<% end %> <% end %>
</li> </li>
<li class=" clear"><%= l(:field_estimated_hours) %></li> <li class=" clear"><%= l(:field_estimated_hours) %></li>