Feature #38459 » 38459.patch
| app/controllers/search_controller.rb | ||
|---|---|---|
| 49 | 49 |
nil |
| 50 | 50 |
when 'my_projects' |
| 51 | 51 |
User.current.projects |
| 52 |
when 'bookmarks' |
|
| 53 |
Project.where(id: User.current.bookmarked_project_ids) |
|
| 52 | 54 |
when 'subprojects' |
| 53 | 55 |
@project ? (@project.self_and_descendants.to_a) : nil |
| 54 | 56 |
else |
| app/helpers/search_helper.rb | ||
|---|---|---|
| 47 | 47 |
def project_select_tag |
| 48 | 48 |
options = [[l(:label_project_all), 'all']] |
| 49 | 49 |
options << [l(:label_my_projects), 'my_projects'] unless User.current.memberships.empty? |
| 50 |
options << [l(:label_my_bookmarks), 'bookmarks'] unless User.current.bookmarked_project_ids.empty? |
|
| 50 | 51 |
options << [l(:label_and_its_subprojects, @project.name), 'subprojects'] unless @project.nil? || @project.descendants.active.empty? |
| 51 | 52 |
options << [@project.name, ''] unless @project.nil? |
| 52 | 53 |
label_tag("scope", l(:description_project_scope), :class => "hidden-for-sighted") +
|
| test/functional/search_controller_test.rb | ||
|---|---|---|
| 171 | 171 |
end |
| 172 | 172 |
end |
| 173 | 173 | |
| 174 |
def test_search_my_bookmarks |
|
| 175 |
@request.session[:user_id] = 1 |
|
| 176 |
get :index, :params => {:q => 'project', :scope => 'bookmarks', :all_words => ''}
|
|
| 177 |
assert_response :success |
|
| 178 | ||
| 179 |
assert_select '#search-results' do |
|
| 180 |
assert_select 'dt.issue', :count => 1 |
|
| 181 |
assert_select 'dt.issue', :text => /Bug #6/ |
|
| 182 |
assert_select 'dt.changeset', :count => 1 |
|
| 183 |
assert_select 'dt.changeset', :text => /Revision 4/ |
|
| 184 |
end |
|
| 185 |
end |
|
| 186 | ||
| 174 | 187 |
def test_search_project_and_subprojects |
| 175 | 188 |
get :index, :params => {:id => 1, :q => 'recipe subproject', :scope => 'subprojects', :all_words => ''}
|
| 176 | 189 |
assert_response :success |
- « Previous
- 1
- 2
- 3
- Next »