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 class="navbar-start">
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
{{ 'config.title' | translate }}
</a>
<a class="navbar-item" routerLink="user/polls" routerLinkActive="is-active">
{{ 'config.find_my_polls' | translate }}
<a class="navbar-item btn btn--primary" routerLink="administration" routerLinkActive="is-active">
<i class="fa fa-plus-circle"></i> {{ 'config.title' | translate }}
</a>
</div>
<div class="navbar-end">
<div class="navbar-item" #container>
<div class="buttons has-addons is-centered clickable" (click)="openDialog()">
<button class="button is-static"><i class="fa fa-user-circle" aria-hidden="true"></i></button>
<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>
<a class="navbar-item btn btn-primary" routerLink="user/polls" routerLinkActive="is-active">
<i class="fa fa-user"></i> {{ 'config.find_my_polls' | translate }}
</a>
</div>
</div>
</nav>

View File

@ -21,8 +21,4 @@ export class HeaderComponent implements OnInit {
constructor(private userService: UserService, private modalService: ModalService) {}
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) {}
ngOnInit(): void {
if (!this.userService.isCurrentUserIdentifiable()) {
this.modalService.openModal(SettingsComponent);
}
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
console.log('data', data);
if (data.poll) {

View File

@ -1,46 +1,40 @@
import {Routes} from "@angular/router";
import {HomeComponent} from "./core/components/home/home.component";
import {PollService} from "./core/services/poll.service";
import {PageNotFoundComponent} from "./shared/components/page-not-found/page-not-found.component";
import { Routes } from '@angular/router';
import { HomeComponent } from './core/components/home/home.component';
import { PollService } from './core/services/poll.service';
import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.component';
export const routes: Routes = [
{path: '', component: HomeComponent},
{ path: '', component: HomeComponent },
{
path: 'user',
loadChildren: () => import('./features/user-profile/user-profile.module')
.then((m) => m.UserProfileModule),
loadChildren: () => import('./features/user-profile/user-profile.module').then((m) => m.UserProfileModule),
},
{
path: 'administration',
loadChildren: () =>
import('./features/administration/administration.module')
.then((m) => m.AdministrationModule),
resolve: {poll: PollService},
import('./features/administration/administration.module').then((m) => m.AdministrationModule),
// resolve: {poll: PollService},
},
{
path: 'poll/:slug/administration',
loadChildren: () =>
import('./features/administration/administration.module')
.then((m) => m.AdministrationModule),
resolve: {poll: PollService},
import('./features/administration/administration.module').then((m) => m.AdministrationModule),
resolve: { poll: PollService },
},
{
path: 'poll/:slug/consultation',
loadChildren: () => import('./features/consultation/consultation.module')
.then((m) => m.ConsultationModule),
resolve: {poll: PollService},
loadChildren: () => import('./features/consultation/consultation.module').then((m) => m.ConsultationModule),
resolve: { poll: PollService },
},
{
path: 'poll/:slug/participation',
loadChildren: () => import('./features/participation/participation.module')
.then((m) => m.ParticipationModule),
resolve: {poll: PollService},
loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule),
resolve: { poll: PollService },
},
{
path: 'oldstuff',
loadChildren: () => import('./features/old-stuff/old-stuff.module')
.then((m) => m.OldStuffModule),
loadChildren: () => import('./features/old-stuff/old-stuff.module').then((m) => m.OldStuffModule),
},
{path: 'page-not-found', component: PageNotFoundComponent},
{path: '**', redirectTo: 'page-not-found', pathMatch: 'full'},
{ path: 'page-not-found', component: PageNotFoundComponent },
{ 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>) {}
ngOnInit(): void {
this.userSubscription = this.userService.user.subscribe((user: User) => {
this.user = user;
});
}
ngOnInit(): void {}
ngOnDestroy(): void {
if (this.userSubscription) {