split config service & dispatch

This commit is contained in:
seraph 2020-04-22 12:56:18 +02:00
parent 48636ad947
commit 3997dd090e
170 changed files with 1429 additions and 1218 deletions

View File

@ -12,7 +12,7 @@
}, },
"root": "", "root": "",
"sourceRoot": "src", "sourceRoot": "src",
"prefix": "framadate", "prefix": "app",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
@ -23,16 +23,13 @@
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json", "tsConfig": "tsconfig.app.json",
"aot": true, "aot": true,
"assets": [ "assets": ["src/favicon.ico", "src/assets"],
"src/favicon.ico",
"src/assets"
],
"styles": [ "styles": [
"node_modules/fork-awesome/css/fork-awesome.min.css",
"node_modules/primeicons/primeicons.css", "node_modules/primeicons/primeicons.css",
"node_modules/font-awesome/css/font-awesome.css",
"node_modules/primeng/resources/themes/nova-light/theme.css", "node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeng/resources/primeng.min.css", "node_modules/primeng/resources/primeng.min.css",
"src/assets/scss/styles.scss" "src/styles.scss"
], ],
"scripts": [ "scripts": [
"node_modules/marked/lib/marked.js", "node_modules/marked/lib/marked.js",
@ -90,20 +87,13 @@
}, },
"test": { "test": {
"builder": "@angular-builders/jest:run", "builder": "@angular-builders/jest:run",
"options": { "options": {}
}
}, },
"lint": { "lint": {
"builder": "@angular-devkit/build-angular:tslint", "builder": "@angular-devkit/build-angular:tslint",
"options": { "options": {
"tsConfig": [ "tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"tsconfig.app.json", "exclude": ["**/node_modules/**"]
"tsconfig.spec.json",
"e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
]
} }
}, },
"e2e": { "e2e": {
@ -121,5 +111,8 @@
} }
} }
}, },
"defaultProject": "framadate" "defaultProject": "framadate",
"cli": {
"analytics": "0ba9c0a9-850f-4c5f-8124-cbe6f4c79ef1"
}
} }

3
babel.config.json Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}

View File

@ -1,3 +1,5 @@
// TODO: File to be deleted : just temporary documentation of backend API endpoints
/** /**
* *
* -------------------------- -------- -------- ------ ------------------------------------------------ * -------------------------- -------- -------- ------ ------------------------------------------------

View File

@ -1,11 +0,0 @@
import 'jest-preset-angular';
// const { defaults } = require('jest-config');
//
// module.exports = {
// verbose: true,
// collectCoverage: true,
// // collectCoverageFrom: ['src/**/*.ts'],
// collectCoverageFrom: ['src/app/pages/admin/*.ts'],
// };
Error.stackTraceLimit = 2;

View File

@ -1,7 +1,7 @@
{ {
"name": "framadate-funky-frontend", "name": "framadate-funky-frontend",
"version": "1.0.0", "version": "1.0.0",
"licence": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
@ -41,17 +41,14 @@
"bulma": "^0.8.2", "bulma": "^0.8.2",
"chart.js": "^2.8.0", "chart.js": "^2.8.0",
"date-fns": "^2.12.0", "date-fns": "^2.12.0",
"font-awesome": "^4.7.0", "fork-awesome": "^1.1.7",
"jest-preset-angular": "^8.1.3",
"karma-coverage": "^2.0.1",
"karma-firefox-launcher": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"locale-enum": "^1.1.0", "locale-enum": "^1.1.0",
"ngx-clipboard": "^13.0.0", "ngx-clipboard": "^13.0.0",
"ngx-markdown": "^9.0.0", "ngx-markdown": "^9.0.0",
"ngx-toaster": "^1.0.1", "ngx-toaster": "^1.0.1",
"ngx-webstorage": "^5.0.0",
"primeicons": "^2.0.0", "primeicons": "^2.0.0",
"primeng": "^9.0.5", "primeng": "^9.0.6",
"quill": "^1.3.7", "quill": "^1.3.7",
"rxjs": "^6.5.5", "rxjs": "^6.5.5",
"rxjs-compat": "^6.5.5", "rxjs-compat": "^6.5.5",
@ -61,35 +58,39 @@
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/jest": "^9.0.1", "@angular-builders/jest": "^9.0.1",
"@angular-devkit/build-angular": "^0.901.1", "@angular-devkit/build-angular": "^0.901.2",
"@angular/cli": "^9.0.7", "@angular/cli": "^9.1.2",
"@angular/compiler-cli": "^9.1.1", "@angular/compiler-cli": "^9.1.1",
"@angular/language-service": "^9.0.7", "@angular/language-service": "^9.0.7",
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"@storybook/addon-actions": "^5.3.18", "@storybook/addon-actions": "^5.3.18",
"@storybook/addon-links": "^5.3.18", "@storybook/addon-links": "^5.3.18",
"@storybook/addon-notes": "^5.3.18", "@storybook/addon-notes": "^5.3.18",
"@storybook/addons": "^5.3.18", "@storybook/addons": "^5.3.18",
"@storybook/angular": "^5.3.18", "@storybook/angular": "^5.3.18",
"@types/jasminewd2": "~2.0.8",
"@types/jest": "^25.2.1", "@types/jest": "^25.2.1",
"@types/node": "^13.11.1", "@types/node": "^13.13.2",
"@types/uuid": "^7.0.2", "@types/uuid": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^2.27.0", "@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0", "@typescript-eslint/parser": "^2.27.0",
"babel-jest": "^25.4.0",
"babel-loader": "^8.1.0", "babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0",
"compodoc": "^0.0.41", "compodoc": "^0.0.41",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1", "eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5", "husky": "^4.2.5",
"jasmine-core": "~3.5.0", "jest": "^25.4.0",
"jasmine-spec-reporter": "~5.0.1", "jest-environment-jsdom-sixteen": "^1.0.3",
"jest": "^25.3.0", "jest-preset-angular": "^8.1.3",
"lint-staged": "^10.1.3", "lint-staged": "^10.1.7",
"prettier": "^2.0.4", "prettier": "^2.0.5",
"protractor": "~5.4.3", "protractor": "~5.4.3",
"ts-node": "~8.8.2", "ts-jest": "^25.4.0",
"ts-mockito": "^2.5.0",
"ts-node": "~8.9.0",
"typescript": "~3.8.3" "typescript": "~3.8.3"
}, },
"husky": { "husky": {
@ -106,6 +107,13 @@
}, },
"jest": { "jest": {
"preset": "jest-preset-angular", "preset": "jest-preset-angular",
"setupFilesAfterEnv": "./jest.config.js" "setupFilesAfterEnv": [
"<rootDir>/src/jest.setup.ts"
],
"testEnvironment": "jest-environment-jsdom-sixteen",
"transform": {
"^.+\\.(ts|html)$": "ts-jest",
"^.+\\.jsx?$": "babel-jest"
}
} }
} }

View File

@ -1,22 +1,23 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { PageNotFoundComponent } from './core/components/page-not-found/page-not-found.component';
import { AdminComponent } from './pages/admin/admin.component'; import { AdminComponent } from './pages/admin/admin.component';
import { AnswersComponent } from './pages/answers/answers.component'; import { AnswersComponent } from './pages/answers/answers.component';
import { BaseComponent } from './pages/example/base-page/base.component';
import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component'; import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component';
import { DatesComponent } from './pages/dates/dates.component'; import { DatesComponent } from './pages/dates/dates.component';
import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component'; import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
import { HomeComponent } from './pages/home/home.component'; import { BaseComponent } from './pages/example/base-page/base.component';
import { KindComponent } from './pages/example/kind/kind.component'; import { KindComponent } from './pages/example/kind/kind.component';
import { PasswordComponent } from './pages/password/password.component';
import { PicturesComponent } from './pages/example/pictures/pictures.component'; import { PicturesComponent } from './pages/example/pictures/pictures.component';
import { HomeComponent } from './pages/home/home.component';
import { PasswordComponent } from './pages/password/password.component';
import { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component'; import { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component';
import { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
import { ResumeComponent } from './pages/resume/resume.component'; import { ResumeComponent } from './pages/resume/resume.component';
import { VisibilityComponent } from './pages/visibility/visibility.component'; import { VisibilityComponent } from './pages/visibility/visibility.component';
import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component'; import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component';
import { VotingComponent } from './pages/voting/voting.component'; import { VotingComponent } from './pages/voting/voting.component';
import { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', redirectTo: 'step/creation', pathMatch: 'full' }, { path: '', redirectTo: 'step/creation', pathMatch: 'full' },
@ -39,7 +40,16 @@ const routes: Routes = [
{ path: 'votingchoice', component: VotingChoiceComponent }, { path: 'votingchoice', component: VotingChoiceComponent },
{ path: 'voting', component: VotingComponent }, { path: 'voting', component: VotingComponent },
{ path: 'step/password', component: PasswordComponent }, { path: 'step/password', component: PasswordComponent },
{ path: '**', redirectTo: '/home', pathMatch: 'full' }, {
path: 'administration',
loadChildren: () =>
import('./features/administration/administration.module').then((m) => m.AdministrationModule),
},
{
path: 'participation',
loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule),
},
{ path: '**', component: PageNotFoundComponent },
]; ];
@NgModule({ @NgModule({

View File

@ -1,12 +1,25 @@
<div id="big_container" class="{{ this.config.preferences.themeClass }}"> <div id="big_container" [class]="themeClass">
<header class="big-header"> <header class="big-header">
<div class="container"> <div class="container">
<div class="columns"> <div class="columns is-mobile is-vcentered">
<div class="column"> <div class="column is-pulled-left has-addons">
<framadate-master-head></framadate-master-head> <img
(click)="toggleMenu()"
alt="menu icon"
class="menu_icon clickable"
src="assets/img/icone-menu.svg"
/>
<br />
<span (click)="toggleMenu()" class="menu_label">Menu</span>
</div> </div>
<div class="column"> <div class="column">
<framadate-language></framadate-language> <app-logo></app-logo>
</div>
<div class="column">
<app-theme-selector></app-theme-selector>
</div>
<div class="column">
<app-language-selector></app-language-selector>
</div> </div>
</div> </div>
</div> </div>
@ -14,12 +27,10 @@
<main> <main>
<div class="container"> <div class="container">
<div class="columns"> <div class="columns is-mobile">
<div class="column is-one-quarter togglable-menu" *ngIf="config.menuVisible"> <div class="column is-one-quarter togglable-menu" *ngIf="config.menuVisible">
<framadate-theme-selector></framadate-theme-selector> <app-navigation [step]="step"></app-navigation>
<app-debugger *ngIf="isDebugMode"></app-debugger>
<framadate-navigation [step]="step"></framadate-navigation>
<framadate-debugger *ngIf="isDevelopmentEnv"></framadate-debugger>
</div> </div>
<div class="column"> <div class="column">
<router-outlet></router-outlet> <router-outlet></router-outlet>

View File

@ -1,34 +1,67 @@
import { Component, Inject } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { NavigationStart, Router } from '@angular/router';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import { Component, Inject, OnInit, OnDestroy } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { NavigationStart, Router } from '@angular/router';
import { Observable, Subscription } from 'rxjs';
import { filter } from 'rxjs/operators'; import { filter } from 'rxjs/operators';
import { ConfigService } from './services/config.service';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { Theme } from './core/enums/theme.enum';
import { ThemeService } from './core/services/theme.service';
import { ConfigService } from './services/config.service';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'], styleUrls: ['./app.component.scss'],
}) })
export class AppComponent { export class AppComponent implements OnInit, OnDestroy {
step: string; public appTitle: string = environment.appTitle;
isDevelopmentEnv = false; public themeClass: string;
public isDebugMode = false;
private themeSubscription: Subscription;
public step: string;
constructor( constructor(
private translate: TranslateService, private titleService: Title,
private themeService: ThemeService,
public config: ConfigService, public config: ConfigService,
@Inject(DOCUMENT) private document, @Inject(DOCUMENT) private document,
private route: Router private router: Router
) { ) {}
this.detectCurrentTabOnRouteChange();
this.isDevelopmentEnv = !environment.production; ngOnInit(): void {
if (!environment.production) {
this.isDebugMode = true;
this.appTitle += ' | DEV';
console.info(' ######### framadate | DEV ######### we are NOT in production env, filling with mock values');
}
this.titleService.setTitle(this.appTitle);
this.themeSubscription = this.themeService.theme.subscribe((theme: Theme) => {
switch (theme) {
case Theme.DARK:
this.themeClass = 'theme-dark-crystal';
break;
case Theme.RED:
this.themeClass = 'theme-hot-covid';
break;
default:
this.themeClass = 'theme-light-watermelon';
}
});
this.detectCurrentTabOnRouteChange();
} }
detectCurrentTabOnRouteChange() { ngOnDestroy(): void {
this.route.events.subscribe((event: any) => {}); if (this.themeSubscription) {
this.route.events this.themeSubscription.unsubscribe();
}
}
public detectCurrentTabOnRouteChange(): void {
this.router.events
.pipe(filter((event) => event instanceof NavigationStart)) .pipe(filter((event) => event instanceof NavigationStart))
.subscribe((event: NavigationStart) => { .subscribe((event: NavigationStart) => {
this.scrollGoToTop(); this.scrollGoToTop();
@ -38,18 +71,19 @@ export class AppComponent {
}); });
} }
scrollGoToTop() { public scrollGoToTop(): void {
this.document.documentElement.scrollTop = 0; this.document.documentElement.scrollTop = 0;
} }
updateCurrentTab(event) { public updateCurrentTab(event): void {
if (event.url) { if (event.url) {
const tab = event.url.split('/'); const tab: string[] = event.url.split('/');
if (tab && tab[2]) { this.step = tab && tab[2] ? tab[2] : 'home';
this.step = tab[2];
} else {
this.step = 'home';
}
} }
} }
public toggleMenu(): void {
// TODO: move this logic elsewhere, probably in Navbar component
this.config.menuVisible = !this.config.menuVisible;
}
} }

View File

@ -1,10 +1,8 @@
import { CommonModule, registerLocaleData } from '@angular/common'; import { CommonModule } from '@angular/common';
import { HttpClient, HttpClientModule } from '@angular/common/http'; import { HttpClient, HttpClientModule } from '@angular/common/http';
import localeEn from '@angular/common/locales/en';
import localeFr from '@angular/common/locales/fr';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule, Title } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { import {
MissingTranslationHandler, MissingTranslationHandler,
@ -16,27 +14,29 @@ import {
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ClipboardModule } from 'ngx-clipboard'; import { ClipboardModule } from 'ngx-clipboard';
import { MarkdownModule } from 'ngx-markdown'; import { MarkdownModule } from 'ngx-markdown';
import { NgxWebstorageModule } from 'ngx-webstorage';
import { ConfirmationService, MessageModule, MessageService } from 'primeng'; import { ConfirmationService, MessageModule, MessageService } from 'primeng';
import { ConfirmDialogModule } from 'primeng/confirmdialog'; import { ConfirmDialogModule } from 'primeng/confirmdialog';
import { DialogModule } from 'primeng/dialog'; import { DialogModule } from 'primeng/dialog';
import { ToastModule } from 'primeng/toast'; import { ToastModule } from 'primeng/toast';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CoreModule } from './core/core.module';
import { DateValueAccessorModule } from './custom-lib/date-value-accessor'; import { DateValueAccessorModule } from './custom-lib/date-value-accessor';
import { DebuggerComponent } from './ui/debugger/debugger.component';
import { HeaderComponent } from './ui/navigation/header/header.component';
import { AdminComponent } from './pages/admin/admin.component'; import { AdminComponent } from './pages/admin/admin.component';
import { AnswersComponent } from './pages/answers/answers.component'; import { AnswersComponent } from './pages/answers/answers.component';
import { BaseComponent } from './pages/example/base-page/base.component';
import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component'; import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component';
import { DatesComponent } from './pages/dates/dates.component'; import { DatesComponent } from './pages/dates/dates.component';
import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component'; import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
import { HomeComponent } from './pages/home/home.component'; import { BaseComponent } from './pages/example/base-page/base.component';
import { KindComponent } from './pages/example/kind/kind.component'; import { KindComponent } from './pages/example/kind/kind.component';
import { PasswordComponent } from './pages/password/password.component';
import { PicturesComponent } from './pages/example/pictures/pictures.component'; import { PicturesComponent } from './pages/example/pictures/pictures.component';
import { HomeComponent } from './pages/home/home.component';
import { PasswordComponent } from './pages/password/password.component';
import { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component'; import { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component';
import { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
import { ResumeComponent } from './pages/resume/resume.component'; import { ResumeComponent } from './pages/resume/resume.component';
import { VisibilityComponent } from './pages/visibility/visibility.component'; import { VisibilityComponent } from './pages/visibility/visibility.component';
import { ChoicesListComponent } from './pages/voting/choices-list/choices-list.component'; import { ChoicesListComponent } from './pages/voting/choices-list/choices-list.component';
@ -47,96 +47,92 @@ import { VotingGraphComponent } from './pages/voting/voting-graph/voting-graph.c
import { VotingNavigationComponent } from './pages/voting/voting-navigation/voting-navigation.component'; import { VotingNavigationComponent } from './pages/voting/voting-navigation/voting-navigation.component';
import { VotingSummaryComponent } from './pages/voting/voting-summary/voting-summary.component'; import { VotingSummaryComponent } from './pages/voting/voting-summary/voting-summary.component';
import { VotingComponent } from './pages/voting/voting.component'; import { VotingComponent } from './pages/voting/voting.component';
import { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
import { ConfigService } from './services/config.service'; import { ConfigService } from './services/config.service';
import { SharedModule } from './shared/shared.module';
import { CopyTextComponent } from './ui/copy-text/copy-text.component'; import { CopyTextComponent } from './ui/copy-text/copy-text.component';
import { DebuggerComponent } from './ui/debugger/debugger.component';
import { ResettableInputDirective } from './ui/directives/resettable-input.directive'; import { ResettableInputDirective } from './ui/directives/resettable-input.directive';
import { ErasableInputComponent } from './ui/erasable-input/erasable-input.component'; import { ErasableInputComponent } from './ui/erasable-input/erasable-input.component';
import { MasterHeadComponent } from './ui/navigation/master-head/master-head.component';
import { NavigationComponent } from './ui/navigation/navigation.component'; import { NavigationComponent } from './ui/navigation/navigation.component';
import { LanguageComponent } from './ui/selector/language/language.component';
import { SelectorComponent } from './ui/selector/selector.component';
import { ThemeSelectorComponent } from './ui/selector/theme-selector/theme-selector.component';
import { TwoLinksComponent } from './ui/navigation/two-links/two-links.component'; import { TwoLinksComponent } from './ui/navigation/two-links/two-links.component';
import { LanguageSelectorComponent } from './ui/selectors/language-selector/language-selector.component';
import { ThemeSelectorComponent } from './ui/selectors/theme-selector/theme-selector.component';
export class MyMissingTranslationHandler implements MissingTranslationHandler { export class MyMissingTranslationHandler implements MissingTranslationHandler {
handle(params: MissingTranslationHandlerParams) { public handle(params: MissingTranslationHandlerParams): string {
return 'some value'; return `MISSING TRANSLATION FOR [${params.key}]`;
} }
} }
registerLocaleData(localeFr, 'fr');
registerLocaleData(localeEn, 'en');
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http); return new TranslateHttpLoader(http);
} }
@NgModule({ @NgModule({
declarations: [ declarations: [
AdminComponent,
AnswersComponent,
AppComponent, AppComponent,
BaseComponent, BaseComponent,
KindComponent, ChoicesListComponent,
HeaderComponent, CommentsListComponent,
NavigationComponent, CopyTextComponent,
CreateOrRetrieveComponent,
DatesComponent, DatesComponent,
DebuggerComponent, DebuggerComponent,
VisibilityComponent,
ResumeComponent,
PicturesComponent,
AnswersComponent,
EndConfirmationComponent, EndConfirmationComponent,
CreateOrRetrieveComponent, ErasableInputComponent,
VotingSummaryComponent,
VotingGraphComponent,
VotingChoiceComponent,
PasswordComponent,
HomeComponent, HomeComponent,
PollGraphicComponent, KindComponent,
AdminComponent, NavigationComponent,
SelectorComponent, PasswordComponent,
PicturesComponent,
PollDisplayComponent, PollDisplayComponent,
PollGraphicComponent,
ResettableInputDirective,
ResumeComponent,
ThemeSelectorComponent,
TwoLinksComponent,
VisibilityComponent,
VotingChoiceComponent,
VotingGraphComponent,
VotingComponent, VotingComponent,
VotingCommentComponent, VotingCommentComponent,
ResettableInputDirective, VotingSummaryComponent,
ErasableInputComponent,
CopyTextComponent,
CommentsListComponent,
ChoicesListComponent,
VotingNavigationComponent, VotingNavigationComponent,
ThemeSelectorComponent, LanguageSelectorComponent,
MasterHeadComponent,
LanguageComponent,
TwoLinksComponent,
], ],
imports: [ imports: [
ConfirmDialogModule, AppRoutingModule,
BrowserAnimationsModule,
BrowserModule,
ClipboardModule, ClipboardModule,
CommonModule, CommonModule,
BrowserModule, ConfirmDialogModule,
DialogModule, CoreModule,
DateValueAccessorModule, DateValueAccessorModule,
BrowserAnimationsModule, DialogModule,
AppRoutingModule, FormsModule,
ToastModule, HttpClientModule,
MessageModule,
MarkdownModule.forRoot(), MarkdownModule.forRoot(),
MessageModule,
NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
SharedModule,
ToastModule,
TranslateModule.forRoot({ TranslateModule.forRoot({
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler,
},
// useDefaultLang: false,
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: HttpLoaderFactory, useFactory: HttpLoaderFactory,
deps: [HttpClient], deps: [HttpClient],
}, },
missingTranslationHandler: {
provide: MissingTranslationHandler,
useClass: MyMissingTranslationHandler,
},
useDefaultLang: false,
}), }),
HttpClientModule,
FormsModule,
], ],
providers: [TranslateService, ConfigService, MessageService, ConfirmationService], providers: [ConfigService, ConfirmationService, MessageService, Title, TranslateService],
bootstrap: [AppComponent], bootstrap: [AppComponent],
}) })
export class AppModule {} export class AppModule {}

View File

@ -57,8 +57,8 @@ export class PollConfig {
customUrl = ''; // custom slug in the url, must be unique customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend customUrlIsUnique = null; // given by the backend
urlSlugPublic = null; urlSlugPublic = null;
urlPublic = environment.production ? '' : window.location.origin + '/#/poll/id/4'; urlPublic = environment.production ? '' : document.location.href + '/#/poll/id/4';
urlAdmin = window.location.origin + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345'; urlAdmin = document.location.href + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
adminKey = ''; // key to change config of the poll adminKey = ''; // key to change config of the poll
owner_modifier_token = ''; // key to change a vote stack owner_modifier_token = ''; // key to change a vote stack
canModifyAnswers = true; // bool for the frontend selector canModifyAnswers = true; // bool for the frontend selector
@ -68,10 +68,6 @@ export class PollConfig {
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
answers: PollAnswer[] = defaultAnswers; answers: PollAnswer[] = defaultAnswers;
// front end choices
themeChoices: string[] = ['light-watermelon', 'dark-crystal', 'hot-covid'];
themeSelected = 0;
themeClass = 'theme-light-watermelon';
// modals // modals
displayConfirmVoteModalAdmin = false; displayConfirmVoteModalAdmin = false;

View File

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

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HeaderComponent } from './header.component'; import { FooterComponent } from './footer.component';
describe('HeaderComponent', () => { describe('FooterComponent', () => {
let component: HeaderComponent; let component: FooterComponent;
let fixture: ComponentFixture<HeaderComponent>; let fixture: ComponentFixture<FooterComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [HeaderComponent], declarations: [FooterComponent],
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(HeaderComponent); fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

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

View File

@ -1,14 +1,13 @@
<div class="home_link"> <div class="home_link">
<a [routerLink]="'home'" aria-roledescription="home"> <a class="button" routerLink="/home" aria-roledescription="home">
<h1> <h1>
<span class="logo_first">Frama</span> <span class="logo_first">Frama</span>
<span class="logo_second">date</span> <span class="logo_second">Sondage</span>
(démo)
</h1> </h1>
</a> </a>
<div class="legend"> <a class="button legend" href="https://framasoft.org/" target="_blank">
proposé par proposé par
<span class="legend_first">Frama</span> <span class="legend_first">Frama</span>
<span class="legend_second">soft</span> <span class="legend_second">soft</span>
</div> </a>
</div> </div>

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SelectorComponent } from './selector.component'; import { LogoComponent } from './logo.component';
describe('SelectorComponent', () => { describe('LogoComponent', () => {
let component: SelectorComponent; let component: LogoComponent;
let fixture: ComponentFixture<SelectorComponent>; let fixture: ComponentFixture<LogoComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [SelectorComponent], declarations: [LogoComponent],
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SelectorComponent); fixture = TestBed.createComponent(LogoComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-logo',
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.scss'],
})
export class LogoComponent {}

View File

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

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { LanguageComponent } from './language.component'; import { NavbarComponent } from './navbar.component';
describe('LanguageComponent', () => { describe('NavbarComponent', () => {
let component: LanguageComponent; let component: NavbarComponent;
let fixture: ComponentFixture<LanguageComponent>; let fixture: ComponentFixture<NavbarComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [LanguageComponent], declarations: [NavbarComponent],
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(LanguageComponent); fixture = TestBed.createComponent(NavbarComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

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

View File

@ -0,0 +1,3 @@
<div class="hero">
This page doesn't exist.
</div>

View File

@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MasterHeadComponent } from './master-head.component'; import { PageNotFoundComponent } from './page-not-found.component';
describe('MasterHeadComponent', () => { describe('PageNotFoundComponent', () => {
let component: MasterHeadComponent; let component: PageNotFoundComponent;
let fixture: ComponentFixture<MasterHeadComponent>; let fixture: ComponentFixture<PageNotFoundComponent>;
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
declarations: [MasterHeadComponent], declarations: [PageNotFoundComponent],
}).compileComponents(); }).compileComponents();
})); }));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(MasterHeadComponent); fixture = TestBed.createComponent(PageNotFoundComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@ -0,0 +1,8 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-page-not-found',
templateUrl: './page-not-found.component.html',
styleUrls: ['./page-not-found.component.scss'],
})
export class PageNotFoundComponent {}

View File

@ -0,0 +1,20 @@
import { CommonModule } from '@angular/common';
import { NgModule, Optional, SkipSelf } from '@angular/core';
import { RouterModule } from '@angular/router';
import { FooterComponent } from './components/footer/footer.component';
import { LogoComponent } from './components/logo/logo.component';
import { NavbarComponent } from './components/navbar/navbar.component';
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';
import { throwIfAlreadyLoaded } from './guards/module-import.guard';
@NgModule({
declarations: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
imports: [CommonModule, RouterModule],
exports: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
})
export class CoreModule {
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
throwIfAlreadyLoaded(parentModule, 'CoreModule');
}
}

View File

@ -0,0 +1,4 @@
export enum Language {
FR = 'FR',
EN = 'EN',
}

View File

@ -0,0 +1,5 @@
export enum Theme {
LIGHT = 'LIGHT',
DARK = 'DARK',
RED = 'RED',
}

View File

@ -0,0 +1,5 @@
export function throwIfAlreadyLoaded(parentModule: any, moduleName: string): void {
if (parentModule) {
throw new Error(`${moduleName} has already been loaded. Import ${moduleName} in the AppModule only.`);
}
}

View File

@ -9,13 +9,10 @@ import { ApiService } from './api.service';
}) })
export class PollService { export class PollService {
private _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined); private _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined);
public readonly poll: Observable<Poll | undefined> = this._poll.asObservable();
constructor(private apiService: ApiService) {} constructor(private apiService: ApiService) {}
public get poll(): Observable<Poll | undefined> {
return this._poll.asObservable();
}
public updateCurrentPoll(poll: Poll): void { public updateCurrentPoll(poll: Poll): void {
this._poll.next(poll); this._poll.next(poll);
} }

