make pages components, split config of poll from service

This commit is contained in:
tykayn 2019-08-10 17:21:40 +02:00
parent e238b0aceb
commit 56aa09df3b
6 changed files with 59 additions and 19 deletions

View File

@ -15,6 +15,10 @@ import {CommonModule} from '@angular/common';
import { DatesComponent } from './pages/dates/dates.component';
import { DebuggerComponent } from './debugger/debugger.component';
import { VisibilityComponent } from './pages/visibility/visibility.component';
import { ResumeComponent } from './pages/resume/resume.component';
import { PicturesComponent } from './pages/pictures/pictures.component';
import { AnswersComponent } from './pages/answers/answers.component';
import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
@NgModule({
@ -28,6 +32,10 @@ import { VisibilityComponent } from './pages/visibility/visibility.component';
DatesComponent,
DebuggerComponent,
VisibilityComponent,
ResumeComponent,
PicturesComponent,
AnswersComponent,
EndConfirmationComponent,
],
imports: [

View File

@ -1,13 +1,6 @@
import {Injectable} from '@angular/core';
import {PollConfig} from './config/PollConfig';
/**
* une option de date dans les sondages spéciaux
*/
export interface DateOption {
text: string;
start?: string;
end?: string;
}
/**
* le service transverse à chaque page qui permet de syncroniser la configuration de sondage souhaitée
@ -15,16 +8,11 @@ export interface DateOption {
@Injectable({
providedIn: 'root'
})
export class ConfigService {
step = 0;
stepMax = 3;
pollType = 'classic';
title = '';
description = '';
allowSeveralHours = false;
dateList: DateOption[] = [];
export class ConfigService extends PollConfig {
constructor() {
super();
}
set(key, val) {

View File

@ -0,0 +1,24 @@
/**
* une option de date dans les sondages spéciaux
*/
export interface DateOption {
text: string;
start?: string;
end?: string;
}
/**
* configuration
*/
export class PollConfig {
step = 0;
stepMax = 3;
pollType = 'classic';
title = '';
description = '';
// date specific poll
allowSeveralHours = false;
dateList: DateOption[] = [];
answers: string[] = [];
}

View File

@ -1,6 +1,10 @@
import {FormContainerComponent} from '../form-container/form-container.component';
import {KindComponent} from '../pages/kind/kind.component';
import {DatesComponent} from '../pages/dates/dates.component';
import {VisibilityComponent} from '../pages/visibility/visibility.component';
import {ResumeComponent} from '../pages/resume/resume.component';
import {PicturesComponent} from '../pages/pictures/pictures.component';
import {EndConfirmationComponent} from '../pages/end-confirmation/end-confirmation.component';
/**
* each step in the form is a component
@ -10,6 +14,10 @@ export const Routes =
{path: '', component: FormContainerComponent},
{path: 'home', component: FormContainerComponent},
{path: 'step/date', component: DatesComponent},
{path: 'step/kind', component: KindComponent}
{path: 'step/kind', component: KindComponent},
{path: 'step/picture', component: PicturesComponent},
{path: 'step/visibility', component: VisibilityComponent},
{path: 'step/recapitulatif', component: ResumeComponent},
{path: 'step/end', component: EndConfirmationComponent},
]
;

View File

@ -1 +1 @@
<p>base-page works!</p>
<h1>Ce composant est celui de base pour les pages</h1>

View File

@ -1 +1,13 @@
<p>visibility works!</p>
<h1 i18n>
Visibilité des réponses
</h1>
<h1 i18n>
Votes
</h1>
<h1 i18n>
Archivage
</h1>
<h1 i18n>
Accès au sondage
</h1>