| ... |
... |
@@ -1,4 +1,7 @@ |
| 1 |
1 |
{{html clean="false"}} |
|
2 |
+<!-- |
|
3 |
+ !!! POC. Code would need to be reviewed / optimized and packaged if this is meant to be used in production !!! |
|
4 |
+--> |
| 2 |
2 |
<script type="module"> |
| 3 |
3 |
import {LitElement, html} from 'https://cdn.jsdelivr.net/gh/lit/dist@2/core/lit-core.min.js'; |
| 4 |
4 |
class UnifiedSearch extends LitElement { |
| ... |
... |
@@ -15,21 +15,26 @@ |
| 15 |
15 |
super(); |
| 16 |
16 |
this.searchText = ""; |
| 17 |
17 |
this.favoritesFilter = false; |
| 18 |
|
- this.administratorFilter = true; |
|
21 |
+ this.administratorFilter = false; |
| 19 |
19 |
this.editorFilter = false; |
| 20 |
20 |
this.viewerFilter = false; |
| 21 |
21 |
this.publicFilter = false; |
| 22 |
22 |
this.privateFilter = false; |
| 23 |
23 |
} |
| 24 |
|
- toggleFilter(filter) { |
| 25 |
|
- filter = !filter |
|
27 |
+ toggleBooleanFilter(filterName) { |
|
28 |
+ this[filterName] = !this[filterName]; |
|
29 |
+ console.log(this.administratorFilter); |
| 26 |
26 |
} |
| 27 |
27 |
setSearchText(e) { |
| 28 |
28 |
this.searchText = e.target.value; |
| 29 |
29 |
} |
| 30 |
30 |
handleSearch() { |
|
35 |
+ // check if text changed |
| 31 |
31 |
console.log(this.searchText); |
| 32 |
32 |
} |
|
38 |
+ buildFilter() { |
|
39 |
+ //https://wiki-dev.ebrains.eu/rest/v1/collabs?search=&offset=0&orderField=title&order=asc&favorite=true&roles= |
|
40 |
+ } |
| 33 |
33 |
render() { |
| 34 |
34 |
return html` |
| 35 |
35 |
<div> |
| ... |
... |
@@ -37,7 +37,14 @@ |
| 37 |
37 |
<input @change="${this.setSearchText}" type="text" placeholder="Search..." /> |
| 38 |
38 |
<button @click="${this.handleSearch}">Search</button> |
| 39 |
39 |
</div> |
| 40 |
|
- <label><input type="checkbox" @change="${() => toggleFilter(this.administratorFilter)}" .checked="${this.administratorFilter}"/> Administrator</label> |
|
48 |
+ <div> |
|
49 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('favoritesFilter')}" .checked="${this.favoritesFilter}"/> Favorites</label> |
|
50 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('administratorFilter')}" .checked="${this.administratorFilter}"/> Administrator</label> |
|
51 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('editorFilter')}" .checked="${this.editorFilter}"/> Editor</label> |
|
52 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('viewerFilter')}" .checked="${this.viewerFilter}"/> Viewer</label> |
|
53 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('publicFilter')}" .checked="${this.publicFilter}"/> Public</label> |
|
54 |
+ <label><input type="checkbox" @change="${() => this.toggleBooleanFilter('privateFilter')}" .checked="${this.privateFilter}"/> Public</label> |
|
55 |
+ </div> |
| 41 |
41 |
</div> |
| 42 |
42 |
` |
| 43 |
43 |
} |
| ... |
... |
@@ -46,7 +46,7 @@ |
| 46 |
46 |
</script> |
| 47 |
47 |
|
| 48 |
48 |
<clb-unified-search></clb-unified-search> |
| 49 |
|
- |
|
64 |
+<!-- |
| 50 |
50 |
<select id="context-search-type"> |
| 51 |
51 |
<option value="all">All</option> |
| 52 |
52 |
<option value="collabs">Collabs</option> |
| ... |
... |
@@ -170,7 +170,6 @@ |
| 170 |
170 |
}) |
| 171 |
171 |
} |
| 172 |
172 |
}); |
| 173 |
|
- |
| 174 |
|
- |
| 175 |
175 |
</script> |
|
189 |
+--> |
| 176 |
176 |
{{/html}} |