Skip to content

Commit

Permalink
search: fix query with trailing and leading space
Browse files Browse the repository at this point in the history
* Adds an input property to remove trailing and leading space if needed.
* Removes weird character in licence text of the template.
* Closes rero/rero-ils-ui#213.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger committed Apr 1, 2020
1 parent 825cbf5 commit df9c79c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!--
Invenio angular core
Copyright (C) 2019 RERO

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Invenio angular core
Copyright (C) 2019 RERO
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<label for="search" class="font-weight-bold" *ngIf="displayLabel">{{ placeholder }}</label>
<div class="input-group px-0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ export class SearchInputComponent {
}
}

/** Remove trailing and leading spaces if true */
@Input() trimQueryString = true;

doSearch(searchText: string) {
this.search.emit(searchText);
if (this.trimQueryString) {
this.search.emit(searchText.trim());
} else {
this.search.emit(searchText);
}
}
}

0 comments on commit df9c79c

Please sign in to comment.