Skip to content

Commit d2b913e

Browse files
Copilot7underlines
andcommitted
Add search functionality to blog entries list
Co-authored-by: 7underlines <17121556+7underlines@users.noreply.github.com>
1 parent 7951d34 commit d2b913e

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Resources/app/administration/src/module/blog-module/page/werkl-blog-list/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default {
2121
total: 0,
2222
isLoading: true,
2323
currentLanguageId: Shopware.Context.api.languageId,
24+
term: '',
2425
};
2526
},
2627

@@ -89,6 +90,11 @@ export default {
8990
}
9091
},
9192

93+
onSearch(term) {
94+
this.term = term;
95+
this.getList();
96+
},
97+
9298
getList() {
9399
this.isLoading = true;
94100
const criteria = new Criteria(this.page, this.limit);
@@ -101,6 +107,11 @@ export default {
101107
if (this.categoryId) {
102108
criteria.addFilter(Criteria.equals('blogCategories.id', this.categoryId));
103109
}
110+
111+
if (this.term) {
112+
criteria.setTerm(this.term);
113+
}
114+
104115
return this.blogEntryRepository.search(criteria, Shopware.Context.api).then((result) => {
105116
this.total = result.total;
106117
this.blogEntries = result;

src/Resources/app/administration/src/module/blog-module/page/werkl-blog-list/werkl-blog-list.html.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
<sw-language-switch @on-change="changeLanguage" />
1919
</template>
2020

21+
{% block werkl_blog_list_search %}
22+
<template #search-bar>
23+
<sw-simple-search-field
24+
v-model:value="term"
25+
variant="inverted"
26+
size="small"
27+
:placeholder="$tc('werkl-blog.general.placeholderSearchBar')"
28+
@update:value="onSearch"
29+
/>
30+
</template>
31+
{% endblock %}
32+
2133
{% block werkl_blog_list_smart_bar_actions %}
2234
<template #smart-bar-actions>
2335
{% block werkl_blog_list_smart_bar_actions_add %}

0 commit comments

Comments
 (0)