-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geocat: add geocat-header with langage switcher
- Loading branch information
Showing
8 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
apps/datahub/src/app/home/geocat-header/geocat-header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div | ||
class="px-5 mx-auto flex items-center justify-center sm:justify-end gap-6 py-1 text-sm" | ||
> | ||
<a class="block hover:underline" [href]="gnLinkGeneral" target="_blank">{{ | ||
'datahub.header.geonetwork' | translate | ||
}}</a> | ||
<a class="block hover:underline" [href]="docLink" target="_blank">{{ | ||
'datahub.header.documentation' | translate | ||
}}</a> | ||
<a class="block hover:underline" [href]="gnLinkAdmin" target="_blank">{{ | ||
'datahub.header.admin' | translate | ||
}}</a> | ||
<gn-ui-language-switcher | ||
*ngIf="showLanguageSwitcher" | ||
class="language-switcher" | ||
></gn-ui-language-switcher> | ||
</div> |
28 changes: 28 additions & 0 deletions
28
apps/datahub/src/app/home/geocat-header/geocat-header.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { GeocatHeaderComponent } from './geocat-header.component' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
|
||
jest.mock('@geonetwork-ui/util/app-config', () => ({ | ||
getGlobalConfig: jest.fn(() => ({ | ||
LANGUAGES: ['de', 'fr'], | ||
})), | ||
})) | ||
|
||
describe('GeocatHeaderComponent', () => { | ||
let component: GeocatHeaderComponent | ||
let fixture: ComponentFixture<GeocatHeaderComponent> | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [GeocatHeaderComponent], | ||
imports: [TranslateModule.forRoot()], | ||
}) | ||
fixture = TestBed.createComponent(GeocatHeaderComponent) | ||
component = fixture.componentInstance | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
34 changes: 34 additions & 0 deletions
34
apps/datahub/src/app/home/geocat-header/geocat-header.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Component } from '@angular/core' | ||
import { TranslateModule, TranslateService } from '@ngx-translate/core' | ||
import { LANG_2_TO_3_MAPPER } from '@geonetwork-ui/util/i18n' | ||
import { getGlobalConfig } from '@geonetwork-ui/util/app-config' | ||
import { LanguageSwitcherComponent } from '@geonetwork-ui/ui/catalog' | ||
import { CommonModule } from '@angular/common' | ||
|
||
@Component({ | ||
selector: 'datahub-geocat-header', | ||
templateUrl: './geocat-header.component.html', | ||
imports: [CommonModule, TranslateModule, LanguageSwitcherComponent], | ||
standalone: true, | ||
}) | ||
export class GeocatHeaderComponent { | ||
showLanguageSwitcher = getGlobalConfig().LANGUAGES?.length > 0 | ||
|
||
constructor(private translate: TranslateService) {} | ||
|
||
get docLink() { | ||
return `https://www.info.geocat.ch` | ||
} | ||
|
||
get gnLinkAdmin() { | ||
return `/geonetwork/srv/${ | ||
LANG_2_TO_3_MAPPER[this.translate.currentLang] || 'eng' | ||
}/catalog.edit#/board` | ||
} | ||
|
||
get gnLinkGeneral() { | ||
return `/geonetwork/srv/${ | ||
LANG_2_TO_3_MAPPER[this.translate.currentLang] || 'eng' | ||
}/catalog.search#/home` | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters