Skip to content
Snippets Groups Projects
Commit a64fa36b authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #106

parent 318fc1eb
No related branches found
No related tags found
1 merge request!29Resolve "Remplacer mdbootstrap par angular-material"
......@@ -14,13 +14,20 @@
<!-- calculators list as a dropdown menu-->
<div [hidden]="tabsFitInNavbar">
<button *ngIf="! currentCalc" mat-button [matMenuTriggerFor]="menu" color="primary" class="calculators-menu-title">
<mat-icon class="dropdown-icon">arrow_drop_down</mat-icon>
<span class="calc-name">
{{ uitextSelectCalc }}
</span>
</button>
<button *ngIf="currentCalc" mat-button [matMenuTriggerFor]="menu" color="primary" class="calculators-menu-title">
<mat-icon class="dropdown-icon">arrow_drop_down</mat-icon>
<span class="calc-name">
{{ currentCalc.title }}
{{ currentCalc.title }}
</span>
<span class="calc-type" [innerHTML]="'( ' + currentCalc ? currentCalc.type : '' + ' )'"></span>
</button>
<mat-menu #menu="matMenu" colo="accent">
<button mat-button *ngFor="let c of calculators" class="calculator-menu-item" [title]="c.title"
[routerLink]="['/calculator/',c.uid]" [color]="c.active ? 'primary' : ''" [class.active]="c.active"
......
import { Component, ApplicationRef, OnInit, OnDestroy, HostListener, ViewChild, ComponentRef } from "@angular/core";
import { Router, Event, NavigationEnd } from "@angular/router";
import { Router, Event, NavigationEnd, ActivationEnd } from "@angular/router";
import { Observer, jalhydDateRev } from "jalhyd";
......@@ -88,6 +88,16 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
if (event instanceof NavigationEnd) {
this.sidenav.close();
}
// [de]activate calc tabs depending on loaded route
if (event instanceof ActivationEnd) {
const path = event.snapshot.url[0].path;
if (path === "calculator") {
const calcUid = event.snapshot.params.uid;
this.setActiveCalc(calcUid);
} else {
this.setActiveCalc(null);
}
}
});
}
......@@ -134,6 +144,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
return this.intlService.localizeText("INFO_MENU_HELP_TITLE");
}
public get uitextSelectCalc() {
return this.intlService.localizeText("INFO_MENU_SELECT_CALC");
}
public get calculators() {
return this._calculators;
}
......
......@@ -115,6 +115,7 @@
"INFO_MENU_LOAD_SESSION_TITLE": "Load session",
"INFO_MENU_NOUVELLE_CALC": "New calculation module",
"INFO_MENU_SAVE_SESSION_TITLE": "Save session",
"INFO_MENU_SELECT_CALC": "Select calculator module",
"INFO_MENU_EMPTY_SESSION_TITLE": "New session",
"INFO_OPTION_NO": "No",
"INFO_OPTION_YES": "Yes",
......
......@@ -110,6 +110,7 @@
"INFO_MENU_HELP_TITLE": "Aide",
"INFO_MENU_LOAD_SESSION_TITLE": "Charger une session",
"INFO_MENU_SAVE_SESSION_TITLE": "Enregistrer la session",
"INFO_MENU_SELECT_CALC": "Choisir un module de calcul",
"INFO_MENU_EMPTY_SESSION_TITLE": "Nouvelle session",
"INFO_MENU_NOUVELLE_CALC": "Nouveau module de calcul",
"INFO_MACRORUGO_TITRE": "Passe à macro-rugosité",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment