mirror of
https://github.com/documize/community.git
synced 2025-07-27 09:09:44 +02:00
Warn if search criteria too short
Minimum keywords > 3
This commit is contained in:
parent
df9d9e174a
commit
f70d4b33a3
3 changed files with 15 additions and 1 deletions
|
@ -16,6 +16,7 @@ import Component from '@ember/component';
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
searchSvc: service('search'),
|
searchSvc: service('search'),
|
||||||
results: A([]),
|
results: A([]),
|
||||||
|
validSearch: true,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -50,6 +51,12 @@ export default Component.extend({
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
onSearch() {
|
onSearch() {
|
||||||
|
if (this.get('filter').trim().length < 3) {
|
||||||
|
this.set('validSearch', false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.set('validSearch', true);
|
||||||
this.fetch();
|
this.fetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,3 +108,6 @@ $color-whats-new: #fc1530;
|
||||||
.background-color-theme-light {
|
.background-color-theme-light {
|
||||||
background-color: $color-primary-light !important;
|
background-color: $color-primary-light !important;
|
||||||
}
|
}
|
||||||
|
.background-color-gold {
|
||||||
|
background-color: $color-goldy !important;
|
||||||
|
}
|
||||||
|
|
|
@ -26,5 +26,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if validSearch}}
|
||||||
{{search/search-results results=results keywords=filter}}
|
{{search/search-results results=results keywords=filter}}
|
||||||
|
{{else}}
|
||||||
|
<p class="text-danger my-5">Your search term is too short</p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue