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

Fix #106

parent 4b06e6e4
No related branches found
No related tags found
No related merge requests found
...@@ -14,13 +14,20 @@ ...@@ -14,13 +14,20 @@
<!-- calculators list as a dropdown menu--> <!-- calculators list as a dropdown menu-->
<div [hidden]="tabsFitInNavbar"> <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"> <button *ngIf="currentCalc" mat-button [matMenuTriggerFor]="menu" color="primary" class="calculators-menu-title">
<mat-icon class="dropdown-icon">arrow_drop_down</mat-icon> <mat-icon class="dropdown-icon">arrow_drop_down</mat-icon>
<span class="calc-name"> <span class="calc-name">
{{ currentCalc.title }} {{ currentCalc.title }}
</span> </span>
<span class="calc-type" [innerHTML]="'( ' + currentCalc ? currentCalc.type : '' + ' )'"></span> <span class="calc-type" [innerHTML]="'( ' + currentCalc ? currentCalc.type : '' + ' )'"></span>
</button> </button>
<mat-menu #menu="matMenu" colo="accent"> <mat-menu #menu="matMenu" colo="accent">
<button mat-button *ngFor="let c of calculators" class="calculator-menu-item" [title]="c.title" <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" [routerLink]="['/calculator/',c.uid]" [color]="c.active ? 'primary' : ''" [class.active]="c.active"
......
import { Component, ApplicationRef, OnInit, OnDestroy, HostListener, ViewChild, ComponentRef } from "@angular/core"; 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"; import { Observer, jalhydDateRev } from "jalhyd";
...@@ -88,6 +88,16 @@ export class AppComponent implements OnInit, OnDestroy, Observer { ...@@ -88,6 +88,16 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
if (event instanceof NavigationEnd) { if (event instanceof NavigationEnd) {
this.sidenav.close(); 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 { ...@@ -134,6 +144,10 @@ export class AppComponent implements OnInit, OnDestroy, Observer {
return this.intlService.localizeText("INFO_MENU_HELP_TITLE"); return this.intlService.localizeText("INFO_MENU_HELP_TITLE");
} }
public get uitextSelectCalc() {
return this.intlService.localizeText("INFO_MENU_SELECT_CALC");
}
public get calculators() { public get calculators() {
return this._calculators; return this._calculators;
} }
......
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
"INFO_MENU_HELP_TITLE": "Help", "INFO_MENU_HELP_TITLE": "Help",
"INFO_MENU_LOAD_SESSION_TITLE": "Load session", "INFO_MENU_LOAD_SESSION_TITLE": "Load session",
"INFO_MENU_SAVE_SESSION_TITLE": "Save session", "INFO_MENU_SAVE_SESSION_TITLE": "Save session",
"INFO_MENU_SELECT_CALC": "Select calculator module",
"INFO_MENU_EMPTY_SESSION_TITLE": "New session", "INFO_MENU_EMPTY_SESSION_TITLE": "New session",
"INFO_MENU_NOUVELLE_CALC": "New calculator", "INFO_MENU_NOUVELLE_CALC": "New calculator",
"INFO_OPTION_NO": "No", "INFO_OPTION_NO": "No",
......
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
"INFO_MENU_HELP_TITLE": "Aide", "INFO_MENU_HELP_TITLE": "Aide",
"INFO_MENU_LOAD_SESSION_TITLE": "Charger une session", "INFO_MENU_LOAD_SESSION_TITLE": "Charger une session",
"INFO_MENU_SAVE_SESSION_TITLE": "Enregistrer la 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_EMPTY_SESSION_TITLE": "Nouvelle session",
"INFO_MENU_NOUVELLE_CALC": "Nouveau module de calcul", "INFO_MENU_NOUVELLE_CALC": "Nouveau module de calcul",
"INFO_OPTION_NO": "Non", "INFO_OPTION_NO": "Non",
......
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