File tree Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Expand file tree Collapse file tree 3 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ const filterStories = () => {
105
105
const storyTitle = element
106
106
. querySelector ( "td:first-child" )
107
107
. innerText . toLowerCase ( ) ;
108
- if ( storyTitle . includes ( searchTerm ) ) {
108
+ if ( storyTitle . includes ( searchTerm ) || element . id . replace ( / \D / g , '' ) . includes ( searchTerm ) ) {
109
109
cl . remove ( "hidden" ) ;
110
110
} else {
111
111
cl . add ( "hidden" ) ;
Original file line number Diff line number Diff line change 3
3
< h1 class ="dashboard-title "> <%= render partial : "shared/project_title" , locals : { allow_edit : true , project : @project } %> </ h1 >
4
4
5
5
< div class ="search-field ">
6
- <%= label_tag 'title_contains' , "Filter by title" %>
6
+ <%= label_tag 'title_contains' , "Filter by title or ID " %>
7
7
<%= search_field_tag 'title_contains' , nil , onkeyup : "filterStories()" %>
8
8
</ div >
9
9
</ div >
28
28
< tr class ="project-table__row project-table__row--story " id ="<%= dom_id ( story ) %> " >
29
29
< td class ="project-table__cell ">
30
30
< input type ="checkbox " name ="stories[] " value ="<%= story . id %> ">
31
- <%= link_to story . title , [ story . project , story ] %>
31
+ <%= link_to " #{ story . id } - #{ story . title } " , [ story . project , story ] %>
32
32
< button class ="copy-link btn-clipboard " data-clipboard-text ="<%= project_story_url ( @project , story ) %> " title ='Copy story '> < i class ="fa fa-link "> </ i > < span class = "popup "> Copied to clipboard</ span > </ button >
33
33
</ td >
34
34
< td class ="project-table__cell "> <%= story . estimate_for ( current_user ) &.best_case_points %> </ td >
Original file line number Diff line number Diff line change 318
318
319
319
expect ( page ) . not_to have_selector ( ".project-table.sorting" )
320
320
end
321
+
322
+ it "filter stories by title or ID" , js : true do
323
+ story4 = FactoryBot . create ( :story , project : project , title : "Deprecation warning XYZ" )
324
+ story5 = FactoryBot . create ( :story , project : project , title : "Dangerous query method" )
325
+
326
+ visit project_path ( id : project . id )
327
+
328
+ fill_in "title_contains" , with : "XYZ"
329
+
330
+ within ( "#stories" ) do
331
+ expect ( find ( "td:nth-child(1)" ) ) . to have_text story4 . title
332
+ expect ( all ( "#stories > tr" ) . count ) . to eq ( 1 )
333
+ end
334
+
335
+ fill_in "title_contains" , with : story5 . id
336
+
337
+ within ( "#stories" ) do
338
+ expect ( find ( "td:nth-child(1)" ) ) . to have_text story5 . title
339
+ expect ( all ( "#stories > tr" ) . count ) . to eq ( 1 )
340
+ end
341
+ end
321
342
end
You can’t perform that action at this time.
0 commit comments