Skip to content

Commit

Permalink
feat(keywords): Change keywords on dataset page
Browse files Browse the repository at this point in the history
to categories (first level thesaurus), change
keywords on search card to second level thesaurus
keywords
  • Loading branch information
Angi-Kinas committed May 22, 2024
1 parent 9d471b9 commit 8d20dbc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 6 additions & 0 deletions apps/datahub-e2e/src/e2e/search.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ describe('search', () => {
.find('.mel-badge-button-primary')
.should('not.contain', 'HAUTS-DE-FRANCE')
})
it('should not dislay any place keywords (which are already displayed as categories)', () => {
cy.get('mel-datahub-results-card-search')
.eq(6)
.find('.mel-badge-button-primary')
.should('not.contain', 'Administration, action publique')
})
it('should not dislay html in abstract', () => {
cy.get('mel-datahub-results-card-search')
.eq(5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
<span class="font-semibold" translate="">mel.dataset.updatedOn</span>
<div class="text-primary font-semibold">{{ lastUpdate }}</div>
</div>
} @if(record.topics?.length) {
} @if(displayCategories?.length) {
<div class="flex flex-col gap-2">
<span class="font-semibold" translate="">mel.dataset.categories</span>
<div class="flex gap-1 gap-x-2 flex-row flex-wrap">
@for(topic of record.topics; track $index) {
@for(topic of displayCategories; track $index) {
<span class="mel-badge-primary truncate">
{{ topic }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@ export class DatasetInformationComponent {
get territories() {
return this.record?.keywords?.filter((keyword) => keyword.type === 'place')
}

get displayCategories() {
const categoryKeywords = this.record?.keywords?.filter(
(keyword) => keyword.thesaurus?.name === 'Catégories'
)

return categoryKeywords?.map((keyword) => keyword.label)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export class ResultsListItemComponent {
}

get keywords() {
return this.record?.keywords?.filter((keyword) => keyword.type !== 'place')
return this.record?.keywords?.filter(
(keyword) =>
keyword.type !== 'place' && keyword.thesaurus?.name !== 'Catégories'
)
}

onKeywordClick(keyword: Keyword, event: Event) {
Expand Down

0 comments on commit 8d20dbc

Please sign in to comment.