remove some broken automation

This commit is contained in:
Baptiste Lemoine 2020-10-21 16:45:26 +02:00
parent 6db96397ea
commit 5f072fe3ab
5 changed files with 23 additions and 49 deletions

View File

@ -28,24 +28,15 @@
<div id="navbarBasicExample" class="navbar-menu"> <div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start"> <div class="navbar-start">
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active"> <a class="navbar-item btn btn--primary" routerLink="administration" routerLinkActive="is-active">
{{ 'config.title' | translate }} <i class="fa fa-plus-circle"></i> {{ 'config.title' | translate }}
</a>
<a class="navbar-item" routerLink="user/polls" routerLinkActive="is-active">
{{ 'config.find_my_polls' | translate }}
</a> </a>
</div> </div>
<div class="navbar-end"> <div class="navbar-end">
<div class="navbar-item" #container> <a class="navbar-item btn btn-primary" routerLink="user/polls" routerLinkActive="is-active">
<div class="buttons has-addons is-centered clickable" (click)="openDialog()"> <i class="fa fa-user"></i> {{ 'config.find_my_polls' | translate }}
<button class="button is-static"><i class="fa fa-user-circle" aria-hidden="true"></i></button> </a>
<button class="button is-static" *ngIf="_user | async">
{{ (_user | async)?.pseudo || 'anonyme' }}
</button>
<button class="button is-static"><i class="fa fa-cogs" aria-hidden="true"></i></button>
</div>
</div>
</div> </div>
</div> </div>
</nav> </nav>

View File

@ -21,8 +21,4 @@ export class HeaderComponent implements OnInit {
constructor(private userService: UserService, private modalService: ModalService) {} constructor(private userService: UserService, private modalService: ModalService) {}
public ngOnInit(): void {} public ngOnInit(): void {}
public openDialog(): void {
this.modalService.openModal(SettingsComponent);
}
} }

View File

@ -20,9 +20,6 @@ export class AdministrationComponent implements OnInit, OnDestroy {
constructor(private route: ActivatedRoute, private userService: UserService, private modalService: ModalService) {} constructor(private route: ActivatedRoute, private userService: UserService, private modalService: ModalService) {}
ngOnInit(): void { ngOnInit(): void {
if (!this.userService.isCurrentUserIdentifiable()) {
this.modalService.openModal(SettingsComponent);
}
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => { this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
console.log('data', data); console.log('data', data);
if (data.poll) { if (data.poll) {

View File

@ -1,45 +1,39 @@
import {Routes} from "@angular/router"; import { Routes } from '@angular/router';
import {HomeComponent} from "./core/components/home/home.component"; import { HomeComponent } from './core/components/home/home.component';
import {PollService} from "./core/services/poll.service"; import { PollService } from './core/services/poll.service';
import {PageNotFoundComponent} from "./shared/components/page-not-found/page-not-found.component"; import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.component';
export const routes: Routes = [ export const routes: Routes = [
{ path: '', component: HomeComponent }, { path: '', component: HomeComponent },
{ {
path: 'user', path: 'user',
loadChildren: () => import('./features/user-profile/user-profile.module') loadChildren: () => import('./features/user-profile/user-profile.module').then((m) => m.UserProfileModule),
.then((m) => m.UserProfileModule),
}, },
{ {
path: 'administration', path: 'administration',
loadChildren: () => loadChildren: () =>
import('./features/administration/administration.module') import('./features/administration/administration.module').then((m) => m.AdministrationModule),
.then((m) => m.AdministrationModule), // resolve: {poll: PollService},
resolve: {poll: PollService},
}, },
{ {
path: 'poll/:slug/administration', path: 'poll/:slug/administration',
loadChildren: () => loadChildren: () =>
import('./features/administration/administration.module') import('./features/administration/administration.module').then((m) => m.AdministrationModule),
.then((m) => m.AdministrationModule),
resolve: { poll: PollService }, resolve: { poll: PollService },
}, },
{ {
path: 'poll/:slug/consultation', path: 'poll/:slug/consultation',
loadChildren: () => import('./features/consultation/consultation.module') loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
.then((m) => m.ConsultationModule),
resolve: { poll: PollService }, resolve: { poll: PollService },
}, },
{ {
path: 'poll/:slug/participation', path: 'poll/:slug/participation',
loadChildren: () => import('./features/participation/participation.module') loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule),
.then((m) => m.ParticipationModule),
resolve: { poll: PollService }, resolve: { poll: PollService },
}, },
{ {
path: 'oldstuff', path: 'oldstuff',
loadChildren: () => import('./features/old-stuff/old-stuff.module') loadChildren: () => import('./features/old-stuff/old-stuff.module').then((m) => m.OldStuffModule),
.then((m) => m.OldStuffModule),
}, },
{ path: 'page-not-found', component: PageNotFoundComponent }, { path: 'page-not-found', component: PageNotFoundComponent },
{ path: '**', redirectTo: 'page-not-found', pathMatch: 'full' }, { path: '**', redirectTo: 'page-not-found', pathMatch: 'full' },

View File

@ -16,11 +16,7 @@ export class SettingsComponent implements OnInit {
constructor(private userService: UserService, public dialogRef: MatDialogRef<SettingsComponent>) {} constructor(private userService: UserService, public dialogRef: MatDialogRef<SettingsComponent>) {}
ngOnInit(): void { ngOnInit(): void {}
this.userSubscription = this.userService.user.subscribe((user: User) => {
this.user = user;
});
}
ngOnDestroy(): void { ngOnDestroy(): void {
if (this.userSubscription) { if (this.userSubscription) {