View File

@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { StorageService } from './storage.service';
describe('StorageService', () => {
let service: StorageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(StorageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import { LocalStorage } from 'ngx-webstorage';
import { Language } from '../enums/language.enum';
import { Theme } from '../enums/theme.enum';
@Injectable({
providedIn: 'root',
})
export class StorageService {
@LocalStorage()
public theme: Theme;
@LocalStorage()
public language: Language;
@LocalStorage()
public userPollsIds: string[];
}

View File

@ -0,0 +1,15 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { Theme } from '../enums/theme.enum';
@Injectable({
providedIn: 'root',
})
export class ThemeService {
private _theme: BehaviorSubject<Theme> = new BehaviorSubject<Theme>(Theme.LIGHT);
public readonly theme: Observable<Theme> = this._theme.asObservable();
public selectTheme(theme: Theme): void {
this._theme.next(theme);
}
}

View File

@ -8,10 +8,7 @@ import { User } from '../models/user.model';
}) })
export class UserService { export class UserService {
private _user: BehaviorSubject<User | undefined> = new BehaviorSubject<User | undefined>(undefined); private _user: BehaviorSubject<User | undefined> = new BehaviorSubject<User | undefined>(undefined);
public readonly user: Observable<User | undefined> = this._user.asObservable();
public get user(): Observable<User | undefined> {
return this._user.asObservable();
}
public updateUser(user: User): void { public updateUser(user: User): void {
this._user.next(user); this._user.next(user);

View File

@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AdministrationComponent } from './administration.component';
const routes: Routes = [{ path: '', component: AdministrationComponent }];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class AdministrationRoutingModule {}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,13 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { SharedModule } from '../../shared/shared.module';
import { AdministrationRoutingModule } from './administration-routing.module';
import { AdministrationComponent } from './administration.component';
@NgModule({
declarations: [AdministrationComponent],
imports: [CommonModule, AdministrationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
})
export class AdministrationModule {}

View File

@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ParticipationComponent } from './participation.component';
const routes: Routes = [{ path: '', component: ParticipationComponent }];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ParticipationRoutingModule {}

View File

@ -0,0 +1,2 @@
<p>participation works!</p>
<p>It should display an existing poll, which user wants to participate by voting.</p>

View File

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

View File

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

View File

@ -0,0 +1,13 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { SharedModule } from '../../shared/shared.module';
import { ParticipationRoutingModule } from './participation-routing.module';
import { ParticipationComponent } from './participation.component';
@NgModule({
declarations: [ParticipationComponent],
imports: [CommonModule, ParticipationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
})
export class ParticipationModule {}

View File

@ -6,7 +6,7 @@ import { PollUtilities } from '../../config/PollUtilities';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
@Component({ @Component({
selector: 'framadate-admin', selector: 'app-admin',
templateUrl: './admin.component.html', templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss'], styleUrls: ['./admin.component.scss'],
}) })

View File

@ -5,7 +5,7 @@ import { ConfigService } from '../../services/config.service';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
@Component({ @Component({
selector: 'framadate-answers', selector: 'app-answers',
templateUrl: './answers.component.html', templateUrl: './answers.component.html',
styleUrls: ['./answers.component.scss'], styleUrls: ['./answers.component.scss'],
}) })

View File

@ -64,7 +64,7 @@
</div> </div>
</section> </section>
<div class="loading" *ngIf="config.loading"> <div class="loading" *ngIf="config.loading">
<i class="fa fa-refresh fa-spin fa-3x fa-fw"></i> <i class="fa fa-refresh fa-spin"></i>
</div> </div>
</div> </div>
</div> </div>

View File

@ -3,7 +3,7 @@ import { BaseComponent } from '../example/base-page/base.component';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
@Component({ @Component({
selector: 'framadate-create-or-retrieve', selector: 'app-create-or-retrieve',
templateUrl: './create-or-retrieve.component.html', templateUrl: './create-or-retrieve.component.html',
styleUrls: ['./create-or-retrieve.component.scss'], styleUrls: ['./create-or-retrieve.component.scss'],
}) })

View File

@ -156,7 +156,7 @@
</div> </div>
</div> </div>
<div class="column"> <div class="column">
<framadate-resume></framadate-resume> <app-resume></app-resume>
</div> </div>
</div> </div>

View File

@ -7,7 +7,7 @@ import { otherDefaultDates } from '../../config/defaultConfigs';
import { DateUtilities } from '../../config/DateUtilities'; import { DateUtilities } from '../../config/DateUtilities';
@Component({ @Component({
selector: 'framadate-dates', selector: 'app-dates',
templateUrl: './dates.component.html', templateUrl: './dates.component.html',
styleUrls: ['./dates.component.scss'], styleUrls: ['./dates.component.scss'],
}) })

View File

@ -19,7 +19,7 @@
Pour accéder au sondage et à tous ses paramètres : Pour accéder au sondage et à tous ses paramètres :
<a href="{{ config.urlAdmin }}">{{ config.urlAdmin }} </a> <a href="{{ config.urlAdmin }}">{{ config.urlAdmin }} </a>
</p> </p>
<framadate-copy-text [textToCopy]="config.urlAdmin"></framadate-copy-text> <app-copy-text [textToCopy]="config.urlAdmin"></app-copy-text>
<a href="{{ config.urlAdmin }}"> <a href="{{ config.urlAdmin }}">
Voir le sondage coté administrateur·ice Voir le sondage coté administrateur·ice
</a> </a>
@ -34,7 +34,7 @@
Pour accéder au sondage : Pour accéder au sondage :
<a href="{{ config.urlPublic }}">{{ config.urlPublic }} </a> <a href="{{ config.urlPublic }}">{{ config.urlPublic }} </a>
</p> </p>
<framadate-copy-text [textToCopy]="config.urlPublic"></framadate-copy-text> <app-copy-text [textToCopy]="config.urlPublic"></app-copy-text>
<a href="{{ config.urlPublic }}"> <a href="{{ config.urlPublic }}">
Voir le sondage Voir le sondage
</a> </a>

View File

@ -5,7 +5,7 @@ import { ConfigService } from '../../services/config.service';
import { MessageService } from 'primeng/api'; import { MessageService } from 'primeng/api';
@Component({ @Component({
selector: 'framadate-end-confirmation', selector: 'app-end-confirmation',
templateUrl: './end-confirmation.component.html', templateUrl: './end-confirmation.component.html',
styleUrls: ['./end-confirmation.component.scss'], styleUrls: ['./end-confirmation.component.scss'],
}) })

View File

@ -1,8 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ConfigService } from '../../../services/config.service'; import { ConfigService } from '../../../services/config.service';
@Component({ @Component({
selector: 'framadate-base-page', selector: 'app-base-page',
templateUrl: './base.component.html', templateUrl: './base.component.html',
styleUrls: ['./base.component.scss'], styleUrls: ['./base.component.scss'],
}) })
@ -12,15 +13,15 @@ import { ConfigService } from '../../../services/config.service';
export class BaseComponent implements OnInit { export class BaseComponent implements OnInit {
constructor(public config: ConfigService) {} constructor(public config: ConfigService) {}
ngOnInit() {} ngOnInit(): void {}
checkValidity() { public checkValidity(): boolean {
// TODO with form controls // TODO with form controls
this.config.todo(); this.config.todo();
return true; return true;
} }
displayErrorMessage() { public displayErrorMessage(): boolean {
// TODO // TODO
this.config.todo(); this.config.todo();
return true; return true;

View File

@ -186,7 +186,7 @@
<section> <section>
<h1>Molecules</h1> <h1>Molecules</h1>
<framadate-voting-choice></framadate-voting-choice> <app-voting-choice></app-voting-choice>
<article> <article>
<h2>Useful classes</h2> <h2>Useful classes</h2>

View File

@ -3,7 +3,7 @@ import { BaseComponent } from '../base-page/base.component';
import { ConfigService } from '../../../services/config.service'; import { ConfigService } from '../../../services/config.service';
@Component({ @Component({
selector: 'framadate-page-kind', selector: 'app-page-kind',
templateUrl: './kind.component.html', templateUrl: './kind.component.html',
styleUrls: ['./kind.component.scss'], styleUrls: ['./kind.component.scss'],
}) })

View File

@ -3,7 +3,7 @@ import { ConfigService } from '../../../services/config.service';
import { BaseComponent } from '../base-page/base.component'; import { BaseComponent } from '../base-page/base.component';
@Component({ @Component({
selector: 'framadate-pictures', selector: 'app-pictures',
templateUrl: './pictures.component.html', templateUrl: './pictures.component.html',
styleUrls: ['./pictures.component.scss'], styleUrls: ['./pictures.component.scss'],
}) })

View File

@ -32,7 +32,7 @@
placeholder="{{ 'creation.choose_title_placeholder' | translate }}" placeholder="{{ 'creation.choose_title_placeholder' | translate }}"
type="name" type="name"
/> />
<framadate-erasable-input [(inputModel)]="config.title"></framadate-erasable-input> <app-erasable-input [(inputModel)]="config.title"></app-erasable-input>
</div> </div>
<div> <div>
@ -44,13 +44,13 @@
placeholder="{{ 'creation.name_placeholder' | translate }}" placeholder="{{ 'creation.name_placeholder' | translate }}"
type="name" type="name"
/> />
<framadate-erasable-input [(inputModel)]="config.myName"></framadate-erasable-input> <app-erasable-input [(inputModel)]="config.myName"></app-erasable-input>
</div> </div>
<div> <div>
<label class="title-label" for="poll_description" i18n> <label class="title-label" for="poll_description" i18n>
{{ 'creation.description' | translate }}: {{ 'creation.description' | translate }}:
<framadate-erasable-input [(inputModel)]="config.description"></framadate-erasable-input> <app-erasable-input [(inputModel)]="config.description"></app-erasable-input>
</label> </label>
<br /> <br />
<textarea <textarea
@ -74,7 +74,7 @@
required="required" required="required"
type="email" type="email"
/> />
<framadate-erasable-input [(inputModel)]="config.myEmail"></framadate-erasable-input> <app-erasable-input [(inputModel)]="config.myEmail"></app-erasable-input>
</div> </div>
<button [routerLink]="'/step/answers'" class="btn btn--primary btn--full" *ngIf="config.pollType == 'classic'" i18n> <button [routerLink]="'/step/answers'" class="btn btn--primary btn--full" *ngIf="config.pollType == 'classic'" i18n>

View File

@ -3,7 +3,7 @@ import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component'; import { BaseComponent } from '../example/base-page/base.component';
@Component({ @Component({
selector: 'framadate-home', selector: 'app-home',
templateUrl: './home.component.html', templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'], styleUrls: ['./home.component.scss'],
}) })

View File

@ -3,7 +3,7 @@ import { BaseComponent } from '../example/base-page/base.component';
import { ConfigService } from '../../services/config.service'; import { ConfigService } from '../../services/config.service';
@Component({ @Component({
selector: 'framadate-password', selector: 'app-password',
templateUrl: './password.component.html', templateUrl: './password.component.html',
styleUrls: ['./password.component.scss'], styleUrls: ['./password.component.scss'],
}) })

View File

@ -12,17 +12,17 @@
</div> </div>
<div class="loaded-poll" *ngIf="!config.loading && config.currentPoll"> <div class="loaded-poll" *ngIf="!config.loading && config.currentPoll">
<div id="choices"> <div id="choices">
<framadate-choices-list></framadate-choices-list> <app-choices-list></app-choices-list>
</div> </div>
<div id="table"> <div id="table">
<!-- <framadate-voting-navigation ></framadate-voting-navigation >--> <!-- <app-voting-navigation ></app-voting-navigation >-->
<framadate-voting-summary></framadate-voting-summary> <app-voting-summary></app-voting-summary>
</div> </div>
<div id="poll_comments"> <div id="poll_comments">
<framadate-comments-list></framadate-comments-list> <app-comments-list></app-comments-list>
</div> </div>
<div id="graph"> <div id="graph">
<!--<framadate-voting-graph ></framadate-voting-graph >--> <!--<app-voting-graph ></app-voting-graph >-->
</div> </div>
<div id="export_and_share"> <div id="export_and_share">
<div class="sharing" *ngIf="config.currentPoll"> <div class="sharing" *ngIf="config.currentPoll">
@ -38,7 +38,7 @@
</a> </a>
</p> </p>
<framadate-copy-text [textToCopy]="config.currentPoll.urlPublic"></framadate-copy-text> <app-copy-text [textToCopy]="config.currentPoll.urlPublic"></app-copy-text>
<h3 class="margin-top-x6 margin-btm-x3"> <h3 class="margin-top-x6 margin-btm-x3">
Exporter/Imprimer Exporter/Imprimer
</h3> </h3>

View File

@ -1 +1 @@
@import '../../../../assets/scss/variables'; @import '../../../../styles/variables';

View File

@ -7,7 +7,7 @@ import { environment } from '../../../../environments/environment';
import { mockPoll3 } from '../../../mocks/mock-poll3'; import { mockPoll3 } from '../../../mocks/mock-poll3';
@Component({ @Component({
selector: 'framadate-poll-display', selector: 'app-poll-display',
templateUrl: './poll-display.component.html', templateUrl: './poll-display.component.html',
styleUrls: ['./poll-display.component.scss'], styleUrls: ['./poll-display.component.scss'],
}) })

View File

@ -6,7 +6,7 @@ import { ConfigService } from '../../../services/config.service';
import { mockPoll3 } from '../../../mocks/mock-poll3'; import { mockPoll3 } from '../../../mocks/mock-poll3';
@Component({ @Component({
selector: 'framadate-poll-graphic', selector: 'app-poll-graphic',
templateUrl: './poll-graphic.component.html', templateUrl: './poll-graphic.component.html',
styleUrls: ['./poll-graphic.component.scss'], styleUrls: ['./poll-graphic.component.scss'],
}) })

View File

@ -4,7 +4,7 @@ import { ConfigService } from '../../services/config.service';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@Component({ @Component({
selector: 'framadate-resume', selector: 'app-resume',
templateUrl: './resume.component.html', templateUrl: './resume.component.html',
styleUrls: ['./resume.component.scss'], styleUrls: ['./resume.component.scss'],
}) })

View File

@ -105,7 +105,7 @@
<a [href]="'/#/vote/poll/slug/' + config.customUrl"> <a [href]="'/#/vote/poll/slug/' + config.customUrl">
{{ '#/vote/poll/slug/' + config.customUrl }} {{ '#/vote/poll/slug/' + config.customUrl }}
</a> </a>
<framadate-copy-text [textToCopy]="config.urlPublic"></framadate-copy-text> <app-copy-text [textToCopy]="config.urlPublic"></app-copy-text>
</div> </div>
<br /> <br />
<label for="passwordAccess"> <label for="passwordAccess">
@ -150,7 +150,9 @@
<button (click)="submitCreationAndGoToEnd()" class="btn btn--primary btn--full" i18n="@@confirm"> <button (click)="submitCreationAndGoToEnd()" class="btn btn--primary btn--full" i18n="@@confirm">
{{ 'visibility.validate_btn' | translate }} {{ 'visibility.validate_btn' | translate }}
<i class="fa fa-paper-plane" *ngIf="!config.loading"></i> <ng-container *ngIf="!config.loading">
<i class="fa fa-paper-plane"></i>
</ng-container>
<span class="loading" *ngIf="config.loading"> <span class="loading" *ngIf="config.loading">
<i class="fa fa-refresh fa-spin fa-fw"></i> <i class="fa fa-refresh fa-spin fa-fw"></i>
</span> </span>

View File

@ -1,24 +1,26 @@
import { Location } from '@angular/common';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '../example/base-page/base.component';
import { ConfigService } from '../../services/config.service';
import { environment } from '../../../environments/environment'; import { environment } from '../../../environments/environment';
import { PollUtilities } from '../../config/PollUtilities'; import { PollUtilities } from '../../config/PollUtilities';
import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component';
@Component({ @Component({
selector: 'framadate-visibility', selector: 'app-visibility',
templateUrl: './visibility.component.html', templateUrl: './visibility.component.html',
styleUrls: ['./visibility.component.scss'], styleUrls: ['./visibility.component.scss'],
}) })
export class VisibilityComponent extends BaseComponent implements OnInit { export class VisibilityComponent extends BaseComponent implements OnInit {
showCustomPassword = false; public location: Location;
baseUrl = environment.api.baseHref; public showCustomPassword = false;
environment = environment; public baseUrl = environment.api.baseHref;
constructor(public config: ConfigService, public utils: PollUtilities) { constructor(public config: ConfigService, public utils: PollUtilities) {
super(config); super(config);
} }
ngOnInit() { ngOnInit(): void {
this.config.customUrl = this.utils.makeSlug(this.config); this.config.customUrl = this.utils.makeSlug(this.config);
this.config.expirationDate = this.config this.config.expirationDate = this.config
.addDaysToDate(this.config.expiracyDateDefaultInDays, new Date()) .addDaysToDate(this.config.expiracyDateDefaultInDays, new Date())
@ -26,7 +28,7 @@ export class VisibilityComponent extends BaseComponent implements OnInit {
.substring(0, 10); .substring(0, 10);
} }
submitCreationAndGoToEnd() { public submitCreationAndGoToEnd(): void {
this.config.createPoll(); this.config.createPoll();
} }
} }

View File

@ -1,11 +1,11 @@
<div *ngIf="config.currentPoll" class="list-of-choices"> <div *ngIf="config.currentPoll" class="list-of-choices">
<div *ngFor="let choice of config.currentPoll.choices"> <div *ngFor="let choice of config.currentPoll.choices">
<framadate-voting-choice <app-voting-choice
[choice]="choice" [choice]="choice"
[choices_count]="config.currentPoll.choices_count" [choices_count]="config.currentPoll.choices_count"
[pollIsSpecialDate]="config.currentPoll.poll.kind == 'date'" [pollIsSpecialDate]="config.currentPoll.poll.kind == 'date'"
[poll]="config.currentPoll" [poll]="config.currentPoll"
></framadate-voting-choice> ></app-voting-choice>
</div> </div>
</div> </div>
@ -24,6 +24,6 @@
(click)="config.updateVote(config.myVoteStack)" (click)="config.updateVote(config.myVoteStack)"
*ngIf="config.myVoteStack && config.myVoteStack.id" *ngIf="config.myVoteStack && config.myVoteStack.id"
> >
<i class="fa fa-pencil"></i> Mettre à jour <i class="fa fa-edit"></i> Mettre à jour
</button> </button>
</div> </div>

View File

@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { ConfigService } from '../../../services/config.service'; import { ConfigService } from '../../../services/config.service';
@Component({ @Component({
selector: 'framadate-choices-list', selector: 'app-choices-list',
templateUrl: './choices-list.component.html', templateUrl: './choices-list.component.html',
styleUrls: ['./choices-list.component.scss'], styleUrls: ['./choices-list.component.scss'],
}) })

View File

@ -28,7 +28,6 @@
(click)="config.addComment()" (click)="config.addComment()"
/> />
<div class="comments-part" *ngIf="config.currentPoll"> <div class="comments-part" *ngIf="config.currentPoll">
<framadate-voting-comment [comment]="c" *ngFor="let c of config.currentPoll.comments"> <app-voting-comment [comment]="c" *ngFor="let c of config.currentPoll.comments"> </app-voting-comment>
</framadate-voting-comment>
</div> </div>
</div> </div>

View File

@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { ConfigService } from '../../../services/config.service'; import { ConfigService } from '../../../services/config.service';
@Component({ @Component({
selector: 'framadate-comments-list', selector: 'app-comments-list',
templateUrl: './comments-list.component.html', templateUrl: './comments-list.component.html',
styleUrls: ['./comments-list.component.scss'], styleUrls: ['./comments-list.component.scss'],
}) })

View File

@ -5,7 +5,7 @@
class="btn btn--primary manage" class="btn btn--primary manage"
(click)="choice.simpleAnswer = !choice.simpleAnswer" (click)="choice.simpleAnswer = !choice.simpleAnswer"
> >
<i class="fa fa-gears"></i> <i class="fa fa-cogs"></i>
</button> </button>
<div class="choicebox__subject"> <div class="choicebox__subject">

View File

@ -5,7 +5,7 @@
// -- IMPORTS // -- IMPORTS
// ---------------------------- // ----------------------------
@import '../../../../assets/scss/variables'; @import '../../../../styles/variables';
// -- VARIABLES // -- VARIABLES
// ---------------------------- // ----------------------------

View File

@ -20,7 +20,7 @@ interface VoteChoice {
* this component is used to select a date choice, or a name answer * this component is used to select a date choice, or a name answer
*/ */
@Component({ @Component({
selector: 'framadate-voting-choice', selector: 'app-voting-choice',
templateUrl: './voting-choice.component.html', templateUrl: './voting-choice.component.html',
styleUrls: ['./voting-choice.component.scss'], styleUrls: ['./voting-choice.component.scss'],
}) })

View File

@ -2,7 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { mockComments } from '../../../mocks/mock-comments'; import { mockComments } from '../../../mocks/mock-comments';
@Component({ @Component({
selector: 'framadate-voting-comment', selector: 'app-voting-comment',
templateUrl: './voting-comment.component.html', templateUrl: './voting-comment.component.html',
styleUrls: ['./voting-comment.component.scss'], styleUrls: ['./voting-comment.component.scss'],
}) })

View File

@ -1,2 +1,2 @@
<h1>Graphique</h1> <h1>Graphique</h1>
<framadate-poll-graphic></framadate-poll-graphic> <app-poll-graphic></app-poll-graphic>

Some files were not shown because too many files have changed in this diff Show More