Merge pull request #1030 from netfighter/fix/on-the-fly-version-creation

Meets bug #2401: New target version cannot be created from work package view
pull/1031/head
sschu 11 years ago
commit 592e2b02c2
  1. 4
      app/controllers/versions_controller.rb
  2. 2
      app/helpers/work_packages_helper.rb
  3. 4
      spec/controllers/versions_controller_spec.rb

@ -94,8 +94,8 @@ class VersionsController < ApplicationController
end
format.js do
# IE doesn't support the replace_html rjs method for select box options
render(:update) {|page| page.replace "issue_fixed_version_id",
content_tag('select', '<option></option>'.html_safe + version_options_for_select(@project.shared_versions.open, @version).html_safe, :id => 'issue_fixed_version_id', :name => 'issue[fixed_version_id]')
render(:update) {|page| page.replace "work_package_fixed_version_id",
content_tag('select', '<option></option>'.html_safe + version_options_for_select(@project.shared_versions.open, @version).html_safe, :id => 'work_package_fixed_version_id', :name => 'work_package[fixed_version_id]')
}
end
end

@ -544,7 +544,7 @@ module WorkPackagesHelper
field += prompt_to_remote(icon_wrapper('icon icon-add',t(:label_version_new)),
l(:label_version_new),
'version[name]',
new_project_version_path(locals[:project]),
project_versions_path(locals[:project]),
:class => 'no-decoration-on-hover',
:title => l(:label_version_new)) if authorize_for('versions', 'new')

@ -160,9 +160,9 @@ describe VersionsController do
it "returns updated select box with new version" do
version = Version.find_by_name('test_add_version_from_issue_form')
pattern = "Element.replace\(\"issue_fixed_version_id\","
pattern = "Element.replace\(\"work_package_fixed_version_id\","
# select tag with valid html
pattern << " \"<select id=\\\"issue_fixed_version_id\\\" name=\\\"issue[fixed_version_id]\\\">"
pattern << " \"<select id=\\\"work_package_fixed_version_id\\\" name=\\\"work_package[fixed_version_id]\\\">"
# empty option tag with valid html
pattern << "<option></option>"
# selected option tag for the new version with valid html

Loading…
Cancel
Save