diff --git a/src/app/app.component.html b/src/app/app.component.html index f62ef567..5c4be3f9 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,11 +1,12 @@
-

- Bienvenue sur Framadate +

+ Bienvenue sur + Frama + date

Ceci est une démo

- diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8a294b4e..3d95f013 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,13 +1,17 @@ -import { BrowserModule } from '@angular/platform-browser'; -import { NgModule } from '@angular/core'; +import {BrowserModule} from '@angular/platform-browser'; +import {NgModule} from '@angular/core'; -import { AppRoutingModule } from './app-routing.module'; -import { AppComponent } from './app.component'; -import { FormContainerComponent } from './form-container/form-container.component'; -import { BasePageComponent } from './pages/base-page/base-page.component'; -import { PageKindComponent } from './pages/page-kind/page-kind.component'; -import { HeaderComponent } from './header/header.component'; +import {AppRoutingModule} from './app-routing.module'; +import {AppComponent} from './app.component'; +import {FormContainerComponent} from './form-container/form-container.component'; +import {BasePageComponent} from './pages/base-page/base-page.component'; +import {PageKindComponent} from './pages/page-kind/page-kind.component'; +import {HeaderComponent} from './header/header.component'; import {FormsModule} from '@angular/forms'; +import {NavigationComponent} from './ui/navigation/navigation.component'; +import {RouterModule} from '@angular/router'; +import {Routes} from './config/Routes'; +import {CommonModule} from '@angular/common'; @NgModule({ @@ -17,14 +21,18 @@ import {FormsModule} from '@angular/forms'; BasePageComponent, PageKindComponent, HeaderComponent, + NavigationComponent, ], imports: [ + CommonModule, BrowserModule, AppRoutingModule, FormsModule, + RouterModule.forRoot(Routes) ], providers: [], bootstrap: [AppComponent] }) -export class AppModule { } +export class AppModule { +} diff --git a/src/app/config/PollConfig.ts b/src/app/config/PollConfig.ts new file mode 100644 index 00000000..1c2bc6df --- /dev/null +++ b/src/app/config/PollConfig.ts @@ -0,0 +1,7 @@ +/** + * used as a global form configuration object to generate the form to send + */ +export var PollConfig = { + poll_type: "simple", + allow_stuff: true, +}; diff --git a/src/app/config/Routes.ts b/src/app/config/Routes.ts new file mode 100644 index 00000000..0e199abb --- /dev/null +++ b/src/app/config/Routes.ts @@ -0,0 +1,12 @@ +import {FormContainerComponent} from '../form-container/form-container.component'; +import {PageKindComponent} from '../pages/page-kind/page-kind.component'; + +/** + * each step in the form is a component inheriting from the base + */ +export const Routes = + [ + {path: '', component: FormContainerComponent}, + {path: 'step/1', component: PageKindComponent} + ] +; diff --git a/src/app/form-container/form-container.component.html b/src/app/form-container/form-container.component.html index 41982fcd..eb185037 100644 --- a/src/app/form-container/form-container.component.html +++ b/src/app/form-container/form-container.component.html @@ -1,13 +1,70 @@ -

form-container works!

+ +

+ titre de question +

