Browse Source

hop

develop
Baptiste Lemoine 2 years ago
parent
commit
6db96397ea
  1. 25
      src/app/app.component.ts
  2. 2
      src/app/core/components/header/header.component.html
  3. 9
      src/app/core/services/poll.service.ts
  4. 6
      src/app/features/administration/administration-routing.module.ts
  5. 4
      src/app/features/administration/administration.component.html
  6. 2
      src/app/features/administration/administration.component.ts
  7. 3
      src/app/features/administration/administration.module.ts
  8. 1
      src/app/features/administration/naming/naming.component.html
  9. 0
      src/app/features/administration/naming/naming.component.scss
  10. 24
      src/app/features/administration/naming/naming.component.spec.ts
  11. 12
      src/app/features/administration/naming/naming.component.ts
  12. 34
      src/app/features/administration/stepper/stepper.component.html
  13. 2
      src/environments/environment.ts

25
src/app/app.component.ts

@ -1,12 +1,12 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {Subscription} from 'rxjs';
import { Component, OnDestroy, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Subscription } from 'rxjs';
import {environment} from '../environments/environment';
import {Theme} from './core/enums/theme.enum';
import {LanguageService} from './core/services/language.service';
import {ThemeService} from './core/services/theme.service';
import {MockingService} from './core/services/mocking.service';
import { environment } from '../environments/environment';
import { Theme } from './core/enums/theme.enum';
import { LanguageService } from './core/services/language.service';
import { ThemeService } from './core/services/theme.service';
import { MockingService } from './core/services/mocking.service';
@Component({
selector: 'app-root',
@ -23,16 +23,15 @@ export class AppComponent implements OnInit, OnDestroy {
constructor(
private titleService: Title,
private themeService: ThemeService,
private languageService: LanguageService,
private mockingService: MockingService
) {
}
private languageService: LanguageService
) // private mockingService: MockingService
{}
ngOnInit(): void {
if (!environment.production) {
this.appTitle += ' [DEV]';
// TODO: to be removed
this.mockingService.init();
// this.mockingService.init();
}
this.titleService.setTitle(this.appTitle);
this.languageService.configureAndInitTranslations();

2
src/app/core/components/header/header.component.html

@ -28,7 +28,7 @@
<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item" routerLink="/administration" routerLinkActive="is-active">
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
{{ 'config.title' | translate }}
</a>
<a class="navbar-item" routerLink="user/polls" routerLinkActive="is-active">

9
src/app/core/services/poll.service.ts

@ -47,9 +47,12 @@ export class PollService implements Resolve<Poll> {
}
public async loadPollBySlug(slug: string): Promise<void> {
const poll: Poll | undefined = await this.apiService.getPollBySlug(slug);
console.log({ loadPollBySlugResponse: poll });
this.updateCurrentPoll(poll);
console.log('slug', slug);
if (slug) {
const poll: Poll | undefined = await this.apiService.getPollBySlug(slug);
console.log({ loadPollBySlugResponse: poll });
this.updateCurrentPoll(poll);
}
}
public updateCurrentPoll(poll: Poll): void {

6
src/app/features/administration/administration-routing.module.ts

@ -2,8 +2,12 @@ import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AdministrationComponent } from './administration.component';
import { NamingComponent } from './naming/naming.component';
const routes: Routes = [{ path: '', component: AdministrationComponent }];
const routes: Routes = [
{ path: '', component: AdministrationComponent },
{ path: 'naming', component: NamingComponent },
];
@NgModule({
imports: [RouterModule.forChild(routes)],

4
src/app/features/administration/administration.component.html

@ -6,6 +6,8 @@
<div class="columns">
<div class="column">
<!-- <app-stepper [poll]="poll"></app-stepper>-->
<app-stepper [poll]="poll"></app-stepper>
<h1>Administration de sondage</h1>
<h1 class="title is-1"><i class="fa fa-calendar" aria-hidden="true"></i> {{ 'dates.title' | translate }}</h1>
</div>
</div>

2
src/app/features/administration/administration.component.ts

@ -14,6 +14,7 @@ import { SettingsComponent } from '../../shared/components/settings/settings.com
})
export class AdministrationComponent implements OnInit, OnDestroy {
public poll: Poll;
public form: Object;
private routeSubscription: Subscription;
constructor(private route: ActivatedRoute, private userService: UserService, private modalService: ModalService) {}
@ -23,6 +24,7 @@ export class AdministrationComponent implements OnInit, OnDestroy {
this.modalService.openModal(SettingsComponent);
}
this.routeSubscription = this.route.data.subscribe((data: { poll: Poll }) => {
console.log('data', data);
if (data.poll) {
this.poll = data.poll;
}

3
src/app/features/administration/administration.module.ts

@ -7,9 +7,10 @@ import { SharedModule } from '../../shared/shared.module';
import { AdministrationRoutingModule } from './administration-routing.module';
import { AdministrationComponent } from './administration.component';
import { StepperComponent } from './stepper/stepper.component';
import { NamingComponent } from './naming/naming.component';
@NgModule({
declarations: [AdministrationComponent, StepperComponent],
declarations: [AdministrationComponent, StepperComponent, NamingComponent],
imports: [
AdministrationRoutingModule,
CommonModule,

1
src/app/features/administration/naming/naming.component.html

@ -0,0 +1 @@
<p>naming works!</p>

0
src/app/features/administration/naming/naming.component.scss

24
src/app/features/administration/naming/naming.component.spec.ts

@ -0,0 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NamingComponent } from './naming.component';
describe('NamingComponent', () => {
let component: NamingComponent;
let fixture: ComponentFixture<NamingComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [NamingComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NamingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

12
src/app/features/administration/naming/naming.component.ts

@ -0,0 +1,12 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-naming',
templateUrl: './naming.component.html',
styleUrls: ['./naming.component.scss'],
})
export class NamingComponent implements OnInit {
constructor() {}
ngOnInit(): void {}
}

34
src/app/features/administration/stepper/stepper.component.html

@ -3,7 +3,7 @@
<form [formGroup]="pollFormGroup">
<ng-template matStepLabel>Informations du sondage</ng-template>
<mat-form-field appearance="outline">
<mat-label>Question posée, sujet, etc.</mat-label>
<mat-label>Titre</mat-label>
<input #question matInput placeholder="Question posée, sujet" formControlName="question" required />
<button
mat-button
@ -16,21 +16,7 @@
<i class="fa fa-close"></i>
</button>
</mat-form-field>
<mat-form-field appearance="outline" class="is-flex">
<mat-label>Url pour les participants</mat-label>
<span matPrefix>{{ urlPrefix }}</span>
<input #slug matInput placeholder="Url" formControlName="slug" required />
<button
mat-button
*ngIf="slug.value"
matSuffix
mat-icon-button
aria-label="Clear"
(click)="slug.value = ''"
>
<i class="fa fa-close"></i>
</button>
</mat-form-field>
<mat-form-field appearance="outline" class="is-flex">
<mat-label>Description</mat-label>
<textarea
@ -51,7 +37,21 @@
<i class="fa fa-close"></i>
</button>
</mat-form-field>
<mat-form-field appearance="outline" class="is-flex">
<mat-label>Url pour les participants</mat-label>
<span matPrefix>{{ urlPrefix }}</span>
<input #slug matInput placeholder="Url" formControlName="slug" required />
<button
mat-button
*ngIf="slug.value"
matSuffix
mat-icon-button
aria-label="Clear"
(click)="slug.value = ''"
>
<i class="fa fa-close"></i>
</button>
</mat-form-field>
<div>
<button mat-button matStepperNext>Next</button>
</div>

2
src/environments/environment.ts

@ -10,7 +10,7 @@ const backendApiUrlsInDev = {
export const environment = {
production: false,
appTitle: 'FramaDate',
appLogo: '/assets/img/icon_voter_yes.png',
appLogo: 'assets/img/logo.png',
api: {
baseHref: backendApiUrlsInDev.local,
endpoints: {

Loading…
Cancel
Save