|
9 | 9 | <script> |
10 | 10 | (function(){ |
11 | 11 | function getPageFilterForm(filterForm) { |
| 12 | + const filterGroup = [...new Map([ |
| 13 | + { |
| 14 | + "id": "my-resources", |
| 15 | + "labelId": "gnhome.myResources", |
| 16 | + "type": "filter", |
| 17 | + "disableIf": "{!state('user')}" |
| 18 | + }, |
| 19 | + { |
| 20 | + "id": "favorite", |
| 21 | + "labelId": "gnhome.favorites", |
| 22 | + "type": "filter", |
| 23 | + "disableIf": "{!state('user')}" |
| 24 | + }, |
| 25 | + { |
| 26 | + "id": "featured", |
| 27 | + "labelId": "gnhome.featuredList", |
| 28 | + "type": "filter" |
| 29 | + }, |
| 30 | + { |
| 31 | + "id": "unpublished", |
| 32 | + "labelId": "gnhome.unpublished", |
| 33 | + "type": "filter", |
| 34 | + "disableIf": "{!state('user')}" |
| 35 | + }, |
| 36 | + { |
| 37 | + "id": "pending-approval", |
| 38 | + "labelId": "gnhome.pendingApproval", |
| 39 | + "type": "filter", |
| 40 | + "disableIf": "{!state('user')}" |
| 41 | + }, |
| 42 | + ...(filterForm ?? []), |
| 43 | + ].map(item => [item.id, item])).values()]; |
12 | 44 | return [ |
13 | 45 | { |
14 | 46 | "type": "search" |
15 | 47 | }, |
16 | 48 | { |
17 | 49 | "type": "group", |
18 | 50 | "labelId": "gnhome.customFiltersTitle", |
19 | | - "items": [ |
20 | | - { |
21 | | - "id": "my-resources", |
22 | | - "labelId": "gnhome.myResources", |
23 | | - "type": "filter", |
24 | | - "disableIf": "{!state('user')}" |
25 | | - }, |
26 | | - { |
27 | | - "id": "favorite", |
28 | | - "labelId": "gnhome.favorites", |
29 | | - "type": "filter", |
30 | | - "disableIf": "{!state('user')}" |
31 | | - }, |
32 | | - { |
33 | | - "id": "featured", |
34 | | - "labelId": "gnhome.featuredList", |
35 | | - "type": "filter" |
36 | | - }, |
37 | | - { |
38 | | - "id": "unpublished", |
39 | | - "labelId": "gnhome.unpublished", |
40 | | - "type": "filter", |
41 | | - "disableIf": "{!state('user')}" |
42 | | - }, |
43 | | - { |
44 | | - "id": "pending-approval", |
45 | | - "labelId": "gnhome.pendingApproval", |
46 | | - "type": "filter", |
47 | | - "disableIf": "{!state('user')}" |
48 | | - }, |
49 | | - ...(filterForm ?? []), |
50 | | - ] |
| 51 | + "items": filterGroup |
51 | 52 | }, |
52 | 53 | { |
53 | 54 | "type": "divider", |
|
0 commit comments