+ + + blah blah + + + + + blah blah blah. + + +
+ + Choix cornélien: + + + +
-
- -
+
+ +
+ + + + infos de debug + +
diff --git a/src/app/form-container/form-container.component.ts b/src/app/form-container/form-container.component.ts index b92e8408..af5d09cf 100644 --- a/src/app/form-container/form-container.component.ts +++ b/src/app/form-container/form-container.component.ts @@ -1,6 +1,8 @@ import {Component, OnInit} from '@angular/core'; import {ProgressionService} from '../progression.service'; +// import {PollConfig} from '../config/PollConfig'; + @Component({ selector: 'framadate-form-container', templateUrl: './form-container.component.html', @@ -12,12 +14,16 @@ import {ProgressionService} from '../progression.service'; */ export class FormContainerComponent implements OnInit { - private pollConfig: any; + private pollConfig: any = { + poll_type: 'classic', + allow_stuff: true, + }; private progressionStep = 0; private progressionStepMax = 0; private formIsValid = true; constructor(private progression: ProgressionService) { + } ngOnInit() { @@ -31,11 +37,19 @@ export class FormContainerComponent implements OnInit { } } + selectOption(key: string, val: any) { + this.pollConfig[key] = val; + + return true; + } + checkValidity() { + // TODO with form controls return true; } displayErrorMessage() { + // TODO return true; } } diff --git a/src/app/pages/base-page/base-page.component.ts b/src/app/pages/base-page/base-page.component.ts index 2de932a1..f5ee13f6 100644 --- a/src/app/pages/base-page/base-page.component.ts +++ b/src/app/pages/base-page/base-page.component.ts @@ -5,6 +5,9 @@ import { Component, OnInit } from '@angular/core'; templateUrl: './base-page.component.html', styleUrls: ['./base-page.component.scss'] }) +/** + * base page is aware of the state of the filling + */ export class BasePageComponent implements OnInit { constructor() { } diff --git a/src/app/pages/page-kind/page-kind.component.ts b/src/app/pages/page-kind/page-kind.component.ts index bf88262d..dbf6c981 100644 --- a/src/app/pages/page-kind/page-kind.component.ts +++ b/src/app/pages/page-kind/page-kind.component.ts @@ -1,13 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {BasePageComponent} from '../base-page/base-page.component'; @Component({ selector: 'framadate-page-kind', templateUrl: './page-kind.component.html', styleUrls: ['./page-kind.component.scss'] }) -export class PageKindComponent implements OnInit { +export class PageKindComponent extends BasePageComponent implements OnInit { - constructor() { } + constructor() { + super(); + } ngOnInit() { } diff --git a/src/app/progression.service.ts b/src/app/progression.service.ts index 769dd034..c028f37f 100644 --- a/src/app/progression.service.ts +++ b/src/app/progression.service.ts @@ -1,9 +1,12 @@ -import { Injectable } from '@angular/core'; +import {Injectable} from '@angular/core'; + @Injectable({ providedIn: 'root' }) export class ProgressionService { + private step: number; - constructor() { } + constructor() { + } } diff --git a/src/app/ui/navigation/navigation.component.html b/src/app/ui/navigation/navigation.component.html new file mode 100644 index 00000000..33bc2724 --- /dev/null +++ b/src/app/ui/navigation/navigation.component.html @@ -0,0 +1,22 @@ +
+ + +
diff --git a/src/app/ui/navigation/navigation.component.scss b/src/app/ui/navigation/navigation.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/ui/navigation/navigation.component.spec.ts b/src/app/ui/navigation/navigation.component.spec.ts new file mode 100644 index 00000000..38577181 --- /dev/null +++ b/src/app/ui/navigation/navigation.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { NavigationComponent } from './navigation.component'; + +describe('NavigationComponent', () => { + let component: NavigationComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ NavigationComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(NavigationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/navigation/navigation.component.ts b/src/app/ui/navigation/navigation.component.ts new file mode 100644 index 00000000..d61e2564 --- /dev/null +++ b/src/app/ui/navigation/navigation.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'framadate-navigation', + templateUrl: './navigation.component.html', + styleUrls: ['./navigation.component.scss'] +}) +export class NavigationComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/assets/_debug.scss b/src/assets/_debug.scss new file mode 100644 index 00000000..fee3fcca --- /dev/null +++ b/src/assets/_debug.scss @@ -0,0 +1,8 @@ +.debug{ + background: #dedede; + margin:2em; + padding: 2em; + ul{ + list-style-type: none; + } +} diff --git a/src/assets/_global_layout.scss b/src/assets/_global_layout.scss new file mode 100644 index 00000000..6bea0166 --- /dev/null +++ b/src/assets/_global_layout.scss @@ -0,0 +1,21 @@ +input{ + background: $light; + padding: 0.5em; + border:0; + border-bottom: 3px solid $main_color; +} + +select{ + background: $light; + padding: 0.5em; + border:0; + border-bottom: 3px solid $main_color_strong; +} + +.btn{ + background: $main_color_strong; + color: $light; + border: 0; + margin: 0 0.5em; + min-height: 1.5rem; +} diff --git a/src/assets/_logo.scss b/src/assets/_logo.scss new file mode 100644 index 00000000..41ee0682 --- /dev/null +++ b/src/assets/_logo.scss @@ -0,0 +1,7 @@ +.logo_first { + color: $logo_color; +} + +.logo_second { + color: $logo_color_2; +} diff --git a/src/assets/variables.scss b/src/assets/variables.scss new file mode 100644 index 00000000..c8ac1b7d --- /dev/null +++ b/src/assets/variables.scss @@ -0,0 +1,7 @@ +$main_color: #fdffbf; +$main_color_strong: #ffa300; +$second_color: cyan; +$light: white; + +$logo_color: violet; +$logo_color_2: green; diff --git a/src/styles.scss b/src/styles.scss index 90d4ee00..19461e90 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1 +1,5 @@ /* You can add global styles to this file, and also import other style files */ +@import "assets/variables"; +@import "assets/global_layout"; +@import "assets/logo"; +@import "assets/debug"; diff --git a/tslint.json b/tslint.json index f0adae98..47306933 100644 --- a/tslint.json +++ b/tslint.json @@ -13,12 +13,14 @@ true, "attribute", "app", + "framadate", "camelCase" ], "component-selector": [ true, "element", "app", + "framadate", "kebab-case" ], "import-blacklist": [ @@ -89,4 +91,4 @@ "rulesDirectory": [ "codelyzer" ] -} \ No newline at end of file +}