Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
albertoh committed Apr 12, 2024
1 parent 9ae0432 commit 8ce768c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<ng-container *ngIf="menu">
<a mat-flat-button color="primary" routerLink="actual" routerLinkActive="app-active" queryParamsHandling="preserve" [title]="'menu.actual_' | translate" (click)="isMobile ? onSidenavClose() : null">{{ 'menu.actual_' | translate }}</a>
<ng-container *ngFor="let m of menu">
<a mat-flat-button color="primary" [matMenuTriggerFor]="menu" routerLinkActive="app-active" [title]="m[state.currentLang]" *ngIf="m.visible && m.children.length > 0" queryParamsHandling="preserve" [title]="m[state.currentLang]">
{{ m[state.currentLang] }}<mat-icon iconPositionEnd>expand_more</mat-icon>
<mat-menu #menu="matMenu">
<a mat-flat-button color="primary" [matMenuTriggerFor]="menu1" routerLinkActive="app-active" [title]="m[state.currentLang]" *ngIf="m.visible && m.children.length > 0" queryParamsHandling="preserve" >
{{ m[state.currentLang] }} <mat-icon iconPositionEnd>expand_more</mat-icon>
<mat-menu #menu1="matMenu">
<a mat-menu-item [routerLink]="m.route" queryParamsHandling="preserve" [title]="m[state.currentLang]" (click)="isMobile ? onSidenavClose() : null">{{ m[state.currentLang] }}</a>
<ng-container *ngFor="let m1 of m.children">
<a mat-menu-item *ngIf="m1.visible" [routerLink]="[m.route, m1.route]" routerLinkActive="app-active" queryParamsHandling="preserve" (click)="isMobile ? onSidenavClose() : null">{{ m1[state.currentLang ]}}</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class NavbarComponent implements OnInit, OnDestroy {

subscriptions: Subscription[] = [];

currentLang: string = 'cs';
// currentLang: string = 'cs';
menu: any[] = [];

public isCollapsed: boolean = false;
Expand All @@ -45,38 +45,11 @@ export class NavbarComponent implements OnInit, OnDestroy {

ngOnInit() {
this.subscriptions.push(this.appservice.langSubject.subscribe(val => {
this.currentLang = val;
// this.currentLang = val;
}));

// this.subscriptions.push(this.state.titleChangedSubject.subscribe(val => {
// if (this.state.actualNumber) {
// this.titleService.setTitle( this.state.actualNumber['root_title']!);
// this.meta.removeTag('name=description');
// this.meta.removeTag('name=author');
// this.meta.removeTag('name=keywords');

// this.meta.addTags( [
// { name: 'description', content: this.state.currentMagazine.desc! },
// { name: 'author', content: this.state.currentMagazine.vydavatel! },
// { name: 'keywords', content: this.state.currentMagazine.keywords.join(',') }
// ]);
// }
// }));

this.menu = this.config.layout.menu;

// this.state.fullScreenSubject.subscribe(val=> {
// if(!val){
// setTimeout(()=>{
// this.menu = this.config['menu'];
// }, 100);
//
// } else {
// this.menu = {};
// }
// });
}

ngOnDestroy() {
this.subscriptions.forEach((s: Subscription) => {
s.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,19 @@
<mat-label>{{ 'menu.url' | translate }}</mat-label>
<input matInput type="text" [(ngModel)]="selected.route" name="route">
</mat-form-field>
<mat-form-field appearance="outline" class="app-fxFlex app-mr-2">
<!-- <mat-form-field appearance="outline" class="app-fxFlex app-mr-2">
<mat-label>{{ 'menu.cs' | translate }}</mat-label>
<input matInput type="text" [(ngModel)]="selected.cs" name="cs">
</mat-form-field>
<mat-form-field appearance="outline" class="app-fxFlex">
</mat-form-field> -->
<!-- <mat-form-field appearance="outline" class="app-fxFlex">
<mat-label>{{ 'menu.en' | translate }}</mat-label>
<input matInput type="text" [(ngModel)]="selected.en" name="en">
</mat-form-field> -->
</div>
<div class="app-fxLayout app-row app-fill" *ngIf="selected">
<mat-form-field *ngFor="let lang of state.currentMagazine.languages" appearance="outline" class="app-fxFlex app-mr-2">
<mat-label>{{ 'menu.name' | translate }} {{ 'magazines.lang.' + lang | translate }}</mat-label>
<input matInput type="text" [(ngModel)]="selected[lang]" [name]="'menu'+lang">
</mat-form-field>
</div>
<div class="app-editor-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ declare var tinymce: any;
interface MenuItem {
id: string,
route: string,
cs: string,
en: string,
visible: boolean,
children: MenuItem[]
children: MenuItem[],
[lang: string]: any
}


Expand Down Expand Up @@ -277,14 +276,17 @@ export class AdminInterfaceComponent {
}

addChild(m: MenuItem) {
m.children.push({
const item: MenuItem = {
id: m.route + '_' + m.children.length,
route: m.route + '_' + m.children.length + '_new',
cs: m.cs,
en: m.en,
visible: true,
children: []
})
};
this.state.currentMagazine.languages.forEach(lang => {
item[lang] = m[lang];
});
item['children'] = [];
m.children.push(item)
}

findNewMenuId() {
Expand All @@ -298,15 +300,17 @@ export class AdminInterfaceComponent {

addMenu() {
let id = this.findNewMenuId();
this.menu.push({
const item: any = {
id: id,
route: id + '_new',
cs: 'Nazev CS',
en: 'Name EN',
visible: true,
added: true,
children: []
})
}
this.state.currentMagazine.languages.forEach(lang => {
item[lang] = lang;
});
this.menu.push(item)
}

removeMenu(idx: number) {
Expand Down
5 changes: 2 additions & 3 deletions searchapp/src/main/client/src/assets/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@
},
"prihlaseni_": "Přihlášení",
"url": "Cesta v URL",
"cs": "Český název v menu",
"en": "Anglický název v menu"
"name": "Název v menu"
},
"ARCHIV STARŠÍCH ROČNÍKŮ": "ARCHIV STARŠÍCH ROČNÍKŮ",
"PROHLÍŽET CELÉ ČÍSLO": "PROHLÍŽET",
Expand Down Expand Up @@ -307,7 +306,7 @@
"lang": {
"cs": "česky",
"en": "anglicky",
"de": "nemecky"
"de": "německy"
}
},
"button": {
Expand Down
10 changes: 7 additions & 3 deletions searchapp/src/main/client/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@
},
"prihlaseni_": "Login",
"url": "Path in URL",
"cs": "Czech label in menu",
"en": "English label in menu"
"name": "Label in menu"
},
"ARCHIV STARŠÍCH ROČNÍKŮ": "ARCHIVE",
"PROHLÍŽET CELÉ ČÍSLO": "VIEW",
Expand Down Expand Up @@ -302,7 +301,12 @@
"jazyky": "Languages",
"pridat_jazyk": "Add language",
"smazat_jazyk": "Remove language",
"stranky": "Pages"
"stranky": "Pages",
"lang": {
"cs": "czech",
"en": "english",
"de": "german"
}
},
"button": {
"Yes": "Yes",
Expand Down
Binary file added searchapp/src/main/webapp/favicon.ico
Binary file not shown.

0 comments on commit 8ce768c

Please sign in to comment.