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 a property to set to remove trailing and leading spaces of search
text.
* Removes previous fix that is useless now.
* Removes weird character in the licence text of templates.
* Closes #213.

Co-Authored-by: Alicia Zangger <alicia.zangger@rero.ch>
  • Loading branch information
Alicia Zangger committed Apr 1, 2020
1 parent 86a20f0 commit d28c845
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 42 deletions.
30 changes: 16 additions & 14 deletions projects/admin/src/app/circulation/checkin/checkin.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!--
RERO ILS UI
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/>.
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/>.
-->
<section *ngIf="!isLoading; else loading" class="content">
<div class="row">
Expand All @@ -21,7 +21,9 @@
[placeholder]="placeholder | translate"
[searchText]="searchText"
(search)="searchValueUpdated($event)"
[focus]="searchInputFocus"></ng-core-search-input>
[focus]="searchInputFocus"
[trimQueryString]="trimSearchText">
</ng-core-search-input>
</div>
<div class="col col-md-6 mb-4">
<admin-circulation-patron-detailed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export class CheckinComponent implements OnInit {
/** Focus attribute of the search input */
searchInputFocus = false;

/** Remove trailing and leading spaces if true */
trimSearchText = true;

/** Constructor
* @param _userService: User Service
* @param _recordService: Record Service
Expand Down Expand Up @@ -86,7 +89,6 @@ export class CheckinComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText.trim();
this.getPatronOrItem(this.searchText);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!--
RERO ILS UI
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/>.
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/>.
-->

<ng-container *ngIf="items && items.length > 0">
Expand All @@ -24,6 +24,7 @@
[searchText]="searchText"
(search)="searchValueUpdated($event)"
[focus]="searchInputFocus"
[trimQueryString]="trimSearchText"
></ng-core-search-input>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export class MainRequestComponent implements OnInit {
/** Focus attribute of the search input */
searchInputFocus = false;

/** Remove trailing and leading spaces if true */
trimSearchText = true;

/** Constructor
* @param userService: User Service
* @param itemsService: Items Service
Expand Down
27 changes: 14 additions & 13 deletions projects/admin/src/app/circulation/patron/loan/loan.component.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<!--
RERO ILS UI
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/>.
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/>.
-->

<section *ngIf="!isLoading; else loading" class="content">
Expand All @@ -23,6 +23,7 @@
[searchText]="searchText"
(search)="searchValueUpdated($event)"
[focus]="searchInputFocus"
[trimQueryString]="trimSearchText"
></ng-core-search-input>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export class LoanComponent implements OnInit {
/** Focus attribute of the search input */
searchInputFocus = false;

/** Remove trailing and leading spaces if true */
trimSearchText = true;

/** Library PID of the logged user */
currentLibraryPid: string;

Expand Down Expand Up @@ -92,7 +95,6 @@ export class LoanComponent implements OnInit {
if (!searchText) {
return null;
}
this.searchText = searchText.trim();
this.getItem(this.searchText);
}

Expand Down

0 comments on commit d28c845

Please sign in to comment.