File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 11import Controller from '@ember/controller' ;
2+ import { task , timeout } from 'ember-concurrency' ;
23
34export default Controller . extend ( {
45 queryParams : [ 'page' , 'limit' ] ,
56 page : 1 ,
6- limit : 10
7+ limit : 10 ,
8+ searchString : '' ,
9+ searchTask : task ( function * ( ) {
10+ yield timeout ( 250 )
11+ const questions = yield this . get ( 'store' ) . query ( 'question' , {
12+ include : 'user' ,
13+ page : {
14+ number : this . get ( 'page' ) ,
15+ limit : this . get ( 'limit' )
16+ } ,
17+ filter : {
18+ title : {
19+ $iLike : `%${ this . get ( 'searchString' ) } %`
20+ }
21+ }
22+ } )
23+ this . set ( 'page' , 1 )
24+ this . set ( 'questions' , questions )
25+ } ) . restartable ( )
726
827} ) ;
Original file line number Diff line number Diff line change 55 <button >+ Add Question</button >
66 {{ /link-to }}
77 </div >
8+ {{ input type =" text" class =" form-control" placeholder =" Filter By Question Name" key-up = (perform searchTask ) value =searchString }}
89 </div >
910 {{ #each questions as |question |}}
1011 <div class =" row" >
You can’t perform that action at this time.
0 commit comments