mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 19:47:14 +00:00
"For all projects" checkbox should be disabled when editing an existing query in which the checkbox is already checked (#42458).
Patch by [Agileware] nusohiro (user:nusohiro). git-svn-id: https://svn.redmine.org/redmine/trunk@23573 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
c866aa74d8
commit
e0e0be4928
@ -32,7 +32,7 @@
|
||||
|
||||
<% unless @query.is_a?(ProjectQuery) %>
|
||||
<p><label for="query_is_for_all"><%=l(:field_is_for_all)%></label>
|
||||
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :class => (User.current.admin? ? '' : 'disable-unless-private') %></p>
|
||||
<%= check_box_tag 'query_is_for_all', 1, @query.project.nil?, :disabled => (!@query.new_record? && @query.project.nil?), :class => (User.current.admin? ? '' : 'disable-unless-private') %></p>
|
||||
<% end %>
|
||||
|
||||
<% unless params[:calendar] %>
|
||||
|
||||
@ -1030,4 +1030,44 @@ class QueriesControllerTest < Redmine::ControllerTest
|
||||
assert_include ["Development", "10"], json
|
||||
assert_include ["Inactive Activity", "14"], json
|
||||
end
|
||||
|
||||
def test_new_query_is_for_all_checkbox_not_disabled
|
||||
@request.session[:user_id] = 1
|
||||
get :new
|
||||
assert_response :success
|
||||
# Verify that the "For all projects" checkbox is not disabled when creating a new query
|
||||
assert_select 'input[name=query_is_for_all][type=checkbox][checked]:not([disabled])'
|
||||
end
|
||||
|
||||
def test_new_project_query_is_for_all_checkbox_not_disabled
|
||||
@request.session[:user_id] = 1
|
||||
get(:new, :params => {:project_id => 1})
|
||||
assert_response :success
|
||||
# Verify that the checkbox is not disabled when creating a new query within a project
|
||||
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])'
|
||||
end
|
||||
|
||||
def test_edit_global_query_is_for_all_checkbox_disabled
|
||||
@request.session[:user_id] = 1
|
||||
# Create a global query (project_id = nil)
|
||||
query = IssueQuery.create!(:name => 'test_global_query', :user_id => 1, :project_id => nil)
|
||||
|
||||
get(:edit, :params => {:id => query.id})
|
||||
assert_response :success
|
||||
|
||||
# Verify that the "For all projects" checkbox is disabled when editing an existing global query
|
||||
assert_select 'input[name=query_is_for_all][type=checkbox][checked][disabled]'
|
||||
end
|
||||
|
||||
def test_edit_project_query_is_for_all_checkbox_not_disabled
|
||||
@request.session[:user_id] = 1
|
||||
# Create a project-specific query
|
||||
query = IssueQuery.create!(:name => 'test_project_query', :user_id => 1, :project_id => 1)
|
||||
|
||||
get(:edit, :params => {:id => query.id})
|
||||
assert_response :success
|
||||
|
||||
# Verify that the checkbox is not disabled when editing a project-specific query
|
||||
assert_select 'input[name=query_is_for_all][type=checkbox]:not([checked]):not([disabled])'
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user