05_use_regular_icons_in_search_results.patch

Marius BALTEANU, 2016-11-12 14:49

Download (10.1 KB)

View differences:

app/views/search/index.html.erb
42 42
    <h3><%= l(:label_result_plural) %> (<%= @result_count %>)</h3>
43 43
    <dl id="search-results">
44 44
      <% @results.each do |e| %>
45
        <dt class="<%= e.event_type %>">
45
        <dt class="icon icon-<%= e.event_type.parameterize %>">
46 46
          <%= content_tag('span', e.project, :class => 'project') unless @project == e.project %>
47 47
          <%= link_to(highlight_tokens(e.event_title.truncate(255), @tokens), e.event_url) %>
48 48
        </dt>
public/stylesheets/application.css
422 422

  
423 423
div#activity dl, #search-results { margin-left: 2em; }
424 424
div#activity dd, #search-results dd { margin-bottom: 1em; padding-left: 18px; font-size: 0.9em; }
425
#search-results dt { margin-bottom: 0px; padding-left: 20px; line-height: 18px; background-position: 0 50%; background-repeat: no-repeat; }
426 425
div#activity dt.me .time { border-bottom: 1px solid #999; }
427 426
div#activity dt .time { color: #777; font-size: 80%; }
428 427
div#activity dd .description, #search-results dd .description { font-style: italic; }
......
438 437
div#search-results-counts ul { margin-top: 0.5em; }
439 438
div#search-results-counts  li { list-style-type:none; float: left; margin-left: 1em; }
440 439

  
441
#search-results dt.issue.closed { background-image: url(../images/ticket_checked.png); }
442

  
443 440
div#roadmap .related-issues { margin-bottom: 1em; }
444 441
div#roadmap .related-issues td.checkbox { display: none; }
445 442
div#roadmap .wiki h1:first-child { display: none; }
test/functional/search_controller_test.rb
39 39
  def test_search_for_projects
40 40
    get :index, :params => {:q => "cook"}
41 41
    assert_response :success
42
    assert_select '#search-results dt.project a', :text => /eCookbook/
42
    assert_select '#search-results dt.icon-project a', :text => /eCookbook/
43 43
  end
44 44

  
45 45
  def test_search_on_archived_project_should_return_404
......
72 72
    assert_response :success
73 73

  
74 74
    assert_select '#search-results' do
75
      assert_select 'dt.issue a', :text => /Feature request #2/
76
      assert_select 'dt.issue a', :text => /Bug #5/
77
      assert_select 'dt.changeset a', :text => /Revision 1/
75
      assert_select 'dt.icon-issue a', :text => /Feature request #2/
76
      assert_select 'dt.icon-issue a', :text => /Bug #5/
77
      assert_select 'dt.icon-changeset a', :text => /Revision 1/
78 78

  
79
      assert_select 'dt.issue a', :text => /Add ingredients categories/
79
      assert_select 'dt.icon-issue a', :text => /Add ingredients categories/
80 80
      assert_select 'dd', :text => /should be classified by categories/
81 81
    end
82 82

  
......
93 93
    assert_select 'input[name=titles_only]:not([checked])'
94 94

  
95 95
    assert_select '#search-results' do
96
      assert_select 'dt.issue a', :text => /Bug #5/
97
      assert_select 'dt.issue.closed a', :text => /Bug #8 \(Closed\)/
96
      assert_select 'dt.icon-issue a', :text => /Bug #5/
97
      assert_select 'dt.icon-issue-closed a', :text => /Bug #8 \(Closed\)/
98 98
    end
99 99
  end
100 100

  
......
105 105
    assert_response :success
106 106

  
107 107
    assert_select '#search-results' do
108
      assert_select 'dt.issue a', :text => /Feature request #2/
108
      assert_select 'dt.icon-issue a', :text => /Feature request #2/
109 109
    end
110 110
  end
111 111

  
......
117 117
    assert_response :success
118 118

  
119 119
    assert_select '#search-results' do
120
      assert_select 'dt.issue a', :text => /Feature request #2/
120
      assert_select 'dt.icon-issue a', :text => /Feature request #2/
121 121
      assert_select 'dt', 1
122 122
    end
123 123
  end
......
130 130
    get :index, :params => {:q => 'searchkeyword', :issues => 1}
131 131
    assert_response :success
132 132
    assert_select '#search-results' do
133
      assert_select 'dt.issue a', :text => /Feature request #2/
133
      assert_select 'dt.icon-issue a', :text => /Feature request #2/
134 134
    end
135 135

  
136 136
    Role.find(1).remove_permission! :view_private_notes
......
154 154
    assert_response :success
155 155

  
156 156
    assert_select '#search-results' do
157
      assert_select 'dt.issue', :text => /Bug #1/
157
      assert_select 'dt.icon-issue', :text => /Bug #1/
158 158
      assert_select 'dt', :text => /Bug #5/, :count => 0
159 159
    end
160 160
  end
......
174 174
    assert_response :success
175 175

  
176 176
    assert_select '#search-results' do
177
      assert_select 'dt.issue', :text => /Bug #1/
