Remember the selected "Member of Role" and "Member of Group" options. #6467
Contributed by Yuki Kita git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4260 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ce99f3247f
commit
fef21d5aa2
|
@ -196,10 +196,10 @@ class Query < ActiveRecord::Base
|
|||
@available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => user_values } unless user_values.empty?
|
||||
@available_filters["author_id"] = { :type => :list, :order => 5, :values => user_values } unless user_values.empty?
|
||||
|
||||
group_values = Group.all.collect {|g| [g.name, g.id] }
|
||||
group_values = Group.all.collect {|g| [g.name, g.id.to_s] }
|
||||
@available_filters["member_of_group"] = { :type => :list_optional, :order => 6, :values => group_values } unless group_values.empty?
|
||||
|
||||
role_values = Role.givable.collect {|r| [r.name, r.id] }
|
||||
role_values = Role.givable.collect {|r| [r.name, r.id.to_s] }
|
||||
@available_filters["assigned_to_role"] = { :type => :list_optional, :order => 7, :values => role_values } unless role_values.empty?
|
||||
|
||||
if User.current.logged?
|
||||
|
|
|
@ -397,8 +397,8 @@ class QueryTest < ActiveSupport::TestCase
|
|||
group2 = Group.generate!.reload
|
||||
|
||||
expected_group_list = [
|
||||
[group1.name, group1.id],
|
||||
[group2.name, group2.id]
|
||||
[group1.name, group1.id.to_s],
|
||||
[group2.name, group2.id.to_s]
|
||||
]
|
||||
assert_equal expected_group_list.sort, @query.available_filters["member_of_group"][:values].sort
|
||||
end
|
||||
|
@ -415,14 +415,14 @@ class QueryTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
should "have a list of the Roles as values" do
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Manager',1])
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Developer',2])
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Reporter',3])
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Manager','1'])
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Developer','2'])
|
||||
assert @query.available_filters["assigned_to_role"][:values].include?(['Reporter','3'])
|
||||
end
|
||||
|
||||
should "not include the built in Roles as values" do
|
||||
assert ! @query.available_filters["assigned_to_role"][:values].include?(['Non member',4])
|
||||
assert ! @query.available_filters["assigned_to_role"][:values].include?(['Anonymous',5])
|
||||
assert ! @query.available_filters["assigned_to_role"][:values].include?(['Non member','4'])
|
||||
assert ! @query.available_filters["assigned_to_role"][:values].include?(['Anonymous','5'])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue