Defect #33521 » 0002-Change-custom-field-value-update-path-on-the-context.patch
| app/helpers/context_menus_helper.rb | ||
|---|---|---|
|
def bulk_update_custom_field_context_menu_link(field, text, value)
|
||
|
context_menu_link(
|
||
|
h(text),
|
||
|
bulk_update_issues_path(:ids => @issue_ids,
|
||
|
_bulk_update_issues_path(@issue,
|
||
|
:ids => @issue_ids,
|
||
|
:issue => {'custom_field_values' => {field.id => value}},
|
||
|
:back_url => @back),
|
||
|
:method => :post,
|
||
|
:method => :patch,
|
||
|
:selected => (@issue && @issue.custom_field_value(field) == value)
|
||
|
)
|
||
|
end
|
||
| test/functional/context_menus_controller_test.rb | ||
|---|---|---|
|
assert_select 'a[href="#"]', :text => 'List'
|
||
|
assert_select 'ul' do
|
||
|
assert_select 'a', 3
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
def test_context_menu_multiple_issues_should_include_list_custom_fields
|
||
|
field = IssueCustomField.create!(:name => 'List', :field_format => 'list',
|
||
|
:possible_values => ['Foo', 'Bar'], :is_for_all => true, :tracker_ids => [1, 2, 3])
|
||
|
@request.session[:user_id] = 2
|
||
|
get(
|
||
|
:issues,
|
||
|
:params => {
|
||
|
:ids => [1, 2]
|
||
|
}
|
||
|
)
|
||
|
assert_select "li.cf_#{field.id}" do
|
||
|
assert_select 'a[href="#"]', :text => 'List'
|
||
|
assert_select 'ul' do
|
||
|
assert_select 'a', 3
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=Foo", :text => 'Foo'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&ids%5B%5D=2&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'a[href="#"]', :text => 'Bool'
|
||
|
assert_select 'ul' do
|
||
|
assert_select 'a', 3
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=0", :text => 'No'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=1", :text => 'Yes'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'a[href="#"]', :text => 'User'
|
||
|
assert_select 'ul' do
|
||
|
assert_select 'a', Project.find(1).members.count + 2 # users + 'none' + 'me'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=2", :text => 'John Smith'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'a[href="#"]', :text => 'Version'
|
||
|
assert_select 'ul' do
|
||
|
assert_select 'a', Project.find(1).shared_versions.count + 1
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
|
||
|
assert_select 'a[href=?]', "/issues/bulk_update?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=3", :text => '2.0'
|
||
|
assert_select 'a[href=?]', "/issues/1?ids%5B%5D=1&issue%5Bcustom_field_values%5D%5B#{field.id}%5D=__none__", :text => 'none'
|
||
|
end
|
||
|
end
|
||
|
end
|
||