178
      assert_select 'dt.issue', :text => /Bug #5/
177
      assert_select 'dt.icon-issue', :text => /Bug #1/
178
      assert_select 'dt.icon-issue', :text => /Bug #5/
179 179
    end
180 180
  end
181 181

  
......
194 194
    assert_response :success
195 195

  
196 196
    assert_select '#search-results' do
197
      assert_select 'dt.issue', :text => /#7/
197
      assert_select 'dt.icon-issue', :text => /#7/
198 198
      assert_select 'dt', 1
199 199
    end
200 200
  end
......
207 207
    assert_response :success
208 208

  
209 209
    assert_select '#search-results' do
210
      assert_select 'dt.issue', :text => /##{issue.id}/
210
      assert_select 'dt.icon-issue', :text => /##{issue.id}/
211 211
      assert_select 'dt', 1
212 212
    end
213 213
  end
......
220 220
    assert_response :success
221 221

  
222 222
    assert_select '#search-results' do
223
      assert_select 'dt.issue', :text => / #1 /
223
      assert_select 'dt.icon-issue', :text => / #1 /
224 224
      assert_select 'dt', 1
225 225
    end
226 226
  end
......
233 233
    assert_response :success
234 234

  
235 235
    assert_select '#search-results' do
236
      assert_select 'dt.issue', :text => / #1 /
237
      assert_select 'dt.issue', :text => / ##{issue.id} /
236
      assert_select 'dt.icon-issue', :text => / #1 /
237
      assert_select 'dt.icon-issue', :text => / ##{issue.id} /
238 238
      assert_select 'dt', 2
239 239
    end
240 240
  end
......
258 258

  
259 259
    assert_select 'input[name=all_words][checked=checked]'
260 260
    assert_select '#search-results' do
261
      assert_select 'dt.issue', :text => / #3 /
261
      assert_select 'dt.icon-issue', :text => / #3 /
262 262
      assert_select 'dt', 1
263 263
    end
264 264
  end
......
269 269

  
270 270
    assert_select 'input[name=all_words]:not([checked])'
271 271
    assert_select '#search-results' do
272
      assert_select 'dt.issue', :text => / #3 /
272
      assert_select 'dt.icon-issue', :text => / #3 /
273 273
      assert_select 'dt', 3
274 274
    end
275 275
  end
......
302 302

  
303 303
    assert_select 'input[name=titles_only]:not([checked])'
304 304
    assert_select '#search-results' do
305
      assert_select 'dt.issue', :text => / #1 /
305
      assert_select 'dt.icon-issue', :text => / #1 /
306 306
      assert_select 'dt', 1
307 307
    end
308 308
  end
......
313 313
    get :index, :params => {:q => 'search_with_limited_results'}
314 314
    assert_response :success
315 315
    issues[0..9].each do |issue|
316
      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
316
      assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
317 317
    end
318 318

  
319 319
    get :index, :params => {:q => 'search_with_limited_results', :page => 2}
320 320
    assert_response :success
321 321
    issues[10..19].each do |issue|
322
      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
322
      assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
323 323
    end
324 324

  
325 325
    get :index, :params => {:q => 'search_with_limited_results', :page => 3}
326 326
    assert_response :success
327 327
    issues[20..24].each do |issue|
328
      assert_select '#search-results dt.issue', :text => / ##{issue.id} /
328
      assert_select '#search-results dt.icon-issue', :text => / ##{issue.id} /
329 329
    end
330 330

  
331 331
    get :index, :params => {:q => 'search_with_limited_results', :page => 4}
......
361 361
    get :index, :params => {:q => '"good bye" hello "bye bye"', :all_words => ''}
362 362
    assert_response :success
363 363
    assert_select '#search-results' do
364
      assert_select 'dt.issue a', :text => / ##{issue1.id} /
365
      assert_select 'dt.issue a', :text => / ##{issue2.id} /
366
      assert_select 'dt.issue a', :text => / ##{issue3.id} /, :count => 0
364
      assert_select 'dt.icon-issue a', :text => / ##{issue1.id} /
365
      assert_select 'dt.icon-issue a', :text => / ##{issue2.id} /
366
      assert_select 'dt.icon-issue a', :text => / ##{issue3.id} /, :count => 0
367 367
    end
368 368
  end
369 369

  
......
372 372
    get :index, :params => {:q => 'escaped_once'}
373 373
    assert_response :success
374 374
    assert_select '#search-results' do
375
      assert_select 'dt.issue a', :text => /<subject>/
375
      assert_select 'dt.icon-issue a', :text => /<subject>/
376 376
      assert_select 'dd', :text => /<description>/
377 377
    end
378 378
  end
......
382 382
    get :index, :params => {:q => 'highlighted'}
383 383
    assert_response :success
384 384
    assert_select '#search-results' do
385
      assert_select 'dt.issue a span.highlight', :text => 'highlighted'
385
      assert_select 'dt.icon-issue a span.highlight', :text => 'highlighted'
386 386
      assert_select 'dd span.highlight', :text => 'highlighted'
387 387
    end
388 388
  end