Commit 112fa541 authored by Florent Poittevin's avatar Florent Poittevin
Browse files

chore: reformat code with new style

parent 86572e12
......@@ -8,7 +8,8 @@
(languageChange)="useLanguage($event)"
(navigateChange)="navigate($event)"
(logoutChange)="logout()"
(themeChange)="themeChange($event)">
(themeChange)="themeChange($event)"
>
</dlcm-main-toolbar-desktop-horizontal>
<dlcm-main-toolbar-desktop-vertical [logged]="isLoggedObs | async"
......@@ -19,7 +20,8 @@
(languageChange)="useLanguage($event)"
(navigateChange)="navigate($event)"
(logoutChange)="logout()"
(themeChange)="themeChange($event)">
(themeChange)="themeChange($event)"
>
</dlcm-main-toolbar-desktop-vertical>
<dlcm-main-toolbar-mobile [logged]="isLoggedObs | async"
......@@ -30,19 +32,26 @@
(languageChange)="useLanguage($event)"
(navigateChange)="navigate($event)"
(logoutChange)="logout()"
(themeChange)="themeChange($event)">
(themeChange)="themeChange($event)"
>
</dlcm-main-toolbar-mobile>
</div>
<div class="body">
<div class="instance-logo-wrapper"
(click)="navigateToHome()">
<img [src]="logo" alt="toolbar-header-image" class="instance-logo">
(click)="navigateToHome()"
>
<img [src]="logo"
alt="toolbar-header-image"
class="instance-logo"
>
</div>
<dlcm-shared-breadcrumb (navigateChange)="navigate($event)"></dlcm-shared-breadcrumb>
<main class="content mat-typography">
<ng-template [ngIf]="isApplicationInitializedObs | async" [ngIfElse]="loadingApp">
<ng-template [ngIf]="isApplicationInitializedObs | async"
[ngIfElse]="loadingApp"
>
<router-outlet></router-outlet>
</ng-template>
<ng-template #loadingApp>
......
import {async, TestBed} from "@angular/core/testing";
import {
async,
TestBed,
} from "@angular/core/testing";
import {RouterTestingModule} from "@angular/router/testing";
import {AppModule} from "@app/app.module";
import {AppState} from "@app/stores/app.state";
......
import {DOCUMENT} from "@angular/common";
import {Component, Inject, Renderer2} from "@angular/core";
import {Router, RouterStateSnapshot} from "@angular/router";
import {
Component,
Inject,
Renderer2,
} from "@angular/core";
import {
Router,
RouterStateSnapshot,
} from "@angular/router";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {ApplicationRoleEnum} from "@app/shared/enums/application-role.enum";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {RoutesEnum, urlSeparator} from "@app/shared/enums/routes.enum";
import {
RoutesEnum,
urlSeparator,
} from "@app/shared/enums/routes.enum";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {LocalStateModel} from "@app/shared/models/local-state.model";
import {ChangeAppLanguage, ChangeAppTheme, InitApplication, Logout} from "@app/stores/app.action";
import {
ChangeAppLanguage,
ChangeAppTheme,
InitApplication,
Logout,
} from "@app/stores/app.action";
import {TranslateService} from "@ngx-translate/core";
import {Navigate} from "@ngxs/router-plugin";
import {Select, Store} from "@ngxs/store";
import {
Select,
Store,
} from "@ngxs/store";
import {Observable} from "rxjs";
import {tap} from "rxjs/internal/operators/tap";
import {OAuth2Service} from "solidify-frontend";
......
import {HTTP_INTERCEPTORS, HttpClient, HttpClientModule} from "@angular/common/http";
import {APP_INITIALIZER, ErrorHandler, NgModule} from "@angular/core";
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatPaginatorIntl, MatSnackBar} from "@angular/material";
import {MAT_MOMENT_DATE_ADAPTER_OPTIONS, MAT_MOMENT_DATE_FORMATS, MomentDateAdapter} from "@angular/material-moment-adapter";
import {
HTTP_INTERCEPTORS,
HttpClient,
HttpClientModule,
} from "@angular/common/http";
import {
APP_INITIALIZER,
ErrorHandler,
NgModule,
} from "@angular/core";
import {
DateAdapter,
MAT_DATE_FORMATS,
MAT_DATE_LOCALE,
MatPaginatorIntl,
MatSnackBar,
} from "@angular/material";
import {
MAT_MOMENT_DATE_ADAPTER_OPTIONS,
MAT_MOMENT_DATE_FORMATS,
MomentDateAdapter,
} from "@angular/material-moment-adapter";
import {BrowserModule} from "@angular/platform-browser";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AppRoutingModule} from "@app/app-routing.module";
......@@ -11,13 +29,22 @@ import {ThemeSelectorPresentational} from "@app/components/presentationals/theme
import {DlcmErrorsHandlerService} from "@app/shared/services/dlcm-errors-handler.service";
import {SharedModule} from "@app/shared/shared.module";
import {AppState} from "@app/stores/app.state";
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
import {
TranslateLoader,
TranslateModule,
} from "@ngx-translate/core";
import {TranslateHttpLoader} from "@ngx-translate/http-loader";
import {NgxsReduxDevtoolsPluginModule} from "@ngxs/devtools-plugin";
import {NgxsLoggerPluginModule} from "@ngxs/logger-plugin";
import {NgxsRouterPluginModule} from "@ngxs/router-plugin";
import {NgxsModule} from "@ngxs/store";
import {AppConfigService, ENVIRONMENT, OAuth2Interceptor, OAuthStorage, SNACK_BAR} from "solidify-frontend";
import {
AppConfigService,
ENVIRONMENT,
OAuth2Interceptor,
OAuthStorage,
SNACK_BAR,
} from "solidify-frontend";
import {environment} from "../environments/environment";
import {AppComponent} from "./app.component";
import {FooterPresentational} from "./components/presentationals/footer/footer.presentational";
......
<div class="footer">
<div class="copyrights">All rights reserved by <a href="https://dlcm.ch/" target="_blank">DLCM</a> and the <a href="https://www.unige.ch/" target="_blank">University
of Geneva</a></div>
<div class="copyrights">All rights reserved by <a href="https://dlcm.ch/"
target="_blank"
>DLCM</a> and the <a href="https://www.unige.ch/"
target="_blank"
>University
of Geneva</a></div>
<fa-icon class="version"
icon="code-branch"
[matTooltip]="appUtil.getVersions()"
......
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {
async,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import {MatSnackBar} from "@angular/material";
import {NoopAnimationsModule} from "@angular/platform-browser/animations";
import {SharedModule} from "@app/shared/shared.module";
import {AppState} from "@app/stores/app.state";
import {TranslatePipe, TranslateService} from "@ngx-translate/core";
import {
TranslatePipe,
TranslateService,
} from "@ngx-translate/core";
import {NgxsModule} from "@ngxs/store";
import {ENVIRONMENT, SNACK_BAR} from "solidify-frontend";
import {
ENVIRONMENT,
SNACK_BAR,
} from "solidify-frontend";
import {environment} from "../../../../environments/environment";
import {MockTranslatePipe} from "../../../../test-helpers/mock-translate.pipe";
import {MockTranslateService} from "../../../../test-helpers/mock-translate.service";
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {
ChangeDetectionStrategy,
Component,
} from "@angular/core";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {AppUtil} from "@app/shared/utils/app.util";
......
<a (click)="useLanguage(languagesEnum.fr)" [class.is-active]="currentLanguage === languagesEnum.fr">fr</a>
<a (click)="useLanguage(languagesEnum.fr)"
[class.is-active]="currentLanguage === languagesEnum.fr"
>fr</a>
<span class="separator"> | </span>
<a (click)="useLanguage(languagesEnum.de)" [class.is-active]="currentLanguage === languagesEnum.de">de</a>
<a (click)="useLanguage(languagesEnum.de)"
[class.is-active]="currentLanguage === languagesEnum.de"
>de</a>
<span class="separator"> | </span>
<a (click)="useLanguage(languagesEnum.en)" [class.is-active]="currentLanguage === languagesEnum.en">en</a>
<a (click)="useLanguage(languagesEnum.en)"
[class.is-active]="currentLanguage === languagesEnum.en"
>en</a>
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
import {
async,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import { LanguageSelectorPresentational } from "./language-selector.presentational";
import {LanguageSelectorPresentational} from "./language-selector.presentational";
describe("LanguageSelectorPresentational", () => {
let component: LanguageSelectorPresentational;
......@@ -8,9 +12,9 @@ describe("LanguageSelectorPresentational", () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LanguageSelectorPresentational ]
declarations: [LanguageSelectorPresentational],
})
.compileComponents();
.compileComponents();
}));
beforeEach(() => {
......
import {ChangeDetectionStrategy, Component, Input, Output} from "@angular/core";
import {
ChangeDetectionStrategy,
Component,
Input,
Output,
} from "@angular/core";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {BehaviorSubject, Observable} from "rxjs";
import {
BehaviorSubject,
Observable,
} from "rxjs";
import {ObservableUtil} from "solidify-frontend";
@Component({
......
import {Input, Output} from "@angular/core";
import {
Input,
Output,
} from "@angular/core";
import {SharedAbstractPresentational} from "@app/shared/components/presentationals/shared-abstract/shared-abstract.presentational";
import {ApplicationRolePermissionEnum} from "@app/shared/enums/application-role-permission.enum";
import {ApplicationRoleEnum} from "@app/shared/enums/application-role.enum";
......@@ -6,15 +9,21 @@ import {LanguagesEnum} from "@app/shared/enums/languages.enum";
import {RoutesEnum} from "@app/shared/enums/routes.enum";
import {ThemeEnum} from "@app/shared/enums/theme.enum";
import {PermissionUtil} from "@app/shared/utils/permission.util";
import {BehaviorSubject, Observable} from "rxjs";
import {OAuth2Service, ObservableUtil, TRANSLATE} from "solidify-frontend";
import {
BehaviorSubject,
Observable,
} from "rxjs";
import {
OAuth2Service,
ObservableUtil,
TRANSLATE,
} from "solidify-frontend";
import {environment} from "../../../../../environments/environment";
export abstract class AbstractMainToolbarPresentational extends SharedAbstractPresentational {
@Input()
logged: boolean = false;
@Input()
currentPath: string;
......
......@@ -2,8 +2,13 @@
<div class="toolbar">
<div class="logo-wrapper">
<div class="logo">
<a [href]="institutionUrl" target="_blank">
<img src="assets/images/unigelogo-white.svg" alt="Unige" class="unige-logo">
<a [href]="institutionUrl"
target="_blank"
>
<img src="assets/images/unigelogo-white.svg"
alt="Unige"
class="unige-logo"
>
</a>
</div>
</div>
......@@ -14,25 +19,31 @@
(click)="navigate(menu.path)"
[class.is-active]="currentPath == menu.path"
[matTooltip]="menu.labelToTranslate | translate"
[matTooltipPosition]="'right'">
[matTooltipPosition]="'right'"
>
<fa-icon [icon]="menu.icon"></fa-icon>
</li>
</ul>
<dlcm-language-selector [currentLanguage]="currentLanguage"
(languageChange)="useLanguage($event)">
(languageChange)="useLanguage($event)"
>
</dlcm-language-selector>
<dlcm-theme-selector *ngIf="!isProduction"
[(theme)]="theme">
[(theme)]="theme"
>
</dlcm-theme-selector>
<ul class="menu">
<ng-template [ngIf]="!logged" [ngIfElse]="loggedOut">
<ng-template [ngIf]="!logged"
[ngIfElse]="loggedOut"
>
<li class="login"
[matTooltip]="'app.toolbar.login' | translate"
[matTooltipPosition]="'right'"
(click)="login()">
(click)="login()"
>
<fa-icon icon="sign-in-alt"></fa-icon>
</li>
</ng-template>
......@@ -41,7 +52,8 @@
<li class="logout"
[matTooltip]="'app.toolbar.logout' | translate"
[matTooltipPosition]="'right'"
(click)="logout()">
(click)="logout()"
>
<fa-icon icon="sign-out-alt"></fa-icon>
</li>
</ng-template>
......
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {NO_ERRORS_SCHEMA} from "@angular/core";
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {
async,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import {MatSnackBar} from "@angular/material";
import {LanguageSelectorPresentational} from "@app/components/presentationals/language-selector/language-selector.presentational";
import {MainToolbarDesktopHorizontalPresentational} from "@app/components/presentationals/main-toolbar/main-toolbar-desktop/main-toolbar-desktop-horizontal-presentational.component";
import {ENVIRONMENT, SNACK_BAR} from "solidify-frontend";
import {
ENVIRONMENT,
SNACK_BAR,
} from "solidify-frontend";
import {environment} from "../../../../../environments/environment";
import {MockTranslatePipe} from "../../../../../test-helpers/mock-translate.pipe";
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {
ChangeDetectionStrategy,
Component,
} from "@angular/core";
import {AbstractMainToolbarPresentational} from "@app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational";
import {OAuth2Service} from "solidify-frontend";
......
<div class="toolbar">
<div class="logo">
<a [href]="institutionUrl" target="_blank">
<img src="assets/images/unigelogo-white.svg" alt="Unige" class="unige-logo">
<a [href]="institutionUrl"
target="_blank"
>
<img src="assets/images/unigelogo-white.svg"
alt="Unige"
class="unige-logo"
>
</a>
</div>
<dlcm-theme-selector *ngIf="!isProduction"
[(theme)]="theme">
[(theme)]="theme"
>
</dlcm-theme-selector>
<div class="right-part">
<div class="menu">
<span *ngFor="let menu of getListMenu()">
<a (click)="navigate(menu.path)"
[class.is-active]="currentPath == menu.path">{{menu.labelToTranslate | translate}}</a>
[class.is-active]="currentPath == menu.path"
>{{menu.labelToTranslate | translate}}</a>
</span>
</div>
<dlcm-language-selector [currentLanguage]="currentLanguage"
(languageChange)="useLanguage($event)">
(languageChange)="useLanguage($event)"
>
</dlcm-language-selector>
<ng-template [ngIf]="!logged" [ngIfElse]="loggedOut">
<ng-template [ngIf]="!logged"
[ngIfElse]="loggedOut"
>
<div class="login">
<a (click)="login()">{{'app.toolbar.login' | translate }}</a>
</div>
......
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {NO_ERRORS_SCHEMA} from "@angular/core";
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {
async,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import {MatSnackBar} from "@angular/material";
import {LanguageSelectorPresentational} from "@app/components/presentationals/language-selector/language-selector.presentational";
import {ENVIRONMENT, SNACK_BAR} from "solidify-frontend";
import {
ENVIRONMENT,
SNACK_BAR,
} from "solidify-frontend";
import {environment} from "../../../../../environments/environment";
import {MockTranslatePipe} from "../../../../../test-helpers/mock-translate.pipe";
......@@ -27,7 +34,7 @@ describe("MainToolbarDesktopHorizontalPresentational", () => {
provide: SNACK_BAR,
useClass: MatSnackBar,
},
]
],
})
.compileComponents();
}));
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {
ChangeDetectionStrategy,
Component,
} from "@angular/core";
import {AbstractMainToolbarPresentational} from "@app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational";
import {OAuth2Service} from "solidify-frontend";
......
<div class="toolbar">
<div class="burger-button"
[class.is-active]="isOpen"
(click)="toggleMenu()">
<fa-icon matSuffix icon="bars"></fa-icon>
(click)="toggleMenu()"
>
<fa-icon matSuffix
icon="bars"
></fa-icon>
</div>
<div class="logo">
<img src="assets/images/unigelogo-white.svg" alt="Unige" class="unige-logo">
<img src="assets/images/unigelogo-white.svg"
alt="Unige"
class="unige-logo"
>
</div>
</div>
<div class="menu"
*ngIf="isOpen">
*ngIf="isOpen"
>
<ul>
<li *ngFor="let menu of getListMenu()"
(click)="navigate(menu.path)"
[class.is-active]="currentPath == menu.path">
[class.is-active]="currentPath == menu.path"
>
{{menu.labelToTranslate | translate}}
</li>
<li>
<dlcm-language-selector [currentLanguage]="currentLanguage"
(languageChange)="useLanguage($event)">
(languageChange)="useLanguage($event)"
>
</dlcm-language-selector>
</li>
<ng-template [ngIf]="!logged" [ngIfElse]="loggedOut">
<ng-template [ngIf]="!logged"
[ngIfElse]="loggedOut"
>
<li class="login">
<a (click)="login()">{{'app.toolbar.login' | translate }}</a>
</li>
......@@ -37,7 +48,8 @@
</ng-template>
<li *ngIf="!isProduction"
class="theme-selector no-clickable">
class="theme-selector no-clickable"
>
<dlcm-theme-selector [(theme)]="theme">
</dlcm-theme-selector>
</li>
......
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {NO_ERRORS_SCHEMA} from "@angular/core";
import {async, ComponentFixture, TestBed} from "@angular/core/testing";
import {
async,
ComponentFixture,
TestBed,
} from "@angular/core/testing";
import {MatSnackBar} from "@angular/material";
import {LanguageSelectorPresentational} from "@app/components/presentationals/language-selector/language-selector.presentational";
import {FontAwesomeModule} from "@fortawesome/angular-fontawesome";
import {ENVIRONMENT, SNACK_BAR} from "solidify-frontend";
import {
ENVIRONMENT,
SNACK_BAR,
} from "solidify-frontend";
import {environment} from "../../../../../environments/environment";
import {MockTranslatePipe} from "../../../../../test-helpers/mock-translate.pipe";
import {MainToolbarMobilePresentational} from "./main-toolbar-mobile.presentational";
......
import {ChangeDetectionStrategy, Component} from "@angular/core";
import {
ChangeDetectionStrategy,
Component,
} from "@angular/core";
import {AbstractMainToolbarPresentational} from "@app/components/presentationals/main-toolbar/abstract-main-toolbar/abstract-main-toolbar.presentational";
import {AppUtil} from "@app/shared/utils/app.util";
import {OAuth2Service} from "solidify-frontend";
......