Skip to content

Commit cf8f92a

Browse files
Yelinzczosel
authored andcommitted
fix(search): improve search list experience
1 parent 42429cb commit cf8f92a

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

addon/components/document-list-item.hbs

+8-2
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@
4444
</td>
4545
{{else if (eq column "link")}}
4646
<td>
47-
{{#let (await (this.config.documentListLinkTo @document)) as |linkConfig|}}
47+
{{#let
48+
(await (this.config.documentListLinkTo @document))
49+
as |linkConfig|
50+
}}
4851
{{#if linkConfig.url}}
49-
<a href={{linkConfig.url}}>{{linkConfig.label}}</a>
52+
<a
53+
href={{linkConfig.url}}
54+
{{on "click" (fn this.transitionTo linkConfig.url)}}
55+
>{{linkConfig.label}}</a>
5056
{{else}}
5157
<LinkTo
5258
@route={{linkConfig.route}}

addon/components/document-list-item.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { action } from "@ember/object";
12
import { inject as service } from "@ember/service";
23
import Component from "@glimmer/component";
34

45
export default class DocumentListItemComponent extends Component {
56
@service("alexandria-config") config;
7+
@service router;
68

79
get classes() {
810
const classes = ["document-list-item"];
@@ -17,4 +19,11 @@ export default class DocumentListItemComponent extends Component {
1719

1820
return classes.join(" ");
1921
}
22+
23+
@action
24+
transitionTo(url, event) {
25+
event.preventDefault();
26+
27+
this.router.transitionTo(url);
28+
}
2029
}

addon/components/file-search.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { trackedFunction } from "reactiveweb/function";
88
export default class DocumentViewComponent extends Component {
99
@service store;
1010
@service("alexandria-config") config;
11+
@service("alexandria-documents") documents;
1112

1213
@tracked listView = true;
1314
@tracked search = "";
@@ -24,7 +25,7 @@ export default class DocumentViewComponent extends Component {
2425
const files = await this.store.query(
2526
"file",
2627
{
27-
include: "document",
28+
include: "document,renderings",
2829
filter: this.args.filters || {},
2930
page: { number: 1 },
3031
},

0 commit comments

Comments
 (0)