Project

General

Profile

Feature #38459 » 38459.patch

Go MAEDA, 2023-04-18 13:34

View differences:

app/controllers/search_controller.rb
nil
when 'my_projects'
User.current.projects
when 'bookmarks'
Project.where(id: User.current.bookmarked_project_ids)
when 'subprojects'
@project ? (@project.self_and_descendants.to_a) : nil
else
app/helpers/search_helper.rb
def project_select_tag
options = [[l(:label_project_all), 'all']]
options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty?
options << [l(:label_my_bookmarks), 'bookmarks'] unless User.current.bookmarked_project_ids.empty?
options << [l(:label_and_its_subprojects, @project.name), 'subprojects'] unless @project.nil? || @project.descendants.active.empty?
options << [@project.name, ''] unless @project.nil?
label_tag("scope", l(:description_project_scope), :class => "hidden-for-sighted") +
test/functional/search_controller_test.rb
end
end
def test_search_my_bookmarks
@request.session[:user_id] = 1
get :index, :params => {:q => 'project', :scope => 'bookmarks', :all_words => ''}
assert_response :success
assert_select '#search-results' do
assert_select 'dt.issue', :count => 1
assert_select 'dt.issue', :text => /Bug #6/
assert_select 'dt.changeset', :count => 1
assert_select 'dt.changeset', :text => /Revision 4/
end
end
def test_search_project_and_subprojects
get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'subprojects', :all_words => ''}
assert_response :success
(3-3/3)