File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
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 ,
67 limit : 10 ,
8+ searchString : '' ,
9+ searchTask : task ( function * ( ) {
10+ yield timeout ( 250 )
11+
12+ let searchStr = this . get ( 'searchString' ) . trim ( )
13+
14+ const questions = yield this . get ( 'store' ) . query ( 'question' , {
15+ include : 'user' ,
16+ filter : {
17+ title : {
18+ $iLike : `%${ this . get ( 'searchString' ) } %`
19+ }
20+ }
21+ } )
22+ this . set ( 'page' , 1 )
23+ this . set ( 'questions' , questions )
24+ } ) . restartable ( ) ,
725 actions : {
826 deleteQuestion ( question ) {
927 question . destroyRecord ( )
1028 }
1129 }
12-
1330} ) ;
Original file line number Diff line number Diff line change 11<div class =" container" >
2- <div class = " row " >
2+ <div >
33 <div class =" button-solid" >
44 {{ #link-to ' questions.new' class =" white" }}
55 <button >+ Add Question</button >
66 {{ /link-to }}
77 </div >
8- </div >
8+ <br >
9+ <div class =" row justify-content-center" >
10+ <p class =" card-title" >Filter By Question Name: </p > {{ input type =" text" class =" form-control" placeholder =" Enter Question Name" key-up = (perform searchTask ) value =searchString }}
11+ </div >
12+ </div >
913 {{ #each questions as |question |}}
1014 <div class =" row" >
1115 <div class =" card" >
You can’t perform that action at this time.
0 commit comments