-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
search: keep only the children filter and add filter list #503
Conversation
8af9113
to
226d638
Compare
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.spec.ts
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.ts
Outdated
Show resolved
Hide resolved
...s/rero/ng-core/src/lib/record/search/aggregation/list-filters/list-filters.component.spec.ts
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/aggregation.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/bucket-name.pipe.ts
Outdated
Show resolved
Hide resolved
return (this.size === null || this.moreMode === false) | ||
? size | ||
: this.size; | ||
return this.size === null || this.moreMode === false ? size : this.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure about parentheses removal ?
COSMETIC : For readability, I prefer use ternary instruction on three separate line (my opinion)
return (this.size === null) | ||
? false | ||
: this.buckets.length > this.size; | ||
return this.size === null ? false : this.buckets.length > this.size; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COSMETIC : Seems more readable on three line ; especially when one of the option is itself a boolean comparaison.
<ul *ngIf="filters?.length > 0" class="pl-0"> | ||
<li *ngFor="let filter of filters" class="list-unstyled mb-1"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPINION : (should be discussed with all devs). Using styling in ng/core should be use only if really necessary (especially padding
, margin
, ...). Using them into ng/core will disallow to have custom styling in children project.
projects/rero/ng-core/src/lib/record/search/aggregation/list-filters/list-filters.component.ts
Outdated
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/aggregation/list-filters/list-filters.component.ts
Show resolved
Hide resolved
projects/rero/ng-core/src/lib/record/search/record-search.component.html
Outdated
Show resolved
Hide resolved
226d638
to
283bacf
Compare
d6b92c9
to
4ae14ef
Compare
4ae14ef
to
c62977a
Compare
The commit message is too long (Max 50 chars). Make a description for that. And why you are 3 commits ? |
// For language aggregation, we transform language code to human readable | ||
// language. | ||
if (aggregationKey === 'language') { | ||
return this._translateLanguage.translate(bucket.key, this._translateService.currentLang); | ||
} | ||
|
||
// Simply translate the bucket key. | ||
return this._translateService.instant(bucket.key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic : a ternary instruction (I love them 😍) could be used
return (aggregationKey === 'language')
? this._translateLanguage.translate(bucket.key, this._translateService.currentLang)
: this._translateService.instant(bucket.key)
@@ -0,0 +1,8 @@ | |||
<ul *ngIf="filters?.length > 0" class="pl-0"> | |||
<li id="filter" *ngFor="let filter of filters" class="d-inline list-unstyled pr-2"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use an id
attribute with a *ngFor
should be avoid. An ID must be unique into the DOM. If we create multiple li
, the same id
cill be used.
Additionnally using a id
attribute on this tag seems not required at all except for the spec.ts
.
Two solutions :
- either use an
id='filters'
attributes on theul
tag. Selectror changes toul#filters li > button
(to be tested) - either use an additional
class
(ex:'filter-value') on eachli
. Selectror changes toli.filter-value > button
(to be tested)
}); | ||
|
||
it('should display 2 buttons', () => { | ||
const buttons = fixture.debugElement.nativeElement.querySelectorAll('li#filter > button'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment
/** | ||
* All aggregations | ||
*/ | ||
@Input() | ||
aggregations; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cosmetic : I prefer the condensed writing method (personal feeling)
/** All aggregations */
@Input() aggregations;
*/ | ||
constructor( | ||
private _recordSearchService: RecordSearchService, | ||
private ref: ChangeDetectorRef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if private, then use the '_' convention --> _ref
if (this._config.showFacetsIfNoResults) { | ||
return false; | ||
} else { | ||
return !this.q && this.records.length === 0 && !this.showEmptySearchMessage; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible ternary here.
c62977a
to
0d60c09
Compare
0d60c09
to
80d2a93
Compare
* Removes the parent filters when a filter is selected in a hierarchical aggregation. * Removes useless methods. * The aggregationsExpand configuration can be a function. * Adds indeterminate state to the parent filters. * Stores the aggregationKey and parent properties in each bucket. Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch Co-Authored-by: Valeria Granata <valeria@chaw.com>
b84b8c3
to
14b172b
Compare
* correct Library facet in organisation view * improve Publication year facet Co-Authored-by: Valeria Granata <valeria@chaw.com>
14b172b
to
e1bf4c1
Compare
Signed-off-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch
aggregation.
Co-Authored-by: Johnny Mariéthoz Johnny.Mariethoz@rero.ch
Co-Authored-by: Valeria Granata valeria@chaw.com
Screenshot
Why are you opening this PR?
How to test?
Code review check list