Skip to content
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

aggregation: make the name customizable #375

Merged
merged 1 commit into from
Apr 14, 2021

Conversation

Garfield-fr
Copy link
Contributor

@Garfield-fr Garfield-fr commented Apr 8, 2021

A new parameter "aggregationsName" has been added
to the configuration to allow the customization of the aggregation name.
Supports a name property to set a custom title for an aggregation.

Co-Authored-by: Bertrand Zuchuat bertrand.zuchuat@rero.ch

Why are you opening this PR?

  • allow the customization of the facet name

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

@Garfield-fr Garfield-fr force-pushed the zub-aggregation-name branch 2 times, most recently from f7cc5a4 to 222b089 Compare April 8, 2021 10:10
@Garfield-fr Garfield-fr changed the title facet: added the possibility to customize the title aggregation: added the possibility to customize the title Apr 8, 2021
@Garfield-fr Garfield-fr force-pushed the zub-aggregation-name branch from 222b089 to ba27bd0 Compare April 8, 2021 10:12
@Garfield-fr Garfield-fr force-pushed the zub-aggregation-name branch from ba27bd0 to b96c723 Compare April 8, 2021 10:31
@Garfield-fr Garfield-fr changed the title aggregation: added the possibility to customize the title aggregation: added the possibility to customize the name Apr 8, 2021
Comment on lines 35 to 40
<ng-container *ngIf="aggregation.name; else nameWithKey">
{{ aggregation.name | translate | ucfirst }}
</ng-container>
<ng-template #nameWithKey>
{{ aggregation.key | translate | ucfirst }}
</ng-template>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do something like this:

{{ (aggregation.name || aggregation.key) | translate | ucfirst }}

@@ -597,7 +599,8 @@ export class RecordSearchComponent implements OnInit, OnChanges, OnDestroy {
doc_count: aggr[key].doc_count || null,
value: { buckets: aggr[key].buckets },
type: aggr[key].type || 'terms',
config: aggr[key].config || null
config: aggr[key].config || null,
name: this._aggregationName(key)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this statement as this:

name: aggr[key].name || this._aggregationName(key)

With this, we can set the name in the backend.

Copy link
Contributor

@jma jma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message: aggregation: make the name customizable

A new parameter "aggregationsName" has been added
to the configuration to allow the customization of the aggregation name.
Supports a name property to set a custom title for an aggregation.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
@Garfield-fr Garfield-fr force-pushed the zub-aggregation-name branch from b96c723 to cfce430 Compare April 14, 2021 06:39
@Garfield-fr Garfield-fr changed the title aggregation: added the possibility to customize the name aggregation: make the name customizable Apr 14, 2021
@Garfield-fr Garfield-fr requested a review from sebdeleze April 14, 2021 06:40
@sebdeleze sebdeleze merged commit cba93bb into rero:dev Apr 14, 2021
@Garfield-fr Garfield-fr deleted the zub-aggregation-name branch April 16, 2021 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants