Patch #24313 » 05_use_regular_icons_in_search_results.patch
| app/views/search/index.html.erb | ||
|---|---|---|
|
<h3><%= l(:label_result_plural) %> (<%= @result_count %>)</h3>
|
||
|
<dl id="search-results">
|
||
|
<% @results.each do |e| %>
|
||
|
<dt class="<%= e.event_type %>">
|
||
|
<dt class="icon icon-<%= e.event_type.parameterize %>">
|
||
|
<%= content_tag('span', e.project, :class => 'project') unless @project == e.project %>
|
||
|
<%= link_to(highlight_tokens(e.event_title.truncate(255), @tokens), e.event_url) %>
|
||
|
</dt>
|
||
| public/stylesheets/application.css | ||
|---|---|---|
|
div#activity dl, #search-results { margin-left: 2em; }
|
||
|
div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
|
||
|
#search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
|
||
|
div#activity dt.me .time { border-bottom: 1px solid #999; }
|
||
|
div#activity dt .time { color: #777; font-size: 80%; }
|
||
|
div#activity dd .description, #search-results dd .description { font-style: italic; }
|
||
| ... | ... | |
|
div#search-results-counts ul { margin-top: 0.5em; }
|
||
|
div#search-results-counts li { list-style-type:none; float: left; margin-left: 1em; }
|
||
|
#search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); }
|
||
|
div#roadmap .related-issues { margin-bottom: 1em; }
|
||
|
div#roadmap .related-issues td.checkbox { display: none; }
|
||
|
div#roadmap .wiki h1:first-child { display: none; }
|
||
| test/functional/search_controller_test.rb | ||
|---|---|---|
|
def test_search_for_projects
|
||
|
get :index, :params => {:q => "cook"}
|
||
|
assert_response :success
|
||
|
assert_select '#search-results dt.project a', :text => /eCookbook/
|
||
|
assert_select '#search-results dt.icon-project a', :text => /eCookbook/
|
||
|
end
|
||
|
def test_search_on_archived_project_should_return_404
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt.issue a', :text => /Bug #5/
|
||
|
assert_select 'dt.changeset a', :text => /Revision 1/
|
||
|
assert_select 'dt.icon-issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt.icon-issue a', :text => /Bug #5/
|
||
|
assert_select 'dt.icon-changeset a', :text => /Revision 1/
|
||
|
assert_select 'dt.issue a', :text => /Add ingredients categories/
|
||
|
assert_select 'dt.icon-issue a', :text => /Add ingredients categories/
|
||
|
assert_select 'dd', :text => /should be classified by categories/
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'input[name=titles_only]:not([checked])'
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /Bug #5/
|
||
|
assert_select 'dt.issue.closed a', :text => /Bug #8 \(Closed\)/
|
||
|
assert_select 'dt.icon-issue a', :text => /Bug #5/
|
||
|
assert_select 'dt.icon-issue-closed a', :text => /Bug #8 \(Closed\)/
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt.icon-issue a', :text => /Feature request #2/
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt.icon-issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
get :index, :params => {:q => 'searchkeyword', :issues => 1}
|
||
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /Feature request #2/
|
||
|
assert_select 'dt.icon-issue a', :text => /Feature request #2/
|
||
|
end
|
||
|
Role.find(1).remove_permission! :view_private_notes
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => /Bug #1/
|
||
|
assert_select 'dt.icon-issue', :text => /Bug #1/
|
||
|
assert_select 'dt', :text => /Bug #5/, :count => 0
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => /Bug #1/
|
||
|
assert_select 'dt.issue', :text => /Bug #5/
|
||
|
assert_select 'dt.icon-issue', :text => /Bug #1/
|
||
|
assert_select 'dt.icon-issue', :text => /Bug #5/
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => /#7/
|
||
|
assert_select 'dt.icon-issue', :text => /#7/
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => /##{issue.id}/
|
||
|
assert_select 'dt.icon-issue', :text => /##{issue.id}/
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => / #1 /
|
||
|
assert_select 'dt.icon-issue', :text => / #1 /
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => / #1 /
|
||
|
assert_select 'dt.issue', :text => / ##{issue.id} /
|
||
|
assert_select 'dt.icon-issue', :text => / #1 /
|
||
|
assert_select 'dt.icon-issue', :text => / ##{issue.id} /
|
||
|
assert_select 'dt', 2
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'input[name=all_words][checked=checked]'
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => / #3 /
|
||
|
assert_select 'dt.icon-issue', :text => / #3 /
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'input[name=all_words]:not([checked])'
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => / #3 /
|
||
|
assert_select 'dt.icon-issue', :text => / #3 /
|
||
|
assert_select 'dt', 3
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
assert_select 'input[name=titles_only]:not([checked])'
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue', :text => / #1 /
|
||
|
assert_select 'dt.icon-issue', :text => / #1 /
|
||
|
assert_select 'dt', 1
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
get :index, :params => {:q => 'search_with_limited_results'}
|
||
|
assert_response :success
|
||
|
issues[0..9].each do |issue|
|
||
|
assert_select '#search-results dt.issue', :text => / ##{issue.id} /
|
||
|
assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
|
||
|
end
|
||
|
get :index, :params => {:q => 'search_with_limited_results', :page => 2}
|
||
|
assert_response :success
|
||
|
issues[10..19].each do |issue|
|
||
|
assert_select '#search-results dt.issue', :text => / ##{issue.id} /
|
||
|
assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
|
||
|
end
|
||
|
get :index, :params => {:q => 'search_with_limited_results', :page => 3}
|
||
|
assert_response :success
|
||
|
issues[20..24].each do |issue|
|
||
|
assert_select '#search-results dt.issue', :text => / ##{issue.id} /
|
||
|
assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
|
||
|
end
|
||
|
get :index, :params => {:q => 'search_with_limited_results', :page => 4}
|
||
| ... | ... | |
|
get :index, :params => {:q => '"good bye" hello "bye bye"', :all_words => ''}
|
||
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => / ##{issue1.id} /
|
||
|
assert_select 'dt.issue a', :text => / ##{issue2.id} /
|
||
|
assert_select 'dt.issue a', :text => / ##{issue3.id} /, :count => 0
|
||
|
assert_select 'dt.icon-issue a', :text => / ##{issue1.id} /
|
||
|
assert_select 'dt.icon-issue a', :text => / ##{issue2.id} /
|
||
|
assert_select 'dt.icon-issue a', :text => / ##{issue3.id} /, :count => 0
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
get :index, :params => {:q => 'escaped_once'}
|
||
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a', :text => /<subject>/
|
||
|
assert_select 'dt.icon-issue a', :text => /<subject>/
|
||
|
assert_select 'dd', :text => /<description>/
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
get :index, :params => {:q => 'highlighted'}
|
||
|
assert_response :success
|
||
|
assert_select '#search-results' do
|
||
|
assert_select 'dt.issue a span.highlight', :text => 'highlighted'
|
||
|
assert_select 'dt.icon-issue a span.highlight', :text => 'highlighted'
|
||
|
assert_select 'dd span.highlight', :text => 'highlighted'
|
||
|
end
|
||
|
end
|
||