File tree 5 files changed +34
-2
lines changed
5 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { restartableTask } from 'ember-concurrency';
7
7
import { bool , reads } from 'macro-decorators' ;
8
8
9
9
import { pagination } from '../utils/pagination' ;
10
- import { processSearchQuery } from '../utils/search' ;
10
+ import { CATEGORY_PREFIX , processSearchQuery } from '../utils/search' ;
11
11
12
12
export default class SearchController extends Controller {
13
13
@service store ;
@@ -49,6 +49,11 @@ export default class SearchController extends Controller {
49
49
50
50
@bool ( 'totalItems' ) hasItems ;
51
51
52
+ get hasMultiCategoryFilter ( ) {
53
+ let tokens = this . q . trim ( ) . split ( / \s + / ) ;
54
+ return tokens . filter ( token => token . startsWith ( CATEGORY_PREFIX ) ) . length > 1 ;
55
+ }
56
+
52
57
@action fetchData ( ) {
53
58
this . dataTask . perform ( ) . catch ( ( ) => {
54
59
// we ignore errors here because they are handled in the template already
Original file line number Diff line number Diff line change 6
6
--grey200 : hsl (200 , 17% , 96% );
7
7
--green800 : hsl (115 , 31% , 31% );
8
8
--green900 : hsl (115 , 31% , 21% );
9
+
10
+ --orange-50 : # fff7ed ;
11
+ --orange-100 : # ffedd5 ;
12
+ --orange-200 : # fed7aa ;
13
+ --orange-300 : # fdba74 ;
14
+ --orange-400 : # fb923c ;
15
+ --orange-500 : # f97316 ;
16
+ --orange-600 : # ea580c ;
17
+ --orange-700 : # c2410c ;
18
+ --orange-800 : # 9a3412 ;
19
+ --orange-900 : # 7c2d12 ;
20
+
9
21
--yellow500 : hsl (44 , 100% , 60% );
10
22
--yellow700 : hsl (44 , 67% , 50% );
11
23
Original file line number Diff line number Diff line change 5
5
margin-bottom : 25px ;
6
6
}
7
7
8
+ .warning {
9
+ margin : 0 0 16px ;
10
+ padding : 8px ;
11
+ color : var (--orange-700 );
12
+ background : var (--orange-100 );
13
+ border-left : solid var (--orange-400 ) 4px ;
14
+ border-radius : 2px ;
15
+ }
16
+
8
17
.sort-by-label {
9
18
composes : small from './shared/typography.module.css' ;
10
19
}
Original file line number Diff line number Diff line change 8
8
data-test-header
9
9
/>
10
10
11
+ {{ #if this.hasMultiCategoryFilter }}
12
+ <div local-class =" warning" >
13
+ Support for using multiple <code >category:</code > filters is not yet implemented.
14
+ </div >
15
+ {{ /if }}
16
+
11
17
{{ #if this.firstResultPending }}
12
18
<h2 >Loading search results...</h2 >
13
19
{{ else if this.dataTask.lastComplete.error}}
Original file line number Diff line number Diff line change 1
- const CATEGORY_PREFIX = 'category:' ;
1
+ export const CATEGORY_PREFIX = 'category:' ;
2
2
const KEYWORD_PREFIX = 'keyword:' ;
3
3
4
4
/**
You can’t perform that action at this time.
0 commit comments