-
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.
feat: add geocat-header with langage switcher
- Loading branch information
Showing
7 changed files
with
68 additions
and
4 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
16 changes: 16 additions & 0 deletions
16
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,16 @@ | ||
<div class="px-5"> | ||
<div | ||
class="mx-auto flex items-center justify-center sm:justify-end gap-2 py-1 text-sm" | ||
> | ||
<a class="block hover:underline mr-4" [href]="docLink" target="_blank">{{ | ||
'datahub.header.documentation' | translate | ||
}}</a> | ||
<a class="block hover:underline" [href]="gnLink" target="_blank">{{ | ||
'datahub.header.admin' | translate | ||
}}</a> | ||
<gn-ui-language-switcher | ||
*ngIf="showLanguageSwitcher" | ||
class="language-switcher" | ||
></gn-ui-language-switcher> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { GeocatHeaderComponent } from './geocat-header.component'; | ||
|
||
describe('GeocatHeaderComponent', () => { | ||
let component: GeocatHeaderComponent; | ||
let fixture: ComponentFixture<GeocatHeaderComponent>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [GeocatHeaderComponent] | ||
}); | ||
fixture = TestBed.createComponent(GeocatHeaderComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
26 changes: 26 additions & 0 deletions
26
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,26 @@ | ||
import { Component } from '@angular/core' | ||
import { TranslateService } from '@ngx-translate/core' | ||
import { LANG_2_TO_3_MAPPER } from '@geonetwork-ui/util/i18n' | ||
import { getGlobalConfig } from '@geonetwork-ui/util/app-config' | ||
|
||
@Component({ | ||
selector: 'datahub-geocat-header', | ||
templateUrl: './geocat-header.component.html', | ||
}) | ||
export class GeocatHeaderComponent { | ||
showLanguageSwitcher = getGlobalConfig().LANGUAGES?.length > 0 | ||
|
||
constructor(private translate: TranslateService) {} | ||
|
||
get docLink() { | ||
return `https://www.geocat.admin.ch/${ | ||
this.translate.currentLang || 'en' | ||
}/home.html` | ||
} | ||
|
||
get gnLink() { | ||
return `/geonetwork/srv/${ | ||
LANG_2_TO_3_MAPPER[this.translate.currentLang] || 'eng' | ||
}/catalog.edit#/board` | ||
} | ||
} |
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