Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 1693) +++ app/models/issue.rb (working copy) @@ -254,4 +254,9 @@ def to_s "#{tracker} ##{id}: #{subject}" end + + def active_versions + project.active_versions(:for => self) + end + end Index: app/models/project.rb =================================================================== --- app/models/project.rb (revision 1693) +++ app/models/project.rb (working copy) @@ -239,6 +239,14 @@ end end + def active_versions(options = {}) + issue = options[:for] if options[:for].is_a?(Issue) + versions.select do |v| + !v.completed? || issue && issue.fixed_version && + v.id == issue.fixed_version.id + end + end + protected def validate errors.add(parent_id, " must be a root project") if parent and parent.parent Index: app/views/issues/_form.rhtml =================================================================== --- app/views/issues/_form.rhtml (revision 1693) +++ app/views/issues/_form.rhtml (working copy) @@ -30,7 +30,7 @@ {:controller => 'projects', :action => 'add_issue_category', :id => @project}, :class => 'small', :tabindex => 199) if authorize_for('projects', 'add_issue_category') %>
<%= content_tag('p', f.select(:fixed_version_id, - (@project.versions.sort.collect {|v| [v.name, v.id]}), + (@issue.active_versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true })) unless @project.versions.empty? %> Index: app/views/issues/_form_update.rhtml =================================================================== --- app/views/issues/_form_update.rhtml (revision 1693) +++ app/views/issues/_form_update.rhtml (working copy) @@ -5,6 +5,6 @@<%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }) %>
<%= content_tag('p', f.select(:fixed_version_id, - (@project.versions.sort.collect {|v| [v.name, v.id]}), + (@issue.active_versions.sort.collect {|v| [v.name, v.id]}), { :include_blank => true })) unless @project.versions.empty? %>Index: app/views/issues/context_menu.rhtml =================================================================== --- app/views/issues/context_menu.rhtml (revision 1693) +++ app/views/issues/context_menu.rhtml (working copy) @@ -20,11 +20,11 @@ <% end -%> - <% unless @project.versions.empty? -%> + <% unless @issue.active_versions.empty? -%>