diff --git a/.storybook/main.js b/.storybook/main.js
deleted file mode 100644
index ec3f5802..00000000
--- a/.storybook/main.js
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- stories: ['../src/**/*.stories.ts'],
- addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-notes'],
-};
diff --git a/.storybook/tsconfig.json b/.storybook/tsconfig.json
deleted file mode 100644
index 0bcfc758..00000000
--- a/.storybook/tsconfig.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "extends": "../tsconfig.app.json",
- "compilerOptions": {
- "types": [
- "node"
- ]
- },
- "exclude": [
- "../src/test.ts",
- "../src/**/*.spec.ts",
- "../projects/**/*.spec.ts"
- ],
- "include": [
- "../src/**/*",
- "../projects/**/*"
- ],
- "files": [
- "./typings.d.ts"
- ]
-}
diff --git a/.storybook/typings.d.ts b/.storybook/typings.d.ts
deleted file mode 100644
index f73d61b3..00000000
--- a/.storybook/typings.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-declare module '*.md' {
- const content: string;
- export default content;
-}
diff --git a/README.md b/README.md
index ed18df21..bc181dae 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,26 @@
## LIBRARIES USED
-| lib name | usage |
-| ------------------------------------------------------------------ | -------------------------------------- |
-| [axios](https://github.com/axios/axios) | http client |
-| [bulma](https://bulma.io/) | CSS framework |
-| [chart.js](https://www.chartjs.org/) | Generate beautiful graphs |
-| [compodoc](https://compodoc.app/) | Generate technic documentation |
-| [date-fns](https://date-fns.org) | manipulate dates |
-| ESlint, Prettier, Lint-staged | Format & lint code |
-| [font-awesome](https://github.com/FortAwesome/angular-fontawesome) | Icons collection |
-| [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
-| [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
-| [jest](https://jestjs.io/) | test engine |
-| [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
-| [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
-| [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
-| [ngx-toaster](https://www.npmjs.com/package/ngx-toaster) | toast notifications |
-| [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
-| [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
-| [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
-| [storybook](https://storybook.js.org/) | StyleGuide UI |
-| [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
-| [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
+| status | lib name | usage |
+| ------- | -------------------------------------------------------------- | -------------------------------------- |
+| | [axios](https://github.com/axios/axios) | http client |
+| | [bulma](https://bulma.io/) | CSS framework |
+| | [chart.js](https://www.chartjs.org/) | Display graphs. (Commes with MomentJS) |
+| | [compodoc](https://compodoc.app/) | Generate technic documentation |
+| | [date-fns](https://date-fns.org) | manipulate dates |
+| | ESlint, Prettier, Lint-staged | Format & lint code |
+| | [fork-awesome](https://forkaweso.me) | Icons collection |
+| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
+| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
+| | [jest](https://jestjs.io/) | test engine |
+| removed | [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
+| | [ngx-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
+| | [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
+| | [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
+| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
+| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
+| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
+| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
+| | [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
---
diff --git a/angular.json b/angular.json
index 375890f2..57ef5b25 100644
--- a/angular.json
+++ b/angular.json
@@ -12,7 +12,7 @@
},
"root": "",
"sourceRoot": "src",
- "prefix": "framadate",
+ "prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
@@ -22,17 +22,13 @@
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
- "aot": true,
- "assets": [
- "src/favicon.ico",
- "src/assets"
- ],
+ "assets": ["src/favicon.ico", "src/assets"],
"styles": [
+ "node_modules/fork-awesome/css/fork-awesome.min.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/primeng.min.css",
- "src/assets/scss/styles.scss"
+ "src/styles.scss"
],
"scripts": [
"node_modules/marked/lib/marked.js",
@@ -53,9 +49,11 @@
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
+ "aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
+ "crossOrigin": "anonymous",
"budgets": [
{
"type": "initial",
@@ -90,20 +88,13 @@
},
"test": {
"builder": "@angular-builders/jest:run",
- "options": {
- }
+ "options": {}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
- "tsConfig": [
- "tsconfig.app.json",
- "tsconfig.spec.json",
- "e2e/tsconfig.json"
- ],
- "exclude": [
- "**/node_modules/**"
- ]
+ "tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
+ "exclude": ["**/node_modules/**"]
}
},
"e2e": {
@@ -121,5 +112,8 @@
}
}
},
- "defaultProject": "framadate"
+ "defaultProject": "framadate",
+ "cli": {
+ "analytics": "0ba9c0a9-850f-4c5f-8124-cbe6f4c79ef1"
+ }
}
diff --git a/babel.config.json b/babel.config.json
new file mode 100644
index 00000000..526ddfd8
--- /dev/null
+++ b/babel.config.json
@@ -0,0 +1,3 @@
+{
+ "presets": ["@babel/preset-env"]
+}
diff --git a/backend-api-endpoints-doc.md b/backend-api-endpoints-doc.md
deleted file mode 100644
index 2f337e05..00000000
--- a/backend-api-endpoints-doc.md
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * -------------------------- -------- -------- ------ ------------------------------------------------
- Name Method Scheme Host Path
- -------------------------- -------- -------- ------ ------------------------------------------------
- _twig_error_test ANY ANY ANY /_error/{code}.{_format}
- api_get_poll_comment GET ANY ANY /poll/{id}/comments
- api_new_comment POST ANY ANY /poll/{id}/comment
- api_poll_comments_delete DELETE ANY ANY /poll/{id}/comments
- api_send_user_polls GET ANY ANY /send-polls-to-user/{email}
- homepageget_default GET ANY ANY /
- api_get_all_polls GET ANY ANY /poll/
- api_get_poll GET ANY ANY /poll/{id}
- api_update_poll PUT ANY ANY /poll/{id}/{token}
- api_new_poll POST ANY ANY /poll/
- api_test-mail-poll GET ANY ANY /poll/mail/test-mail-poll/{emailChoice}
- api_poll_delete DELETE ANY ANY /poll/{id}
- api_clean_expired_polls GET ANY ANY /poll/clean-polls
- api_check_slug_is_unique GET ANY ANY /poll/admin/{token}
- api_new_vote_stack POST ANY ANY /poll/{id}/vote
- api_update_vote_stack PATCH ANY ANY /vote-stack/{id}/token/{modifierToken}
- api_poll_votes_delete DELETE ANY ANY /poll/{id}/votes/{accessToken}
- app.swagger GET ANY ANY /doc.json
- -------------------------- -------- -------- ------ ------------------------------------------------
- */
-
-/**
- * WANTED CHANGES (seraf)
- * -------------------------- -------- -------- ------ ------------------------------------------------
- Name Method Scheme Host Path
- -------------------------- -------- -------- ------ ------------------------------------------------
- api_get_poll_comment GET ANY ANY /poll/{id}/comment
- api_delete_poll_comments DELETE ANY ANY /poll/{id}/comment
- api_user_polls_send_by_email GET ANY ANY /user/{email}/polls/send-by-email
- api_get_user_polls GET ANY ANY /user/{email}/polls
- api_get_poll_slug GET ANY ANY /poll/slug/{id}/{token}
- api_clean_expired_polls GET ANY ANY /admin/clean-polls/{token}
-
- api_test-mail-poll GET ANY ANY /poll/mail/test-mail-poll/{emailChoice}
- api_update_vote_stack PATCH ANY ANY /vote-stack/{id}/token/{modifierToken}
- -------------------------- -------- -------- ------ ------------------------------------------------
- */
diff --git a/backend-api-endpoints-doc.txt b/backend-api-endpoints-doc.txt
new file mode 100644
index 00000000..a134d711
--- /dev/null
+++ b/backend-api-endpoints-doc.txt
@@ -0,0 +1,46 @@
+// TODO: File to be deleted : just temporary documentation of backend API endpoints
+
+/**
+ *
+ * -------------------------- -------- -------- ------ ------------------------------------------------
+ Name Method Scheme Host Path
+ -------------------------- -------- -------- ------ ------------------------------------------------
+_twig_error_test ANY ANY ANY /_error/{code}.{_format}
+admin_homepage_get_default GET ANY ANY /admin/
+admin_homepage_clean_expired_polls GET ANY ANY /admin/polls/clean/{token}
+api_get_poll_comment GET ANY ANY /polls/{id}/comments
+api_new_comment POST ANY ANY /polls/{id}/comments
+api_poll_comments_delete DELETE ANY ANY /polls/{id}/comments
+user_homepageget_default GET ANY ANY /users/
+user_homepage_polls_send_by_email GET ANY ANY /users/{email}/polls/send-by-email
+api_get_all_polls GET ANY ANY /polls/
+api_get_poll GET ANY ANY /polls/{id}
+api_update_poll PUT ANY ANY /polls/{id}/{token}
+api_new_poll POST ANY ANY /polls/
+api_test-mail-polls GET ANY ANY /polls/mail/test-mail-polls/{emailChoice}
+api_poll_delete DELETE ANY ANY /polls/{id}
+api_check_slug_is_unique GET ANY ANY /polls/slugs/{slug}
+api_get_admin_config GET ANY ANY /polls/admin/{token}
+api_new_vote_stack POST ANY ANY /polls/{id}/votes
+api_update_vote_stack PATCH ANY ANY /votes-stacks/{id}/token/{modifierToken}
+api_poll_votes_delete DELETE ANY ANY /polls/{id}/votes/{accessToken}
+app.swagger GET ANY ANY /api/doc.json
+ -------------------------- -------- -------- ------ ------------------------------------------------
+ */
+
+/**
+ * WANTED CHANGES (seraf)
+ * -------------------------- -------- -------- ------ ------------------------------------------------
+ Name Method Scheme Host Path
+ -------------------------- -------- -------- ------ ------------------------------------------------
+ api_get_poll_comment GET ANY ANY /polls/{id}/comment
+ api_delete_poll_comments DELETE ANY ANY /polls/{id}/comment
+ api_user_polls_send_by_email GET ANY ANY /users/{email}/polls/send-by-email
+ api_get_user_polls GET ANY ANY /users/{email}/polls
+ api_get_poll_slug GET ANY ANY /polls/slug/{id}/{token}
+ api_clean_expired_polls GET ANY ANY /admin/clean-polls/{token}
+
+ api_test-mail-polls GET ANY ANY /polls/mail/test-mail-polls/{emailChoice}
+ api_update_vote_stack PATCH ANY ANY /votes-stack/{id}/token/{modifierToken}
+ -------------------------- -------- -------- ------ ------------------------------------------------
+ */
diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json
index 39b800f7..ce6ba906 100644
--- a/e2e/tsconfig.json
+++ b/e2e/tsconfig.json
@@ -1,13 +1,9 @@
{
- "extends": "../tsconfig.json",
- "compilerOptions": {
- "outDir": "../out-tsc/e2e",
- "module": "commonjs",
- "target": "es5",
- "types": [
- "jasmine",
- "jasminewd2",
- "node"
- ]
- }
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/e2e",
+ "module": "commonjs",
+ "target": "es5",
+ "types": ["jasmine", "jasminewd2", "node"]
+ }
}
diff --git a/jest.config.js b/jest.config.js
deleted file mode 100644
index 6f6675dd..00000000
--- a/jest.config.js
+++ /dev/null
@@ -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;
diff --git a/package.json b/package.json
index 81d1677e..0a841ba6 100644
--- a/package.json
+++ b/package.json
@@ -1,15 +1,12 @@
{
"name": "framadate-funky-frontend",
"version": "1.0.0",
- "licence": "AGPL-3.0-or-later",
+ "license": "AGPL-3.0-or-later",
"scripts": {
"ng": "ng",
"start": "ng serve",
- "compodoc": "compodoc -p tsconfig.json",
- "build": "ng build --crossOrigin=anonymous --prod",
- "package": "cat dist/framadate/*.js > dist/framadate/framadate-scripts-bundled.js && ls -l dist/framadate",
- "bld:pkg": "npm run build && npm run package",
- "build:demo": "ng build --crossOrigin=anonymous --extractCss=true --progress=true --prod && npm run package",
+ "build": "ng build --prod --progress=true",
+ "build-prod-stats": "ng build --prod --stats-json",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
@@ -18,13 +15,12 @@
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
"format:all": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
- "storybook": "start-storybook -p 6006",
- "build-storybook": "build-storybook"
+ "compodoc": "compodoc -p tsconfig.app.json"
},
"private": false,
"dependencies": {
"@angular/animations": "^9.1.1",
- "@angular/cdk": "^9.2.0",
+ "@angular/cdk": "^9.2.2",
"@angular/common": "^9.0.7",
"@angular/compiler": "^9.0.7",
"@angular/core": "^9.0.7",
@@ -39,57 +35,50 @@
"angular-date-value-accessor": "^1.0.2",
"axios": "^0.19.2",
"bulma": "^0.8.2",
- "chart.js": "^2.8.0",
+ "chart.js": "^2.9.3",
"date-fns": "^2.12.0",
- "font-awesome": "^4.7.0",
- "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",
+ "fork-awesome": "^1.1.7",
"ngx-clipboard": "^13.0.0",
"ngx-markdown": "^9.0.0",
- "ngx-toaster": "^1.0.1",
+ "ngx-webstorage": "^5.0.0",
"primeicons": "^2.0.0",
- "primeng": "^9.0.5",
+ "primeng": "^9.0.6",
"quill": "^1.3.7",
"rxjs": "^6.5.5",
"rxjs-compat": "^6.5.5",
"tslib": "^1.11.1",
- "uuid": "^7.0.3",
+ "uuid": "^8.0.0",
"zone.js": "^0.10.3"
},
"devDependencies": {
"@angular-builders/jest": "^9.0.1",
- "@angular-devkit/build-angular": "^0.901.1",
- "@angular/cli": "^9.0.7",
+ "@angular-devkit/build-angular": "^0.901.2",
+ "@angular/cli": "^9.1.2",
"@angular/compiler-cli": "^9.1.1",
"@angular/language-service": "^9.0.7",
"@babel/core": "^7.9.0",
- "@storybook/addon-actions": "^5.3.18",
- "@storybook/addon-links": "^5.3.18",
- "@storybook/addon-notes": "^5.3.18",
- "@storybook/addons": "^5.3.18",
- "@storybook/angular": "^5.3.18",
- "@types/jasminewd2": "~2.0.8",
+ "@babel/preset-env": "^7.9.5",
+ "@babel/preset-typescript": "^7.9.0",
+ "@compodoc/compodoc": "^1.1.11",
"@types/jest": "^25.2.1",
- "@types/node": "^13.11.1",
+ "@types/node": "^13.13.2",
"@types/uuid": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
- "babel-loader": "^8.1.0",
- "compodoc": "^0.0.41",
+ "babel-jest": "^25.4.0",
"eslint": "^6.8.0",
- "eslint-config-prettier": "^6.10.1",
+ "eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
- "jasmine-core": "~3.5.0",
- "jasmine-spec-reporter": "~5.0.1",
- "jest": "^25.3.0",
- "lint-staged": "^10.1.3",
- "prettier": "^2.0.4",
+ "jest": "^25.5.1",
+ "jest-environment-jsdom-sixteen": "^1.0.3",
+ "jest-preset-angular": "^8.1.3",
+ "lint-staged": "^10.1.7",
+ "prettier": "^2.0.5",
"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"
},
"husky": {
@@ -106,6 +95,13 @@
},
"jest": {
"preset": "jest-preset-angular",
- "setupFilesAfterEnv": "./jest.config.js"
+ "setupFilesAfterEnv": [
+ "/src/jest.setup.ts"
+ ],
+ "testEnvironment": "jest-environment-jsdom-sixteen",
+ "transform": {
+ "^.+\\.(ts|html)$": "ts-jest",
+ "^.+\\.jsx?$": "babel-jest"
+ }
}
}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 3bd0ec77..93f2c91c 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -1,49 +1,35 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
-import { AdminComponent } from './pages/admin/admin.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 { DatesComponent } from './pages/dates/dates.component';
-import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
-import { HomeComponent } from './pages/home/home.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 { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component';
-import { ResumeComponent } from './pages/resume/resume.component';
-import { VisibilityComponent } from './pages/visibility/visibility.component';
-import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component';
-import { VotingComponent } from './pages/voting/voting.component';
-import { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
+import { HomeComponent } from './core/components/home/home.component';
+import { LoginComponent } from './core/components/login/login.component';
+import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.component';
const routes: Routes = [
- { path: '', redirectTo: 'step/creation', pathMatch: 'full' },
- { path: 'admin/:token', component: AdminComponent }, // http://localhost:4200/#/admin/srfdgedsTGETHRYJtujTUjTUkTIUKTK
- { path: 'home', component: HomeComponent },
- { path: 'base', component: BaseComponent },
- { path: 'step/base', component: BaseComponent },
- { path: 'step/creation', component: CreateOrRetrieveComponent },
- { path: 'step/date', component: DatesComponent },
- { path: 'step/kind', component: KindComponent },
- { path: 'step/answers', component: AnswersComponent },
- { path: 'step/admin', component: AdminComponent },
- { path: 'step/pictures', component: PicturesComponent },
- { path: 'step/visibility', component: VisibilityComponent },
- { path: 'step/resume', component: ResumeComponent },
- { path: 'step/end', component: EndConfirmationComponent },
- { path: 'graphic/:poll', component: PollGraphicComponent },
- { path: 'vote/poll/id/:poll', component: PollDisplayComponent },
- { path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent },
- { path: 'votingchoice', component: VotingChoiceComponent },
- { path: 'voting', component: VotingComponent },
- { path: 'step/password', component: PasswordComponent },
- { path: '**', redirectTo: '/home', pathMatch: 'full' },
+ { path: '', component: HomeComponent },
+ { path: 'login', component: LoginComponent },
+ {
+ 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: 'oldstuff',
+ loadChildren: () => import('./features/old-stuff/old-stuff.module').then((m) => m.OldStuffModule),
+ },
+ { path: '**', component: PageNotFoundComponent },
];
@NgModule({
- imports: [RouterModule.forRoot(routes, { useHash: true, anchorScrolling: 'enabled' })],
+ imports: [
+ RouterModule.forRoot(routes, {
+ // enableTracing: true, // <-- debugging purposes only
+ }),
+ ],
exports: [RouterModule],
})
export class AppRoutingModule {}
diff --git a/src/app/app.component.html b/src/app/app.component.html
index a1039ab2..5fe0ccca 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,31 +1,15 @@
-
-
+
+
+
+
+
+
+
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index 603699f0..e69de29b 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -1,13 +0,0 @@
-@charset "UTF-8";
-
-.big-header {
- padding: 0.5rem;
-}
-
-i {
- display: block;
-}
-
-.language-selector {
- width: auto;
-}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index b758854d..8cd65e6f 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,55 +1,57 @@
-import { Component, Inject } from '@angular/core';
-import { TranslateService } from '@ngx-translate/core';
-import { NavigationStart, Router } from '@angular/router';
-import { DOCUMENT } from '@angular/common';
-import { filter } from 'rxjs/operators';
-import { ConfigService } from './services/config.service';
+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 { UserRole } from './core/enums/user-role.enum';
+import { MockingService } from './core/services/mocking.service';
+import { ThemeService } from './core/services/theme.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
-export class AppComponent {
- step: string;
- isDevelopmentEnv = false;
+export class AppComponent implements OnInit, OnDestroy {
+ public appTitle: string = environment.appTitle;
+ public themeClass: string;
+ public isSidebarOpened = false;
+ private themeSubscription: Subscription;
constructor(
- private translate: TranslateService,
- public config: ConfigService,
- @Inject(DOCUMENT) private document,
- private route: Router
- ) {
- this.detectCurrentTabOnRouteChange();
+ private titleService: Title,
+ private themeService: ThemeService,
+ private mockingService: MockingService
+ ) {}
- this.isDevelopmentEnv = !environment.production;
- }
-
- detectCurrentTabOnRouteChange() {
- this.route.events.subscribe((event: any) => {});
- this.route.events
- .pipe(filter((event) => event instanceof NavigationStart))
- .subscribe((event: NavigationStart) => {
- this.scrollGoToTop();
- this.updateCurrentTab(event);
- // only if there is a poll ID
- this.config.fetchPollFromRoute(event);
- });
- }
-
- scrollGoToTop() {
- this.document.documentElement.scrollTop = 0;
- }
-
- updateCurrentTab(event) {
- if (event.url) {
- const tab = event.url.split('/');
- if (tab && tab[2]) {
- this.step = tab[2];
- } else {
- this.step = 'home';
+ ngOnInit(): void {
+ if (!environment.production) {
+ this.appTitle += ' [DEV]';
+ this.mockingService.loadUser(UserRole.REGISTERED);
+ }
+ 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';
}
+ });
+ }
+
+ ngOnDestroy(): void {
+ if (this.themeSubscription) {
+ this.themeSubscription.unsubscribe();
}
}
+
+ public toggleSidebar(status: boolean): void {
+ this.isSidebarOpened = status === true;
+ }
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 2129d80b..06a910e4 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,10 +1,8 @@
-import { CommonModule, registerLocaleData } from '@angular/common';
+import { CommonModule } from '@angular/common';
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 { 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 {
MissingTranslationHandler,
@@ -16,127 +14,54 @@ import {
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { ClipboardModule } from 'ngx-clipboard';
import { MarkdownModule } from 'ngx-markdown';
-import { ConfirmationService, MessageModule, MessageService } from 'primeng';
-import { ConfirmDialogModule } from 'primeng/confirmdialog';
-import { DialogModule } from 'primeng/dialog';
-import { ToastModule } from 'primeng/toast';
+import { NgxWebstorageModule } from 'ngx-webstorage';
+import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
-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 { 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 { DatesComponent } from './pages/dates/dates.component';
-import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
-import { HomeComponent } from './pages/home/home.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 { PollDisplayComponent } from './pages/poll/poll-display/poll-display.component';
-import { ResumeComponent } from './pages/resume/resume.component';
-import { VisibilityComponent } from './pages/visibility/visibility.component';
-import { ChoicesListComponent } from './pages/voting/choices-list/choices-list.component';
-import { CommentsListComponent } from './pages/voting/comments-list/comments-list.component';
-import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component';
-import { VotingCommentComponent } from './pages/voting/voting-comment/voting-comment.component';
-import { VotingGraphComponent } from './pages/voting/voting-graph/voting-graph.component';
-import { VotingNavigationComponent } from './pages/voting/voting-navigation/voting-navigation.component';
-import { VotingSummaryComponent } from './pages/voting/voting-summary/voting-summary.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 { CopyTextComponent } from './ui/copy-text/copy-text.component';
-import { ResettableInputDirective } from './ui/directives/resettable-input.directive';
-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 { 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 { CoreModule } from './core/core.module';
+import { OldStuffModule } from './features/old-stuff/old-stuff.module';
+import { SharedModule } from './shared/shared.module';
export class MyMissingTranslationHandler implements MissingTranslationHandler {
- handle(params: MissingTranslationHandlerParams) {
- return 'some value';
+ public handle(params: MissingTranslationHandlerParams): string {
+ return `MISSING TRANSLATION FOR [${params.key}]`;
}
}
-registerLocaleData(localeFr, 'fr');
-registerLocaleData(localeEn, 'en');
-
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http);
}
@NgModule({
- declarations: [
- AppComponent,
- BaseComponent,
- KindComponent,
- HeaderComponent,
- NavigationComponent,
- DatesComponent,
- DebuggerComponent,
- VisibilityComponent,
- ResumeComponent,
- PicturesComponent,
- AnswersComponent,
- EndConfirmationComponent,
- CreateOrRetrieveComponent,
- VotingSummaryComponent,
- VotingGraphComponent,
- VotingChoiceComponent,
- PasswordComponent,
- HomeComponent,
- PollGraphicComponent,
- AdminComponent,
- SelectorComponent,
- PollDisplayComponent,
- VotingComponent,
- VotingCommentComponent,
- ResettableInputDirective,
- ErasableInputComponent,
- CopyTextComponent,
- CommentsListComponent,
- ChoicesListComponent,
- VotingNavigationComponent,
- ThemeSelectorComponent,
- MasterHeadComponent,
- LanguageComponent,
- TwoLinksComponent,
- ],
+ declarations: [AppComponent],
imports: [
- ConfirmDialogModule,
+ AppRoutingModule,
+ BrowserAnimationsModule,
+ BrowserModule,
ClipboardModule,
CommonModule,
- BrowserModule,
- DialogModule,
- DateValueAccessorModule,
- BrowserAnimationsModule,
- AppRoutingModule,
- ToastModule,
- MessageModule,
+ CoreModule,
+ FormsModule,
+ HttpClientModule,
MarkdownModule.forRoot(),
+ NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
+ SharedModule,
TranslateModule.forRoot({
- missingTranslationHandler: {
- provide: MissingTranslationHandler,
- useClass: MyMissingTranslationHandler,
- },
- // useDefaultLang: false,
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient],
},
+ missingTranslationHandler: {
+ provide: MissingTranslationHandler,
+ useClass: MyMissingTranslationHandler,
+ },
+ useDefaultLang: false,
}),
- HttpClientModule,
- FormsModule,
+ OldStuffModule,
],
- providers: [TranslateService, ConfigService, MessageService, ConfirmationService],
+ providers: [Title, TranslateService],
bootstrap: [AppComponent],
})
export class AppModule {}
diff --git a/src/app/core/components/footer/footer.component.html b/src/app/core/components/footer/footer.component.html
new file mode 100644
index 00000000..46e0b269
--- /dev/null
+++ b/src/app/core/components/footer/footer.component.html
@@ -0,0 +1,9 @@
+
diff --git a/src/app/pages/answers/answers.component.scss b/src/app/core/components/footer/footer.component.scss
similarity index 100%
rename from src/app/pages/answers/answers.component.scss
rename to src/app/core/components/footer/footer.component.scss
diff --git a/src/app/ui/debugger/debugger.component.spec.ts b/src/app/core/components/footer/footer.component.spec.ts
similarity index 54%
rename from src/app/ui/debugger/debugger.component.spec.ts
rename to src/app/core/components/footer/footer.component.spec.ts
index 16036bd7..525ec46b 100644
--- a/src/app/ui/debugger/debugger.component.spec.ts
+++ b/src/app/core/components/footer/footer.component.spec.ts
@@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { DebuggerComponent } from './debugger.component';
+import { FooterComponent } from './footer.component';
-describe('DebuggerComponent', () => {
- let component: DebuggerComponent;
- let fixture: ComponentFixture
;
+describe('FooterComponent', () => {
+ let component: FooterComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [DebuggerComponent],
+ declarations: [FooterComponent],
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(DebuggerComponent);
+ fixture = TestBed.createComponent(FooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/core/components/footer/footer.component.ts b/src/app/core/components/footer/footer.component.ts
new file mode 100644
index 00000000..8a83f1ec
--- /dev/null
+++ b/src/app/core/components/footer/footer.component.ts
@@ -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 {}
+}
diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html
new file mode 100644
index 00000000..3a3e0b95
--- /dev/null
+++ b/src/app/core/components/header/header.component.html
@@ -0,0 +1,74 @@
+
diff --git a/src/app/ui/navigation/header/header.component.scss b/src/app/core/components/header/header.component.scss
similarity index 100%
rename from src/app/ui/navigation/header/header.component.scss
rename to src/app/core/components/header/header.component.scss
diff --git a/src/app/ui/navigation/header/header.component.spec.ts b/src/app/core/components/header/header.component.spec.ts
similarity index 100%
rename from src/app/ui/navigation/header/header.component.spec.ts
rename to src/app/core/components/header/header.component.spec.ts
diff --git a/src/app/core/components/header/header.component.ts b/src/app/core/components/header/header.component.ts
new file mode 100644
index 00000000..245b95a0
--- /dev/null
+++ b/src/app/core/components/header/header.component.ts
@@ -0,0 +1,16 @@
+import { Component, EventEmitter, Output, Input } from '@angular/core';
+
+@Component({
+ selector: 'app-header',
+ templateUrl: './header.component.html',
+ styleUrls: ['./header.component.scss'],
+})
+export class HeaderComponent {
+ @Input() isSidebarOpened: boolean;
+ @Output() toggleSidebarEE = new EventEmitter();
+
+ public toggleSidebarOpening(): void {
+ this.isSidebarOpened = !this.isSidebarOpened;
+ this.toggleSidebarEE.emit(this.isSidebarOpened);
+ }
+}
diff --git a/src/app/core/components/home/home.component.html b/src/app/core/components/home/home.component.html
new file mode 100644
index 00000000..514e3526
--- /dev/null
+++ b/src/app/core/components/home/home.component.html
@@ -0,0 +1,19 @@
+
+
+
+
+ Bienvenue sur Framasondage
+
+
+ Se consulter simplement pour s’organiser collectivement.
+
+
+
+
+
diff --git a/src/app/pages/home/home.component.scss b/src/app/core/components/home/home.component.scss
similarity index 100%
rename from src/app/pages/home/home.component.scss
rename to src/app/core/components/home/home.component.scss
diff --git a/src/app/pages/home/home.component.spec.ts b/src/app/core/components/home/home.component.spec.ts
similarity index 100%
rename from src/app/pages/home/home.component.spec.ts
rename to src/app/core/components/home/home.component.spec.ts
diff --git a/src/app/core/components/home/home.component.ts b/src/app/core/components/home/home.component.ts
new file mode 100644
index 00000000..4aeb12a4
--- /dev/null
+++ b/src/app/core/components/home/home.component.ts
@@ -0,0 +1,12 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-home',
+ templateUrl: './home.component.html',
+ styleUrls: ['./home.component.scss'],
+})
+export class HomeComponent implements OnInit {
+ constructor() {}
+
+ ngOnInit(): void {}
+}
diff --git a/src/app/core/components/login/login.component.html b/src/app/core/components/login/login.component.html
new file mode 100644
index 00000000..147cfc4f
--- /dev/null
+++ b/src/app/core/components/login/login.component.html
@@ -0,0 +1 @@
+login works!
diff --git a/src/app/pages/example/base-page/base.component.scss b/src/app/core/components/login/login.component.scss
similarity index 100%
rename from src/app/pages/example/base-page/base.component.scss
rename to src/app/core/components/login/login.component.scss
diff --git a/src/app/ui/selector/selector.component.spec.ts b/src/app/core/components/login/login.component.spec.ts
similarity index 54%
rename from src/app/ui/selector/selector.component.spec.ts
rename to src/app/core/components/login/login.component.spec.ts
index 742b8307..486bf2bc 100644
--- a/src/app/ui/selector/selector.component.spec.ts
+++ b/src/app/core/components/login/login.component.spec.ts
@@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { SelectorComponent } from './selector.component';
+import { LoginComponent } from './login.component';
-describe('SelectorComponent', () => {
- let component: SelectorComponent;
- let fixture: ComponentFixture;
+describe('LoginComponent', () => {
+ let component: LoginComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [SelectorComponent],
+ declarations: [LoginComponent],
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(SelectorComponent);
+ fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/core/components/login/login.component.ts b/src/app/core/components/login/login.component.ts
new file mode 100644
index 00000000..a062274e
--- /dev/null
+++ b/src/app/core/components/login/login.component.ts
@@ -0,0 +1,12 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-login',
+ templateUrl: './login.component.html',
+ styleUrls: ['./login.component.scss'],
+})
+export class LoginComponent implements OnInit {
+ constructor() {}
+
+ ngOnInit(): void {}
+}
diff --git a/src/app/ui/navigation/master-head/master-head.component.html b/src/app/core/components/logo/logo.component.html
similarity index 50%
rename from src/app/ui/navigation/master-head/master-head.component.html
rename to src/app/core/components/logo/logo.component.html
index 173c8082..f8ebc8a3 100644
--- a/src/app/ui/navigation/master-head/master-head.component.html
+++ b/src/app/core/components/logo/logo.component.html
@@ -1,14 +1,13 @@
diff --git a/src/app/pages/example/pictures/pictures.component.scss b/src/app/core/components/logo/logo.component.scss
similarity index 100%
rename from src/app/pages/example/pictures/pictures.component.scss
rename to src/app/core/components/logo/logo.component.scss
diff --git a/src/app/ui/selector/language/language.component.spec.ts b/src/app/core/components/logo/logo.component.spec.ts
similarity index 54%
rename from src/app/ui/selector/language/language.component.spec.ts
rename to src/app/core/components/logo/logo.component.spec.ts
index 449fbbac..a8479ff8 100644
--- a/src/app/ui/selector/language/language.component.spec.ts
+++ b/src/app/core/components/logo/logo.component.spec.ts
@@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { LanguageComponent } from './language.component';
+import { LogoComponent } from './logo.component';
-describe('LanguageComponent', () => {
- let component: LanguageComponent;
- let fixture: ComponentFixture;
+describe('LogoComponent', () => {
+ let component: LogoComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [LanguageComponent],
+ declarations: [LogoComponent],
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(LanguageComponent);
+ fixture = TestBed.createComponent(LogoComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/core/components/logo/logo.component.ts b/src/app/core/components/logo/logo.component.ts
new file mode 100644
index 00000000..3e4896ca
--- /dev/null
+++ b/src/app/core/components/logo/logo.component.ts
@@ -0,0 +1,8 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-logo',
+ templateUrl: './logo.component.html',
+ styleUrls: ['./logo.component.scss'],
+})
+export class LogoComponent {}
diff --git a/src/app/core/components/selectors/language-selector/language-selector.component.html b/src/app/core/components/selectors/language-selector/language-selector.component.html
new file mode 100644
index 00000000..2d865b0a
--- /dev/null
+++ b/src/app/core/components/selectors/language-selector/language-selector.component.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/src/app/pages/voting/choices-list/choices-list.component.scss b/src/app/core/components/selectors/language-selector/language-selector.component.scss
similarity index 100%
rename from src/app/pages/voting/choices-list/choices-list.component.scss
rename to src/app/core/components/selectors/language-selector/language-selector.component.scss
diff --git a/src/app/core/components/selectors/language-selector/language-selector.component.spec.ts b/src/app/core/components/selectors/language-selector/language-selector.component.spec.ts
new file mode 100644
index 00000000..de5c97fd
--- /dev/null
+++ b/src/app/core/components/selectors/language-selector/language-selector.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { LanguageSelectorComponent } from './language-selector.component';
+
+describe('LanguageSelectorComponent', () => {
+ let component: LanguageSelectorComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [LanguageSelectorComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(LanguageSelectorComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/core/components/selectors/language-selector/language-selector.component.ts b/src/app/core/components/selectors/language-selector/language-selector.component.ts
new file mode 100644
index 00000000..5adfb671
--- /dev/null
+++ b/src/app/core/components/selectors/language-selector/language-selector.component.ts
@@ -0,0 +1,38 @@
+import { Component, DoCheck, OnInit } from '@angular/core';
+import { TranslateService } from '@ngx-translate/core';
+
+import { Language } from '../../../enums/language.enum';
+import { StorageService } from '../../../services/storage.service';
+
+@Component({
+ selector: 'app-language-selector',
+ templateUrl: './language-selector.component.html',
+ styleUrls: ['./language-selector.component.scss'],
+})
+export class LanguageSelectorComponent implements OnInit, DoCheck {
+ public currentLang: Language;
+ public languagesAvailable: string[] = Object.values(Language);
+
+ constructor(private translate: TranslateService, private storageService: StorageService) {}
+
+ ngOnInit(): void {
+ const currentBrowserLanguage: Language = this.translate.getBrowserLang().toUpperCase() as Language;
+ if (this.storageService.language && Object.keys(Language).includes(this.storageService.language)) {
+ this.currentLang = this.storageService.language;
+ } else if (Object.keys(Language).includes(currentBrowserLanguage)) {
+ this.currentLang = currentBrowserLanguage;
+ } else {
+ this.currentLang = Language.EN;
+ }
+ this.updateLanguage();
+ }
+
+ ngDoCheck(): void {
+ this.updateLanguage();
+ }
+
+ public updateLanguage(): void {
+ this.translate.use(this.currentLang.toString().toUpperCase());
+ this.storageService.language = this.currentLang;
+ }
+}
diff --git a/src/app/core/components/selectors/theme-selector/theme-selector.component.html b/src/app/core/components/selectors/theme-selector/theme-selector.component.html
new file mode 100644
index 00000000..9f87a43d
--- /dev/null
+++ b/src/app/core/components/selectors/theme-selector/theme-selector.component.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+
diff --git a/src/app/pages/voting/comments-list/comments-list.component.scss b/src/app/core/components/selectors/theme-selector/theme-selector.component.scss
similarity index 100%
rename from src/app/pages/voting/comments-list/comments-list.component.scss
rename to src/app/core/components/selectors/theme-selector/theme-selector.component.scss
diff --git a/src/app/ui/selector/theme-selector/theme-selector.component.spec.ts b/src/app/core/components/selectors/theme-selector/theme-selector.component.spec.ts
similarity index 100%
rename from src/app/ui/selector/theme-selector/theme-selector.component.spec.ts
rename to src/app/core/components/selectors/theme-selector/theme-selector.component.spec.ts
diff --git a/src/app/core/components/selectors/theme-selector/theme-selector.component.ts b/src/app/core/components/selectors/theme-selector/theme-selector.component.ts
new file mode 100644
index 00000000..96cc6f0a
--- /dev/null
+++ b/src/app/core/components/selectors/theme-selector/theme-selector.component.ts
@@ -0,0 +1,25 @@
+import { Component, OnInit } from '@angular/core';
+import { Observable } from 'rxjs';
+
+import { Theme } from '../../../enums/theme.enum';
+import { ThemeService } from '../../../services/theme.service';
+
+@Component({
+ selector: 'app-theme-selector',
+ templateUrl: './theme-selector.component.html',
+ styleUrls: ['./theme-selector.component.scss'],
+})
+export class ThemeSelectorComponent implements OnInit {
+ public themeEnum = Theme;
+ public currentTheme: Observable;
+
+ constructor(private themeService: ThemeService) {}
+
+ ngOnInit(): void {
+ this.currentTheme = this.themeService.theme;
+ }
+
+ public selectTheme(theme: string): void {
+ this.themeService.selectTheme(theme as Theme);
+ }
+}
diff --git a/src/app/core/components/sibebar/navigation/navigation.component.html b/src/app/core/components/sibebar/navigation/navigation.component.html
new file mode 100644
index 00000000..54c8767d
--- /dev/null
+++ b/src/app/core/components/sibebar/navigation/navigation.component.html
@@ -0,0 +1,23 @@
+
diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.scss b/src/app/core/components/sibebar/navigation/navigation.component.scss
similarity index 100%
rename from src/app/pages/voting/voting-comment/voting-comment.component.scss
rename to src/app/core/components/sibebar/navigation/navigation.component.scss
diff --git a/src/app/ui/navigation/navigation.component.spec.ts b/src/app/core/components/sibebar/navigation/navigation.component.spec.ts
similarity index 100%
rename from src/app/ui/navigation/navigation.component.spec.ts
rename to src/app/core/components/sibebar/navigation/navigation.component.spec.ts
diff --git a/src/app/core/components/sibebar/navigation/navigation.component.ts b/src/app/core/components/sibebar/navigation/navigation.component.ts
new file mode 100644
index 00000000..c1803444
--- /dev/null
+++ b/src/app/core/components/sibebar/navigation/navigation.component.ts
@@ -0,0 +1,18 @@
+import { Component, OnInit } from '@angular/core';
+
+import { MockingService } from '../../../services/mocking.service';
+import { Poll } from '../../../models/poll.model';
+
+@Component({
+ selector: 'app-navigation',
+ templateUrl: './navigation.component.html',
+ styleUrls: ['./navigation.component.scss'],
+})
+export class NavigationComponent implements OnInit {
+ public pollsDatabase: Poll[] = [];
+ constructor(private mockingService: MockingService) {}
+
+ ngOnInit(): void {
+ this.pollsDatabase = this.mockingService.pollsDatabase;
+ }
+}
diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts
new file mode 100644
index 00000000..6fdb511b
--- /dev/null
+++ b/src/app/core/core.module.ts
@@ -0,0 +1,35 @@
+import { CommonModule } from '@angular/common';
+import { NgModule, Optional, SkipSelf } from '@angular/core';
+import { FormsModule } from '@angular/forms';
+import { RouterModule } from '@angular/router';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { FooterComponent } from './components/footer/footer.component';
+import { HeaderComponent } from './components/header/header.component';
+import { HomeComponent } from './components/home/home.component';
+import { LoginComponent } from './components/login/login.component';
+import { LogoComponent } from './components/logo/logo.component';
+import { LanguageSelectorComponent } from './components/selectors/language-selector/language-selector.component';
+import { ThemeSelectorComponent } from './components/selectors/theme-selector/theme-selector.component';
+import { NavigationComponent } from './components/sibebar/navigation/navigation.component';
+import { throwIfAlreadyLoaded } from './guards/module-import.guard';
+
+@NgModule({
+ declarations: [
+ FooterComponent,
+ HeaderComponent,
+ HomeComponent,
+ LanguageSelectorComponent,
+ LoginComponent,
+ LogoComponent,
+ NavigationComponent,
+ ThemeSelectorComponent,
+ ],
+ imports: [CommonModule, FormsModule, RouterModule, TranslateModule],
+ exports: [HeaderComponent, FooterComponent, NavigationComponent, LoginComponent, LogoComponent],
+})
+export class CoreModule {
+ constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
+ throwIfAlreadyLoaded(parentModule, 'CoreModule');
+ }
+}
diff --git a/src/app/shared/enums/answer-granularity.enum.ts b/src/app/core/enums/answer-granularity.enum.ts
similarity index 100%
rename from src/app/shared/enums/answer-granularity.enum.ts
rename to src/app/core/enums/answer-granularity.enum.ts
diff --git a/src/app/shared/enums/answer-type.enum.ts b/src/app/core/enums/answer-type.enum.ts
similarity index 100%
rename from src/app/shared/enums/answer-type.enum.ts
rename to src/app/core/enums/answer-type.enum.ts
diff --git a/src/app/core/enums/language.enum.ts b/src/app/core/enums/language.enum.ts
new file mode 100644
index 00000000..0d954327
--- /dev/null
+++ b/src/app/core/enums/language.enum.ts
@@ -0,0 +1,4 @@
+export enum Language {
+ FR = 'FR',
+ EN = 'EN',
+}
diff --git a/src/app/core/enums/message-severity.enum.ts b/src/app/core/enums/message-severity.enum.ts
new file mode 100644
index 00000000..090f201b
--- /dev/null
+++ b/src/app/core/enums/message-severity.enum.ts
@@ -0,0 +1,6 @@
+export enum MessageSeverity {
+ SUCCESS = 'success',
+ INFO = 'info',
+ WARN = 'warn',
+ ERROR = 'error',
+}
diff --git a/src/app/core/enums/theme.enum.ts b/src/app/core/enums/theme.enum.ts
new file mode 100644
index 00000000..e94adb8f
--- /dev/null
+++ b/src/app/core/enums/theme.enum.ts
@@ -0,0 +1,5 @@
+export enum Theme {
+ LIGHT = 'LIGHT',
+ DARK = 'DARK',
+ RED = 'RED',
+}
diff --git a/src/app/core/enums/user-role.enum.ts b/src/app/core/enums/user-role.enum.ts
new file mode 100644
index 00000000..70258b1d
--- /dev/null
+++ b/src/app/core/enums/user-role.enum.ts
@@ -0,0 +1,5 @@
+export enum UserRole {
+ ANONYMOUS = 'ANONYMOUS',
+ REGISTERED = 'ADMIN',
+ ADMIN = 'ADMIN',
+}
diff --git a/src/app/core/enums/workflow-step.enum.ts b/src/app/core/enums/workflow-step.enum.ts
new file mode 100644
index 00000000..8d511fcd
--- /dev/null
+++ b/src/app/core/enums/workflow-step.enum.ts
@@ -0,0 +1,5 @@
+export enum WorkflowStep {
+ DESCRIPTION = 'DESCRIPTION',
+ OPTIONS = 'OPTIONS',
+ CONFIGURATION = 'CONFIGURATION',
+}
diff --git a/src/app/core/guards/module-import.guard.ts b/src/app/core/guards/module-import.guard.ts
new file mode 100644
index 00000000..b3fe3f41
--- /dev/null
+++ b/src/app/core/guards/module-import.guard.ts
@@ -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.`);
+ }
+}
diff --git a/src/app/shared/interfaces/date-options.interface.ts b/src/app/core/interfaces/date-options.interface.ts
similarity index 100%
rename from src/app/shared/interfaces/date-options.interface.ts
rename to src/app/core/interfaces/date-options.interface.ts
diff --git a/src/app/shared/models/answer.model.ts b/src/app/core/models/answer.model.ts
similarity index 100%
rename from src/app/shared/models/answer.model.ts
rename to src/app/core/models/answer.model.ts
diff --git a/src/app/shared/models/poll-config.model.ts b/src/app/core/models/poll-config.model.ts
similarity index 100%
rename from src/app/shared/models/poll-config.model.ts
rename to src/app/core/models/poll-config.model.ts
diff --git a/src/app/shared/models/poll-options.model.ts b/src/app/core/models/poll-options.model.ts
similarity index 100%
rename from src/app/shared/models/poll-options.model.ts
rename to src/app/core/models/poll-options.model.ts
diff --git a/src/app/shared/models/poll.model.ts b/src/app/core/models/poll.model.ts
similarity index 63%
rename from src/app/shared/models/poll.model.ts
rename to src/app/core/models/poll.model.ts
index 76ba269e..d4883137 100644
--- a/src/app/shared/models/poll.model.ts
+++ b/src/app/core/models/poll.model.ts
@@ -1,19 +1,23 @@
-import { PollType } from '../enums/poll-type.enum';
import { Answer } from './answer.model';
import { PollConfig } from './poll-config.model';
import { PollOption } from './poll-options.model';
import { User } from './user.model';
+import { environment } from 'src/environments/environment';
export class Poll {
constructor(
- public id: string,
- public slug: string,
- public type: PollType,
+ public isDateType: boolean,
public title: string,
public description: string,
- public owner: User,
- public config: PollConfig,
+ public slug: string,
+ public id: string,
+ public owner?: User,
+ public config?: PollConfig,
public options: PollOption[] = [],
public answers: Answer[] = []
) {}
+
+ public getUrl(): string {
+ return `${environment.api.baseHref}/${this.slug}`;
+ }
}
diff --git a/src/app/shared/models/user.model.ts b/src/app/core/models/user.model.ts
similarity index 65%
rename from src/app/shared/models/user.model.ts
rename to src/app/core/models/user.model.ts
index eabbab30..fe9b9605 100644
--- a/src/app/shared/models/user.model.ts
+++ b/src/app/core/models/user.model.ts
@@ -1,7 +1,9 @@
import { Poll } from './poll.model';
+import { UserRole } from '../enums/user-role.enum';
export class User {
constructor(
+ public role: UserRole = UserRole.ANONYMOUS,
public isOwner: boolean = false,
public pseudo?: string,
public email?: string,
diff --git a/src/app/shared/services/api.service.spec.ts b/src/app/core/services/api.service.spec.ts
similarity index 100%
rename from src/app/shared/services/api.service.spec.ts
rename to src/app/core/services/api.service.spec.ts
diff --git a/src/app/shared/services/api.service.ts b/src/app/core/services/api.service.ts
similarity index 54%
rename from src/app/shared/services/api.service.ts
rename to src/app/core/services/api.service.ts
index 9df004d9..fa4a1c1c 100644
--- a/src/app/shared/services/api.service.ts
+++ b/src/app/core/services/api.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
-import axios, { AxiosResponse } from 'axios';
+import axios, { AxiosInstance, AxiosResponse } from 'axios';
import { environment } from 'src/environments/environment';
import { Poll } from '../models/poll.model';
@@ -9,14 +9,26 @@ import { User } from '../models/user.model';
providedIn: 'root',
})
export class ApiService {
+ private axiosInstance: AxiosInstance;
+ private readonly pollsEndpoint = environment.api.endpoints.polls.name;
+ private readonly commentsEndpoint = environment.api.endpoints.polls.comments.name;
+ private readonly votesEndpoint = environment.api.endpoints.polls.votes.name;
+ private readonly slugsEndpoint = environment.api.endpoints.polls.slugs.name;
+ private readonly votesStacksEndpoint = environment.api.endpoints.voteStack.name;
+ private readonly usersEndpoint = environment.api.endpoints.users.name;
+ private readonly usersPollsEndpoint = environment.api.endpoints.users.polls.name;
+ private readonly usersPollsSendEmailEndpoint = environment.api.endpoints.users.polls.sendEmail.name;
+
+ constructor() {
+ this.axiosInstance = axios.create({ baseURL: environment.api.baseHref });
+ }
+
////////////
// CREATE //
////////////
public async savePoll(poll: Poll): Promise {
try {
- await axios.post(`${environment.api.baseHref}${environment.api.endpoints.poll.name}`, {
- params: { config: poll.config },
- });
+ await this.axiosInstance.post(`${this.pollsEndpoint}`, { params: { config: poll.config } });
} catch (error) {
this.handleError(error);
}
@@ -25,10 +37,9 @@ export class ApiService {
public async saveVote(poll: Poll): Promise {
try {
// TODO: add the votestack in the params
- await axios.post(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}/${poll.id}${environment.api.endpoints.poll.vote.name}`,
- { params: { voteStack: {} } }
- );
+ await this.axiosInstance.post(`${this.pollsEndpoint}/${poll.id}${this.votesEndpoint}`, {
+ params: { voteStack: {} },
+ });
} catch (error) {
this.handleError(error);
}
@@ -37,10 +48,9 @@ export class ApiService {
public async saveComment(poll: Poll, comment: string): Promise {
try {
// TODO: add the comment in the params
- await axios.post(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}/${poll.id}${environment.api.endpoints.poll.comment.name}`,
- { params: { comment } }
- );
+ await this.axiosInstance.post(`${this.pollsEndpoint}/${poll.id}${this.commentsEndpoint}`, {
+ params: { comment },
+ });
} catch (error) {
this.handleError(error);
}
@@ -52,22 +62,27 @@ export class ApiService {
public async isSlugAvailable(slug: string): Promise {
try {
// TODO: scenario should be : if we can get this slug, it exists. if not, it doesn't. It's just a GET.
- const response: AxiosResponse = await axios.get(
- `${environment.api.baseHref}${environment.api.endpoints.poll.slug.name}/${slug}`
+ const response: AxiosResponse = await this.axiosInstance.get(
+ `${this.pollsEndpoint}${this.slugsEndpoint}/${slug}`
);
- return response && response.status === 404 ? true : false;
+ if (response?.status !== 404) {
+ return false;
+ }
} catch (error) {
- this.handleError(error);
+ if (error.response?.status === 404) {
+ return true;
+ } else {
+ this.handleError(error);
+ }
}
}
- public async sendEmailToUserOfItsPollsList(email: string): Promise {
+ public async sendEmailToUserOfItsPollsList(user: User): Promise {
// If user is not authenticated: the list of polls is send to user's email by the backend.
try {
- const response: AxiosResponse = await axios.get(
- `${environment.api.baseHref}${environment.api.endpoints.user.polls.sendEmail.name}/${email}`
+ await this.axiosInstance.get(
+ `${this.usersEndpoint}/${user.email}${this.usersPollsEndpoint}${this.usersPollsSendEmailEndpoint}`
);
- return response ? response.data : [];
} catch (error) {
this.handleError(error);
}
@@ -77,35 +92,28 @@ export class ApiService {
// If user is authenticated : retrieve polls & display directly in frontend.
// TODO: Backend should handle this case. Actually the endpoint doesn't exist in backend.
try {
- const response: AxiosResponse = await axios.get(
- `${environment.api.baseHref}${environment.api.endpoints.user.polls.name}/${user.email}`
+ const response: AxiosResponse = await this.axiosInstance.get(
+ `${this.usersEndpoint}/${user.email}${this.usersPollsEndpoint}`
);
- return response ? response.data : [];
+ return response?.data;
} catch (error) {
this.handleError(error);
}
}
- public async getPollsByUrl(url: string): Promise {
+ public async getPollByIdentifier(identifier: string): Promise {
+ // TODO: identifier should be decided according to backend : Id || Slug ?
try {
- const response: AxiosResponse = await axios.get(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}/${url}`
+ const response: AxiosResponse = await this.axiosInstance.get(
+ `${this.pollsEndpoint}/${identifier}`
);
- return response ? response.data : [];
+ return response?.data;
} catch (error) {
- this.handleError(error);
- }
- }
-
- public async getPollById(id: string, password?: string): Promise {
- try {
- const response: AxiosResponse = await axios.get(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}/${id}`,
- password ? { params: { password } } : {}
- );
- return response ? response.data : [];
- } catch (error) {
- this.handleError(error);
+ if (error.response?.status === 404) {
+ return undefined;
+ } else {
+ this.handleError(error);
+ }
}
}
@@ -115,7 +123,7 @@ export class ApiService {
public async updatePoll(poll: Poll): Promise {
try {
// TODO: implement the params when entities are finalized.
- await axios.put(`${environment.api.baseHref}${environment.api.endpoints.poll.name}/${poll.id}`, {
+ await this.axiosInstance.put(`${this.pollsEndpoint}/${poll.id}`, {
params: { voteStack: {}, token: '' },
});
} catch (error) {
@@ -126,12 +134,9 @@ export class ApiService {
public async updateVote(voteStack: any): Promise {
try {
// TODO: implement the params when entities are finalized.
- await axios.patch(
- `${environment.api.baseHref}${environment.api.endpoints.poll.vote.name}/${voteStack.id}`,
- {
- params: { voteStack: {}, token: '' },
- }
- );
+ await this.axiosInstance.patch(`${this.votesStacksEndpoint}/${voteStack.id}`, {
+ params: { voteStack: {}, token: '' },
+ });
} catch (error) {
this.handleError(error);
}
@@ -143,7 +148,7 @@ export class ApiService {
public async deletePoll(poll: Poll): Promise {
try {
- await axios.delete(`${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}`, {});
+ await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}`, {});
} catch (error) {
this.handleError(error);
}
@@ -152,9 +157,7 @@ export class ApiService {
public async deletePollVotes(poll: Poll): Promise {
try {
// TODO: update endpoint in Backend
- await axios.delete(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}${environment.api.endpoints.poll.vote.name}`
- );
+ await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}${this.votesEndpoint}`);
} catch (error) {
this.handleError(error);
}
@@ -163,9 +166,7 @@ export class ApiService {
public async deletePollComments(poll: Poll): Promise {
try {
// TODO: modify endpoint in Backend
- await axios.delete(
- `${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}${environment.api.endpoints.poll.comment.name}`
- );
+ await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}${this.commentsEndpoint}`);
} catch (error) {
this.handleError(error);
}
diff --git a/src/app/shared/services/comment.service.spec.ts b/src/app/core/services/comment.service.spec.ts
similarity index 100%
rename from src/app/shared/services/comment.service.spec.ts
rename to src/app/core/services/comment.service.spec.ts
diff --git a/src/app/shared/services/comment.service.ts b/src/app/core/services/comment.service.ts
similarity index 100%
rename from src/app/shared/services/comment.service.ts
rename to src/app/core/services/comment.service.ts
diff --git a/src/app/core/services/message-displayer.service.spec.ts b/src/app/core/services/message-displayer.service.spec.ts
new file mode 100644
index 00000000..416a3c9b
--- /dev/null
+++ b/src/app/core/services/message-displayer.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { MessageDisplayerService } from './message-displayer.service';
+
+describe('MessageService', () => {
+ let service: MessageDisplayerService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(MessageDisplayerService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/core/services/message-displayer.service.ts b/src/app/core/services/message-displayer.service.ts
new file mode 100644
index 00000000..5b70ebce
--- /dev/null
+++ b/src/app/core/services/message-displayer.service.ts
@@ -0,0 +1,19 @@
+import { Injectable } from '@angular/core';
+import { MessageService } from 'primeng/api';
+
+import { MessageSeverity } from '../enums/message-severity.enum';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class MessageDisplayerService {
+ constructor(private messageService: MessageService) {}
+
+ public display(severity: MessageSeverity, summary?: string, detail?: string): void {
+ this.messageService.add({
+ severity,
+ summary,
+ detail,
+ });
+ }
+}
diff --git a/src/app/core/services/mocking.service.spec.ts b/src/app/core/services/mocking.service.spec.ts
new file mode 100644
index 00000000..0e80aab2
--- /dev/null
+++ b/src/app/core/services/mocking.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { MockingService } from './mocking.service';
+
+describe('MockingService', () => {
+ let service: MockingService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(MockingService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/core/services/mocking.service.ts b/src/app/core/services/mocking.service.ts
new file mode 100644
index 00000000..43528262
--- /dev/null
+++ b/src/app/core/services/mocking.service.ts
@@ -0,0 +1,37 @@
+import { Injectable } from '@angular/core';
+
+import { UserRole } from '../enums/user-role.enum';
+import { Poll } from '../models/poll.model';
+import { User } from '../models/user.model';
+import { PollService } from './poll.service';
+import { UserService } from './user.service';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class MockingService {
+ public pollsDatabase: Poll[];
+
+ private user: User = new User(UserRole.ANONYMOUS, false, 'toto', 'toto@gafam.com', []);
+ private poll1: Poll = new Poll(false, 'mon super sondage', 'super description 1', 'super_slug_1', 'id1');
+ private poll2: Poll = new Poll(false, 'mon autre sondage', 'super description 2', 'super_slug_2', 'id2');
+
+ constructor(private userService: UserService, private pollService: PollService) {
+ this.pollsDatabase = [this.poll1, this.poll2];
+ this.user.polls = this.pollsDatabase;
+ }
+
+ public loadUser(role: UserRole): void {
+ this.user.role = role;
+ console.info('MOCKING user', { user: this.user });
+ this.userService.updateUser(this.user);
+ }
+
+ public loadPoll(slug: string): void {
+ const poll: Poll | undefined = this.pollsDatabase.find((poll: Poll) => poll.slug === slug);
+ if (poll) {
+ console.info('MOCKING poll', { poll });
+ this.pollService.updateCurrentPoll(poll);
+ }
+ }
+}
diff --git a/src/app/shared/services/poll.service.spec.ts b/src/app/core/services/poll.service.spec.ts
similarity index 100%
rename from src/app/shared/services/poll.service.spec.ts
rename to src/app/core/services/poll.service.spec.ts
diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts
new file mode 100644
index 00000000..31daf2d4
--- /dev/null
+++ b/src/app/core/services/poll.service.ts
@@ -0,0 +1,56 @@
+import { Injectable } from '@angular/core';
+import { BehaviorSubject, Observable } from 'rxjs';
+
+import { MessageSeverity } from '../enums/message-severity.enum';
+import { Poll } from '../models/poll.model';
+import { ApiService } from './api.service';
+import { MessageDisplayerService } from './message-displayer.service';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class PollService {
+ private _poll: BehaviorSubject = new BehaviorSubject(undefined);
+ public readonly poll: Observable = this._poll.asObservable();
+
+ constructor(private apiService: ApiService, private messageService: MessageDisplayerService) {}
+
+ public updateCurrentPoll(poll: Poll): void {
+ this._poll.next(poll);
+ }
+
+ // SAVE
+ public async savePoll(poll: Poll): Promise {
+ await this.apiService.savePoll(poll);
+ this.messageService.display(MessageSeverity.SUCCESS, 'Le sondage a été créé.');
+ }
+
+ public async saveVote(poll: Poll): Promise {
+ await this.apiService.saveVote(poll);
+ this.messageService.display(MessageSeverity.SUCCESS, 'Votre participation au sondage a été enregistrée.');
+ }
+
+ public async saveComment(poll: Poll, comment: string): Promise {
+ await this.apiService.saveComment(poll, comment);
+ this.messageService.display(MessageSeverity.SUCCESS, 'Votre commentaire a été enregistré.');
+ }
+
+ // GET
+ public async getPollByIdentifier(slug: string): Promise {
+ this.updateCurrentPoll(await this.apiService.getPollByIdentifier(slug));
+ }
+
+ // DELETE
+ public async deletePollVotes(poll: Poll): Promise {
+ await this.apiService.deletePollVotes(poll);
+ this.messageService.display(
+ MessageSeverity.SUCCESS,
+ 'Les participations des votants à ce sondage ont été supprimées.'
+ );
+ }
+
+ public async deletePollComments(poll: Poll): Promise {
+ await this.apiService.deletePollComments(poll);
+ this.messageService.display(MessageSeverity.SUCCESS, 'Les commentaires de ce sondage ont été supprimés.');
+ }
+}
diff --git a/src/app/core/services/storage.service.spec.ts b/src/app/core/services/storage.service.spec.ts
new file mode 100644
index 00000000..abc72574
--- /dev/null
+++ b/src/app/core/services/storage.service.spec.ts
@@ -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();
+ });
+});
diff --git a/src/app/core/services/storage.service.ts b/src/app/core/services/storage.service.ts
new file mode 100644
index 00000000..80e40596
--- /dev/null
+++ b/src/app/core/services/storage.service.ts
@@ -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[];
+}
diff --git a/src/app/shared/services/theme.service.spec.ts b/src/app/core/services/theme.service.spec.ts
similarity index 100%
rename from src/app/shared/services/theme.service.spec.ts
rename to src/app/core/services/theme.service.spec.ts
diff --git a/src/app/core/services/theme.service.ts b/src/app/core/services/theme.service.ts
new file mode 100644
index 00000000..62a80095
--- /dev/null
+++ b/src/app/core/services/theme.service.ts
@@ -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 = new BehaviorSubject(Theme.RED);
+ public readonly theme: Observable = this._theme.asObservable();
+
+ public selectTheme(theme: Theme): void {
+ this._theme.next(theme);
+ }
+}
diff --git a/src/app/shared/services/user.service.spec.ts b/src/app/core/services/user.service.spec.ts
similarity index 100%
rename from src/app/shared/services/user.service.spec.ts
rename to src/app/core/services/user.service.spec.ts
diff --git a/src/app/core/services/user.service.ts b/src/app/core/services/user.service.ts
new file mode 100644
index 00000000..826cfcc9
--- /dev/null
+++ b/src/app/core/services/user.service.ts
@@ -0,0 +1,32 @@
+import { Injectable } from '@angular/core';
+import { BehaviorSubject, Observable } from 'rxjs';
+
+import { User } from '../models/user.model';
+import { ApiService } from './api.service';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class UserService {
+ public anonymous: User = new User();
+ private _user: BehaviorSubject = new BehaviorSubject(this.anonymous);
+ public readonly user: Observable = this._user.asObservable();
+
+ constructor(private apiService: ApiService) {}
+
+ public updateUser(user: User): void {
+ this._user.next(user);
+ }
+
+ // GET
+ public async getUserPolls(): Promise {
+ const currentUser: User = this._user.getValue();
+ currentUser.polls = await this.apiService.getPollsByUserEmail(currentUser);
+ this.updateUser(currentUser);
+ }
+
+ // POST
+ public async sendEmailToUserTheListOfItsPolls(): Promise {
+ await this.apiService.sendEmailToUserOfItsPollsList(this._user.getValue());
+ }
+}
diff --git a/src/app/shared/services/vote.service.spec.ts b/src/app/core/services/vote.service.spec.ts
similarity index 100%
rename from src/app/shared/services/vote.service.spec.ts
rename to src/app/core/services/vote.service.spec.ts
diff --git a/src/app/shared/services/vote.service.ts b/src/app/core/services/vote.service.ts
similarity index 100%
rename from src/app/shared/services/vote.service.ts
rename to src/app/core/services/vote.service.ts
diff --git a/src/app/core/services/workflow.service.spec.ts b/src/app/core/services/workflow.service.spec.ts
new file mode 100644
index 00000000..7cd61acc
--- /dev/null
+++ b/src/app/core/services/workflow.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { WorkflowService } from './workflow.service';
+
+describe('WorkflowService', () => {
+ let service: WorkflowService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(WorkflowService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/core/services/workflow.service.ts b/src/app/core/services/workflow.service.ts
new file mode 100644
index 00000000..8340f5e7
--- /dev/null
+++ b/src/app/core/services/workflow.service.ts
@@ -0,0 +1,30 @@
+import { Injectable } from '@angular/core';
+import { BehaviorSubject, Observable } from 'rxjs';
+
+import { WorkflowStep } from '../enums/workflow-step.enum';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class WorkflowService {
+ private steps = [WorkflowStep.DESCRIPTION, WorkflowStep.OPTIONS, WorkflowStep.CONFIGURATION];
+
+ private _currentStep: BehaviorSubject = new BehaviorSubject(WorkflowStep[0]);
+ public readonly currentStep: Observable = this._currentStep.asObservable();
+
+ constructor() {}
+
+ public loadNextStep(): void {
+ this._currentStep.next(WorkflowStep[this.getNewIndex(1)]);
+ }
+
+ public loadPriorStep(): void {
+ this._currentStep.next(WorkflowStep[this.getNewIndex(-1)]);
+ }
+
+ private getNewIndex(way: number): number {
+ const currentIndex: number = Object.keys(WorkflowStep).indexOf(this._currentStep.getValue());
+ const newIndex: number = currentIndex + way;
+ return 0 <= newIndex && newIndex <= Object.keys(WorkflowStep).length ? newIndex : currentIndex;
+ }
+}
diff --git a/src/app/shared/services/date-utils.service.spec.ts b/src/app/core/utils/date-utils.service.spec.ts
similarity index 100%
rename from src/app/shared/services/date-utils.service.spec.ts
rename to src/app/core/utils/date-utils.service.spec.ts
diff --git a/src/app/shared/services/date-utils.service.ts b/src/app/core/utils/date-utils.service.ts
similarity index 100%
rename from src/app/shared/services/date-utils.service.ts
rename to src/app/core/utils/date-utils.service.ts
diff --git a/src/app/shared/services/poll-utils.service.spec.ts b/src/app/core/utils/poll-utils.service.spec.ts
similarity index 100%
rename from src/app/shared/services/poll-utils.service.spec.ts
rename to src/app/core/utils/poll-utils.service.spec.ts
diff --git a/src/app/shared/services/poll-utils.service.ts b/src/app/core/utils/poll-utils.service.ts
similarity index 96%
rename from src/app/shared/services/poll-utils.service.ts
rename to src/app/core/utils/poll-utils.service.ts
index 08ba40eb..acb62bbd 100644
--- a/src/app/shared/services/poll-utils.service.ts
+++ b/src/app/core/utils/poll-utils.service.ts
@@ -15,7 +15,7 @@ export class PollUtilsService {
* make a uniq slug for the current poll creation
* @param str
*/
- public makeSlug(config: PollConfig): string {
+ public makeSlug(config: any): string {
let str = '';
str =
config.creationDate.getFullYear() +
diff --git a/src/app/features/administration/administration-routing.module.ts b/src/app/features/administration/administration-routing.module.ts
new file mode 100644
index 00000000..f3e47f43
--- /dev/null
+++ b/src/app/features/administration/administration-routing.module.ts
@@ -0,0 +1,35 @@
+import { NgModule } from '@angular/core';
+import { RouterModule, Routes } from '@angular/router';
+
+import { AdministrationComponent } from './administration.component';
+import { EditConfigurationComponent } from './edit-configuration/edit-configuration.component';
+import { EditDescriptionComponent } from './edit-description/edit-description.component';
+import { EditOptionsComponent } from './edit-options/edit-options.component';
+import { PollEditComponent } from './poll-edit/poll-edit.component';
+import { ProfileComponent } from './profile/profile.component';
+
+const routes: Routes = [
+ { path: '', redirectTo: 'edit', pathMatch: 'full' },
+ {
+ path: 'edit',
+ component: AdministrationComponent,
+ children: [
+ { path: '', redirectTo: 'description', pathMatch: 'full' },
+ { path: 'description', component: EditDescriptionComponent },
+ { path: 'description/:slug', component: EditDescriptionComponent },
+ { path: 'options', component: EditOptionsComponent },
+ { path: 'options/:slug', component: EditOptionsComponent },
+ { path: 'configuration', component: EditConfigurationComponent },
+ { path: 'configuration/:slug', component: EditConfigurationComponent },
+ { path: 'preview', component: PollEditComponent },
+ { path: 'preview/:slug', component: PollEditComponent },
+ ],
+ },
+ { path: 'profile', component: ProfileComponent },
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class AdministrationRoutingModule {}
diff --git a/src/app/features/administration/administration.component.html b/src/app/features/administration/administration.component.html
new file mode 100644
index 00000000..be984751
--- /dev/null
+++ b/src/app/features/administration/administration.component.html
@@ -0,0 +1,12 @@
+
diff --git a/src/app/pages/voting/voting-graph/voting-graph.component.scss b/src/app/features/administration/administration.component.scss
similarity index 100%
rename from src/app/pages/voting/voting-graph/voting-graph.component.scss
rename to src/app/features/administration/administration.component.scss
diff --git a/src/app/features/administration/administration.component.spec.ts b/src/app/features/administration/administration.component.spec.ts
new file mode 100644
index 00000000..3d34972b
--- /dev/null
+++ b/src/app/features/administration/administration.component.spec.ts
@@ -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;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [AdministrationComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(AdministrationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/administration.component.ts b/src/app/features/administration/administration.component.ts
new file mode 100644
index 00000000..2640d6dd
--- /dev/null
+++ b/src/app/features/administration/administration.component.ts
@@ -0,0 +1,16 @@
+import { Component, OnInit } from '@angular/core';
+
+import { Poll } from '../../core/models/poll.model';
+
+@Component({
+ selector: 'app-administration',
+ templateUrl: './administration.component.html',
+ styleUrls: ['./administration.component.scss'],
+})
+export class AdministrationComponent implements OnInit {
+ public poll: Poll;
+
+ constructor() {}
+
+ ngOnInit(): void {}
+}
diff --git a/src/app/features/administration/administration.module.ts b/src/app/features/administration/administration.module.ts
new file mode 100644
index 00000000..de031aa3
--- /dev/null
+++ b/src/app/features/administration/administration.module.ts
@@ -0,0 +1,34 @@
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { ReactiveFormsModule } from '@angular/forms';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { SharedModule } from '../../shared/shared.module';
+import { AdministrationRoutingModule } from './administration-routing.module';
+import { AdministrationComponent } from './administration.component';
+import { PollEditComponent } from './poll-edit/poll-edit.component';
+import { ProfileComponent } from './profile/profile.component';
+import { StepperComponent } from './stepper/stepper.component';
+import { EditDescriptionComponent } from './edit-description/edit-description.component';
+import { EditOptionsComponent } from './edit-options/edit-options.component';
+import { EditConfigurationComponent } from './edit-configuration/edit-configuration.component';
+
+@NgModule({
+ declarations: [
+ AdministrationComponent,
+ PollEditComponent,
+ StepperComponent,
+ ProfileComponent,
+ EditDescriptionComponent,
+ EditOptionsComponent,
+ EditConfigurationComponent,
+ ],
+ imports: [
+ AdministrationRoutingModule,
+ CommonModule,
+ ReactiveFormsModule,
+ SharedModule,
+ TranslateModule.forChild({ extend: true }),
+ ],
+})
+export class AdministrationModule {}
diff --git a/src/app/features/administration/edit-configuration/edit-configuration.component.html b/src/app/features/administration/edit-configuration/edit-configuration.component.html
new file mode 100644
index 00000000..9afb62fa
--- /dev/null
+++ b/src/app/features/administration/edit-configuration/edit-configuration.component.html
@@ -0,0 +1 @@
+edit-configuration works!
diff --git a/src/app/pages/voting/voting-navigation/voting-navigation.component.scss b/src/app/features/administration/edit-configuration/edit-configuration.component.scss
similarity index 100%
rename from src/app/pages/voting/voting-navigation/voting-navigation.component.scss
rename to src/app/features/administration/edit-configuration/edit-configuration.component.scss
diff --git a/src/app/features/administration/edit-configuration/edit-configuration.component.spec.ts b/src/app/features/administration/edit-configuration/edit-configuration.component.spec.ts
new file mode 100644
index 00000000..9d7516f3
--- /dev/null
+++ b/src/app/features/administration/edit-configuration/edit-configuration.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { EditConfigurationComponent } from './edit-configuration.component';
+
+describe('EditConfigurationComponent', () => {
+ let component: EditConfigurationComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [EditConfigurationComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditConfigurationComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/edit-configuration/edit-configuration.component.ts b/src/app/features/administration/edit-configuration/edit-configuration.component.ts
new file mode 100644
index 00000000..53703007
--- /dev/null
+++ b/src/app/features/administration/edit-configuration/edit-configuration.component.ts
@@ -0,0 +1,12 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-edit-configuration',
+ templateUrl: './edit-configuration.component.html',
+ styleUrls: ['./edit-configuration.component.scss'],
+})
+export class EditConfigurationComponent implements OnInit {
+ constructor() {}
+
+ ngOnInit(): void {}
+}
diff --git a/src/app/features/administration/edit-description/edit-description.component.html b/src/app/features/administration/edit-description/edit-description.component.html
new file mode 100644
index 00000000..881ab9e7
--- /dev/null
+++ b/src/app/features/administration/edit-description/edit-description.component.html
@@ -0,0 +1,33 @@
+
+
Form Status: {{ pollForm.status }}
+
+
+
diff --git a/src/app/pages/voting/voting.component.scss b/src/app/features/administration/edit-description/edit-description.component.scss
similarity index 100%
rename from src/app/pages/voting/voting.component.scss
rename to src/app/features/administration/edit-description/edit-description.component.scss
diff --git a/src/app/features/administration/edit-description/edit-description.component.spec.ts b/src/app/features/administration/edit-description/edit-description.component.spec.ts
new file mode 100644
index 00000000..617e6690
--- /dev/null
+++ b/src/app/features/administration/edit-description/edit-description.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { EditDescriptionComponent } from './edit-description.component';
+
+describe('EditDescriptionComponent', () => {
+ let component: EditDescriptionComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [EditDescriptionComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditDescriptionComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/edit-description/edit-description.component.ts b/src/app/features/administration/edit-description/edit-description.component.ts
new file mode 100644
index 00000000..556bb421
--- /dev/null
+++ b/src/app/features/administration/edit-description/edit-description.component.ts
@@ -0,0 +1,41 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+
+import { Poll } from '../../../core/models/poll.model';
+import { PollUtilsService } from '../../../core/utils/poll-utils.service';
+
+@Component({
+ selector: 'app-edit-description',
+ templateUrl: './edit-description.component.html',
+ styleUrls: ['./edit-description.component.scss'],
+})
+export class EditDescriptionComponent implements OnInit {
+ @Input()
+ public poll?: Poll;
+ public pollForm: FormGroup;
+
+ constructor(private fb: FormBuilder, private pollUtilsService: PollUtilsService) {}
+
+ ngOnInit(): void {
+ this.pollForm = this.fb.group({
+ type: [this.poll ? this.poll.isDateType : false, [Validators.required]],
+ title: [this.poll ? this.poll.title : '', [Validators.required]],
+ description: [this.poll ? this.poll.description : ''],
+ slug: [this.poll ? this.poll.slug : this.generateRandomSlug(), [Validators.required]],
+ address: this.fb.group({
+ street: [''],
+ city: [''],
+ state: [''],
+ zip: [''],
+ }),
+ });
+ }
+
+ public onSubmit(): void {
+ console.log(this.pollForm);
+ }
+
+ private generateRandomSlug(): string {
+ return this.pollUtilsService.makeUuid();
+ }
+}
diff --git a/src/app/features/administration/edit-options/edit-options.component.html b/src/app/features/administration/edit-options/edit-options.component.html
new file mode 100644
index 00000000..cb125905
--- /dev/null
+++ b/src/app/features/administration/edit-options/edit-options.component.html
@@ -0,0 +1 @@
+edit-options works!
diff --git a/src/app/services/progression.service.spec.ts b/src/app/features/administration/edit-options/edit-options.component.scss
similarity index 100%
rename from src/app/services/progression.service.spec.ts
rename to src/app/features/administration/edit-options/edit-options.component.scss
diff --git a/src/app/features/administration/edit-options/edit-options.component.spec.ts b/src/app/features/administration/edit-options/edit-options.component.spec.ts
new file mode 100644
index 00000000..91e2795a
--- /dev/null
+++ b/src/app/features/administration/edit-options/edit-options.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { EditOptionsComponent } from './edit-options.component';
+
+describe('EditOptionsComponent', () => {
+ let component: EditOptionsComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [EditOptionsComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(EditOptionsComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/edit-options/edit-options.component.ts b/src/app/features/administration/edit-options/edit-options.component.ts
new file mode 100644
index 00000000..850e785e
--- /dev/null
+++ b/src/app/features/administration/edit-options/edit-options.component.ts
@@ -0,0 +1,12 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-edit-options',
+ templateUrl: './edit-options.component.html',
+ styleUrls: ['./edit-options.component.scss'],
+})
+export class EditOptionsComponent implements OnInit {
+ constructor() {}
+
+ ngOnInit(): void {}
+}
diff --git a/src/app/features/administration/poll-edit/poll-edit.component.html b/src/app/features/administration/poll-edit/poll-edit.component.html
new file mode 100644
index 00000000..881ab9e7
--- /dev/null
+++ b/src/app/features/administration/poll-edit/poll-edit.component.html
@@ -0,0 +1,33 @@
+
+
Form Status: {{ pollForm.status }}
+
+
+
diff --git a/src/app/ui/copy-text/copy-text.component.scss b/src/app/features/administration/poll-edit/poll-edit.component.scss
similarity index 100%
rename from src/app/ui/copy-text/copy-text.component.scss
rename to src/app/features/administration/poll-edit/poll-edit.component.scss
diff --git a/src/app/ui/navigation/master-head/master-head.component.spec.ts b/src/app/features/administration/poll-edit/poll-edit.component.spec.ts
similarity index 53%
rename from src/app/ui/navigation/master-head/master-head.component.spec.ts
rename to src/app/features/administration/poll-edit/poll-edit.component.spec.ts
index ef228573..a3e3e6f8 100644
--- a/src/app/ui/navigation/master-head/master-head.component.spec.ts
+++ b/src/app/features/administration/poll-edit/poll-edit.component.spec.ts
@@ -1,19 +1,19 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-import { MasterHeadComponent } from './master-head.component';
+import { PollEditComponent } from './poll-edit.component';
-describe('MasterHeadComponent', () => {
- let component: MasterHeadComponent;
- let fixture: ComponentFixture;
+describe('PollEditComponent', () => {
+ let component: PollEditComponent;
+ let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [MasterHeadComponent],
+ declarations: [PollEditComponent],
}).compileComponents();
}));
beforeEach(() => {
- fixture = TestBed.createComponent(MasterHeadComponent);
+ fixture = TestBed.createComponent(PollEditComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/src/app/features/administration/poll-edit/poll-edit.component.ts b/src/app/features/administration/poll-edit/poll-edit.component.ts
new file mode 100644
index 00000000..2201eea7
--- /dev/null
+++ b/src/app/features/administration/poll-edit/poll-edit.component.ts
@@ -0,0 +1,41 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+
+import { Poll } from '../../../core/models/poll.model';
+import { PollUtilsService } from '../../../core/utils/poll-utils.service';
+
+@Component({
+ selector: 'app-poll-edit',
+ templateUrl: './poll-edit.component.html',
+ styleUrls: ['./poll-edit.component.scss'],
+})
+export class PollEditComponent implements OnInit {
+ @Input()
+ public poll?: Poll;
+ public pollForm: FormGroup;
+
+ constructor(private fb: FormBuilder, private pollUtilsService: PollUtilsService) {}
+
+ ngOnInit(): void {
+ this.pollForm = this.fb.group({
+ type: [this.poll ? this.poll.isDateType : false, [Validators.required]],
+ title: [this.poll ? this.poll.title : '', [Validators.required]],
+ description: [this.poll ? this.poll.description : ''],
+ slug: [this.poll ? this.poll.slug : this.generateRandomSlug(), [Validators.required]],
+ address: this.fb.group({
+ street: [''],
+ city: [''],
+ state: [''],
+ zip: [''],
+ }),
+ });
+ }
+
+ public onSubmit(): void {
+ console.log(this.pollForm);
+ }
+
+ private generateRandomSlug(): string {
+ return this.pollUtilsService.makeUuid();
+ }
+}
diff --git a/src/app/features/administration/profile/profile.component.html b/src/app/features/administration/profile/profile.component.html
new file mode 100644
index 00000000..9eea3a93
--- /dev/null
+++ b/src/app/features/administration/profile/profile.component.html
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/ui/debugger/debugger.component.scss b/src/app/features/administration/profile/profile.component.scss
similarity index 100%
rename from src/app/ui/debugger/debugger.component.scss
rename to src/app/features/administration/profile/profile.component.scss
diff --git a/src/app/features/administration/profile/profile.component.spec.ts b/src/app/features/administration/profile/profile.component.spec.ts
new file mode 100644
index 00000000..d4ca5c78
--- /dev/null
+++ b/src/app/features/administration/profile/profile.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { ProfileComponent } from './profile.component';
+
+describe('ProfileComponent', () => {
+ let component: ProfileComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ProfileComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProfileComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/profile/profile.component.ts b/src/app/features/administration/profile/profile.component.ts
new file mode 100644
index 00000000..79ddd1c4
--- /dev/null
+++ b/src/app/features/administration/profile/profile.component.ts
@@ -0,0 +1,24 @@
+import { Component, OnInit } from '@angular/core';
+import { Observable } from 'rxjs';
+
+import { User } from '../../../core/models/user.model';
+import { UserService } from '../../../core/services/user.service';
+
+@Component({
+ selector: 'app-profile',
+ templateUrl: './profile.component.html',
+ styleUrls: ['./profile.component.scss'],
+})
+export class ProfileComponent implements OnInit {
+ public _user: Observable;
+ public isModalOpened = false;
+
+ constructor(private userService: UserService) {}
+
+ ngOnInit(): void {
+ this._user = this.userService.user;
+ }
+ public toggleModal(): void {
+ this.isModalOpened = !this.isModalOpened;
+ }
+}
diff --git a/src/app/features/administration/stepper/stepper.component.html b/src/app/features/administration/stepper/stepper.component.html
new file mode 100644
index 00000000..bfb71330
--- /dev/null
+++ b/src/app/features/administration/stepper/stepper.component.html
@@ -0,0 +1 @@
+
diff --git a/src/app/ui/erasable-input/erasable-input.component.scss b/src/app/features/administration/stepper/stepper.component.scss
similarity index 100%
rename from src/app/ui/erasable-input/erasable-input.component.scss
rename to src/app/features/administration/stepper/stepper.component.scss
diff --git a/src/app/features/administration/stepper/stepper.component.spec.ts b/src/app/features/administration/stepper/stepper.component.spec.ts
new file mode 100644
index 00000000..7a7767cf
--- /dev/null
+++ b/src/app/features/administration/stepper/stepper.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { StepperComponent } from './stepper.component';
+
+describe('StepperComponent', () => {
+ let component: StepperComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [StepperComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(StepperComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/features/administration/stepper/stepper.component.ts b/src/app/features/administration/stepper/stepper.component.ts
new file mode 100644
index 00000000..fd7b10b2
--- /dev/null
+++ b/src/app/features/administration/stepper/stepper.component.ts
@@ -0,0 +1,51 @@
+import { Component, OnInit } from '@angular/core';
+import { MenuItem } from 'primeng/api';
+import { WorkflowStep } from '../../../core/enums/workflow-step.enum';
+import { WorkflowService } from '../../../core/services/workflow.service';
+import { Observable } from 'rxjs';
+
+@Component({
+ selector: 'app-stepper',
+ templateUrl: './stepper.component.html',
+ styleUrls: ['./stepper.component.scss'],
+})
+export class StepperComponent implements OnInit {
+ public items: MenuItem[];
+ public itemDescription: MenuItem = {
+ id: '1',
+ label: WorkflowStep.DESCRIPTION,
+ title: 'Je donne une description générale du sondage',
+ routerLink: './description',
+ command: () => {},
+ state: { isStepCompleteAndValid: true },
+ disabled: false,
+ };
+ public itemOptions: MenuItem = {
+ id: '2',
+ label: WorkflowStep.OPTIONS,
+ title: 'Je renseigne les différentes options sur lesquelles les gens vont donner leur avis',
+ routerLink: './options',
+ command: () => {},
+ state: { isStepCompleteAndValid: true },
+ disabled: false,
+ };
+ public itemConfiguration: MenuItem = {
+ id: '3',
+ label: WorkflowStep.CONFIGURATION,
+ title: 'Je configure le sondage',
+ routerLink: './configuration',
+ command: () => {},
+ state: { isStepCompleteAndValid: true },
+ disabled: false,
+ };
+ public activeIndex: number;
+ public activeStep: Observable;
+
+ constructor(private workflowService: WorkflowService) {}
+
+ ngOnInit(): void {
+ // this.activeStep = this.workflowService.currentStep;
+
+ this.items = [this.itemDescription, this.itemOptions, this.itemConfiguration];
+ }
+}
diff --git a/src/app/config/DateUtilities.ts b/src/app/features/old-stuff/config/DateUtilities.ts
similarity index 100%
rename from src/app/config/DateUtilities.ts
rename to src/app/features/old-stuff/config/DateUtilities.ts
diff --git a/src/app/config/PollConfig.ts b/src/app/features/old-stuff/config/PollConfig.ts
similarity index 87%
rename from src/app/config/PollConfig.ts
rename to src/app/features/old-stuff/config/PollConfig.ts
index e063a9dc..f6eb71b8 100644
--- a/src/app/config/PollConfig.ts
+++ b/src/app/features/old-stuff/config/PollConfig.ts
@@ -1,7 +1,7 @@
/**
* une option de date dans les sondages spéciaux
*/
-import { environment } from '../../environments/environment';
+import { environment } from '../../../../environments/environment';
import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs';
export interface DateOption {
@@ -57,8 +57,8 @@ export class PollConfig {
customUrl = ''; // custom slug in the url, must be unique
customUrlIsUnique = null; // given by the backend
urlSlugPublic = null;
- urlPublic = environment.production ? '' : window.location.origin + '/#/poll/id/4';
- urlAdmin = window.location.origin + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
+ urlPublic = environment.production ? '' : document.location.href + '/poll/id/4';
+ urlAdmin = document.location.href + '/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
adminKey = ''; // key to change config of the poll
owner_modifier_token = ''; // key to change a vote stack
canModifyAnswers = true; // bool for the frontend selector
@@ -68,10 +68,6 @@ export class PollConfig {
timeList: DateChoice[] = otherDefaultDates; // ranges of time expressed as strings
answers: PollAnswer[] = defaultAnswers;
- // front end choices
- themeChoices: string[] = ['light-watermelon', 'dark-crystal', 'hot-covid'];
- themeSelected = 0;
- themeClass = 'theme-light-watermelon';
// modals
displayConfirmVoteModalAdmin = false;
diff --git a/src/app/config/PollUtilities.ts b/src/app/features/old-stuff/config/PollUtilities.ts
similarity index 100%
rename from src/app/config/PollUtilities.ts
rename to src/app/features/old-stuff/config/PollUtilities.ts
diff --git a/src/app/config/defaultConfigs.ts b/src/app/features/old-stuff/config/defaultConfigs.ts
similarity index 100%
rename from src/app/config/defaultConfigs.ts
rename to src/app/features/old-stuff/config/defaultConfigs.ts
diff --git a/src/app/custom-lib/date-value-accessor/date-value-accessor.metadata.json b/src/app/features/old-stuff/custom-lib/date-value-accessor/date-value-accessor.metadata.json
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/date-value-accessor.metadata.json
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/date-value-accessor.metadata.json
diff --git a/src/app/custom-lib/date-value-accessor/date-value-accessor.ts b/src/app/features/old-stuff/custom-lib/date-value-accessor/date-value-accessor.ts
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/date-value-accessor.ts
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/date-value-accessor.ts
diff --git a/src/app/custom-lib/date-value-accessor/index.metadata.json b/src/app/features/old-stuff/custom-lib/date-value-accessor/index.metadata.json
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/index.metadata.json
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/index.metadata.json
diff --git a/src/app/custom-lib/date-value-accessor/index.ts b/src/app/features/old-stuff/custom-lib/date-value-accessor/index.ts
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/index.ts
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/index.ts
diff --git a/src/app/custom-lib/date-value-accessor/module.metadata.json b/src/app/features/old-stuff/custom-lib/date-value-accessor/module.metadata.json
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/module.metadata.json
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/module.metadata.json
diff --git a/src/app/custom-lib/date-value-accessor/module.ts b/src/app/features/old-stuff/custom-lib/date-value-accessor/module.ts
similarity index 100%
rename from src/app/custom-lib/date-value-accessor/module.ts
rename to src/app/features/old-stuff/custom-lib/date-value-accessor/module.ts
diff --git a/src/app/features/old-stuff/old-stuff-routing.module.ts b/src/app/features/old-stuff/old-stuff-routing.module.ts
new file mode 100644
index 00000000..14382ea2
--- /dev/null
+++ b/src/app/features/old-stuff/old-stuff-routing.module.ts
@@ -0,0 +1,46 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { AdminComponent } from './pages/admin/admin.component';
+import { AnswersComponent } from './pages/answers/answers.component';
+import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component';
+import { DatesComponent } from './pages/dates/dates.component';
+import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
+import { BaseComponent } from './pages/example/base-page/base.component';
+import { KindComponent } from './pages/example/kind/kind.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 { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
+import { ResumeComponent } from './pages/resume/resume.component';
+import { VisibilityComponent } from './pages/visibility/visibility.component';
+import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component';
+import { VotingComponent } from './pages/voting/voting.component';
+
+const routes: Routes = [
+ { path: '', redirectTo: 'step/home', pathMatch: 'full' },
+ { path: 'admin/:token', component: AdminComponent }, // http://localhost:4200/admin/srfdgedsTGETHRYJtujTUjTUkTIUKTK
+ { path: 'step/home', component: HomeComponent },
+ { path: 'step/creation', component: CreateOrRetrieveComponent },
+ { path: 'step/date', component: DatesComponent },
+ { path: 'step/kind', component: KindComponent },
+ { path: 'step/answers', component: AnswersComponent },
+ { path: 'step/admin', component: AdminComponent },
+ { path: 'step/pictures', component: PicturesComponent },
+ { path: 'step/visibility', component: VisibilityComponent },
+ { path: 'step/password', component: PasswordComponent },
+ { path: 'step/resume', component: ResumeComponent },
+ { path: 'step/end', component: EndConfirmationComponent },
+ { path: 'graphic/:poll', component: PollGraphicComponent },
+ { path: 'vote/poll/id/:poll', component: PollDisplayComponent },
+ { path: 'vote/poll/slug/:pollSlug', component: PollDisplayComponent },
+ { path: 'votingchoice', component: VotingChoiceComponent },
+ { path: 'voting', component: VotingComponent },
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class OldStuffRoutingModule {}
diff --git a/src/app/features/old-stuff/old-stuff.module.ts b/src/app/features/old-stuff/old-stuff.module.ts
new file mode 100644
index 00000000..81a8fd4e
--- /dev/null
+++ b/src/app/features/old-stuff/old-stuff.module.ts
@@ -0,0 +1,74 @@
+import { CommonModule } from '@angular/common';
+import { NgModule } from '@angular/core';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { SharedModule } from '../../shared/shared.module';
+import { DateValueAccessorModule } from './custom-lib/date-value-accessor';
+import { OldStuffRoutingModule } from './old-stuff-routing.module';
+import { AdminComponent } from './pages/admin/admin.component';
+import { AnswersComponent } from './pages/answers/answers.component';
+import { CreateOrRetrieveComponent } from './pages/create-or-retrieve/create-or-retrieve.component';
+import { DatesComponent } from './pages/dates/dates.component';
+import { EndConfirmationComponent } from './pages/end-confirmation/end-confirmation.component';
+import { BaseComponent } from './pages/example/base-page/base.component';
+import { KindComponent } from './pages/example/kind/kind.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 { PollGraphicComponent } from './pages/poll/poll-graphic/poll-graphic.component';
+import { ResumeComponent } from './pages/resume/resume.component';
+import { VisibilityComponent } from './pages/visibility/visibility.component';
+import { ChoicesListComponent } from './pages/voting/choices-list/choices-list.component';
+import { CommentsListComponent } from './pages/voting/comments-list/comments-list.component';
+import { VotingChoiceComponent } from './pages/voting/voting-choice/voting-choice.component';
+import { VotingCommentComponent } from './pages/voting/voting-comment/voting-comment.component';
+import { VotingGraphComponent } from './pages/voting/voting-graph/voting-graph.component';
+import { VotingNavigationComponent } from './pages/voting/voting-navigation/voting-navigation.component';
+import { VotingSummaryComponent } from './pages/voting/voting-summary/voting-summary.component';
+import { VotingComponent } from './pages/voting/voting.component';
+import { ConfigService } from './services/config.service';
+import { CopyTextComponent } from './ui/copy-text/copy-text.component';
+import { ResettableInputDirective } from './ui/directives/resettable-input.directive';
+import { ErasableInputComponent } from './ui/erasable-input/erasable-input.component';
+import { TwoLinksComponent } from './ui/two-links/two-links.component';
+
+@NgModule({
+ declarations: [
+ AdminComponent,
+ AnswersComponent,
+ BaseComponent,
+ ChoicesListComponent,
+ CommentsListComponent,
+ CopyTextComponent,
+ CreateOrRetrieveComponent,
+ DatesComponent,
+ EndConfirmationComponent,
+ ErasableInputComponent,
+ HomeComponent,
+ KindComponent,
+ PasswordComponent,
+ PicturesComponent,
+ PollDisplayComponent,
+ PollGraphicComponent,
+ ResettableInputDirective,
+ ResumeComponent,
+ TwoLinksComponent,
+ VisibilityComponent,
+ VotingChoiceComponent,
+ VotingGraphComponent,
+ VotingComponent,
+ VotingCommentComponent,
+ VotingSummaryComponent,
+ VotingNavigationComponent,
+ ],
+ imports: [
+ CommonModule,
+ OldStuffRoutingModule,
+ SharedModule,
+ TranslateModule.forChild({ extend: true }),
+ DateValueAccessorModule,
+ ],
+ providers: [ConfigService],
+})
+export class OldStuffModule {}
diff --git a/src/app/pages/admin/admin.component.html b/src/app/features/old-stuff/pages/admin/admin.component.html
similarity index 100%
rename from src/app/pages/admin/admin.component.html
rename to src/app/features/old-stuff/pages/admin/admin.component.html
diff --git a/src/app/pages/admin/admin.component.scss b/src/app/features/old-stuff/pages/admin/admin.component.scss
similarity index 100%
rename from src/app/pages/admin/admin.component.scss
rename to src/app/features/old-stuff/pages/admin/admin.component.scss
diff --git a/src/app/pages/admin/admin.component.spec.ts b/src/app/features/old-stuff/pages/admin/admin.component.spec.ts
similarity index 100%
rename from src/app/pages/admin/admin.component.spec.ts
rename to src/app/features/old-stuff/pages/admin/admin.component.spec.ts
diff --git a/src/app/pages/admin/admin.component.ts b/src/app/features/old-stuff/pages/admin/admin.component.ts
similarity index 93%
rename from src/app/pages/admin/admin.component.ts
rename to src/app/features/old-stuff/pages/admin/admin.component.ts
index fbd04817..370973d2 100644
--- a/src/app/pages/admin/admin.component.ts
+++ b/src/app/features/old-stuff/pages/admin/admin.component.ts
@@ -3,10 +3,10 @@ import { ConfigService } from '../../services/config.service';
import { ActivatedRoute, Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';
import { PollUtilities } from '../../config/PollUtilities';
-import { environment } from '../../../environments/environment';
+import { environment } from '../../../../../environments/environment';
@Component({
- selector: 'framadate-admin',
+ selector: 'app-admin',
templateUrl: './admin.component.html',
styleUrls: ['./admin.component.scss'],
})
@@ -21,7 +21,7 @@ export class AdminComponent implements OnInit {
public activeRoute: ActivatedRoute
) {}
- ngOnInit() {
+ ngOnInit(): void {
this.activeRoute.paramMap.subscribe((params) => {
console.log('params', params);
this.tokenForAdministration = params.get('token');
diff --git a/src/app/pages/answers/answers.component.html b/src/app/features/old-stuff/pages/answers/answers.component.html
similarity index 96%
rename from src/app/pages/answers/answers.component.html
rename to src/app/features/old-stuff/pages/answers/answers.component.html
index 3f63b765..8aca04f9 100644
--- a/src/app/pages/answers/answers.component.html
+++ b/src/app/features/old-stuff/pages/answers/answers.component.html
@@ -61,7 +61,7 @@
diff --git a/src/app/ui/navigation/master-head/master-head.component.scss b/src/app/features/old-stuff/pages/answers/answers.component.scss
similarity index 100%
rename from src/app/ui/navigation/master-head/master-head.component.scss
rename to src/app/features/old-stuff/pages/answers/answers.component.scss
diff --git a/src/app/pages/answers/answers.component.spec.ts b/src/app/features/old-stuff/pages/answers/answers.component.spec.ts
similarity index 100%
rename from src/app/pages/answers/answers.component.spec.ts
rename to src/app/features/old-stuff/pages/answers/answers.component.spec.ts
diff --git a/src/app/pages/answers/answers.component.ts b/src/app/features/old-stuff/pages/answers/answers.component.ts
similarity index 97%
rename from src/app/pages/answers/answers.component.ts
rename to src/app/features/old-stuff/pages/answers/answers.component.ts
index bfa52148..b24acece 100644
--- a/src/app/pages/answers/answers.component.ts
+++ b/src/app/features/old-stuff/pages/answers/answers.component.ts
@@ -5,7 +5,7 @@ import { ConfigService } from '../../services/config.service';
import { DOCUMENT } from '@angular/common';
@Component({
- selector: 'framadate-answers',
+ selector: 'app-answers',
templateUrl: './answers.component.html',
styleUrls: ['./answers.component.scss'],
})
@@ -22,7 +22,7 @@ export class AnswersComponent extends BaseComponent implements OnInit, AfterView
}
// todo, manage validation of each page in a common way
- ngOnInit() {}
+ ngOnInit(): void {}
ngOnChanges() {
this.checkValidAnswers();
diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.html
similarity index 93%
rename from src/app/pages/create-or-retrieve/create-or-retrieve.component.html
rename to src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.html
index 1ed9272a..aa57eb70 100644
--- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.html
+++ b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.html
@@ -9,7 +9,7 @@
{{ 'config.description' | translate }}
-
@@ -64,7 +64,7 @@
-
+
diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.scss b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.scss
similarity index 100%
rename from src/app/pages/create-or-retrieve/create-or-retrieve.component.scss
rename to src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.scss
diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.spec.ts
similarity index 100%
rename from src/app/pages/create-or-retrieve/create-or-retrieve.component.spec.ts
rename to src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.spec.ts
diff --git a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.ts
similarity index 93%
rename from src/app/pages/create-or-retrieve/create-or-retrieve.component.ts
rename to src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.ts
index 1588cd56..50c3a1a4 100644
--- a/src/app/pages/create-or-retrieve/create-or-retrieve.component.ts
+++ b/src/app/features/old-stuff/pages/create-or-retrieve/create-or-retrieve.component.ts
@@ -3,7 +3,7 @@ import { BaseComponent } from '../example/base-page/base.component';
import { ConfigService } from '../../services/config.service';
@Component({
- selector: 'framadate-create-or-retrieve',
+ selector: 'app-create-or-retrieve',
templateUrl: './create-or-retrieve.component.html',
styleUrls: ['./create-or-retrieve.component.scss'],
})
@@ -14,7 +14,7 @@ export class CreateOrRetrieveComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {
+ ngOnInit(): void {
// if (!environment.production) {
// this.findMyPollsByEmail('tktest@tktest.com')
// }
diff --git a/src/app/pages/dates/dates.component.html b/src/app/features/old-stuff/pages/dates/dates.component.html
similarity index 96%
rename from src/app/pages/dates/dates.component.html
rename to src/app/features/old-stuff/pages/dates/dates.component.html
index 2e889291..4c1253e2 100644
--- a/src/app/pages/dates/dates.component.html
+++ b/src/app/features/old-stuff/pages/dates/dates.component.html
@@ -156,13 +156,13 @@
-
+
C'est parfait!
-
+
Retour
diff --git a/src/app/pages/dates/dates.component.scss b/src/app/features/old-stuff/pages/dates/dates.component.scss
similarity index 100%
rename from src/app/pages/dates/dates.component.scss
rename to src/app/features/old-stuff/pages/dates/dates.component.scss
diff --git a/src/app/pages/dates/dates.component.spec.ts b/src/app/features/old-stuff/pages/dates/dates.component.spec.ts
similarity index 100%
rename from src/app/pages/dates/dates.component.spec.ts
rename to src/app/features/old-stuff/pages/dates/dates.component.spec.ts
diff --git a/src/app/pages/dates/dates.component.ts b/src/app/features/old-stuff/pages/dates/dates.component.ts
similarity index 98%
rename from src/app/pages/dates/dates.component.ts
rename to src/app/features/old-stuff/pages/dates/dates.component.ts
index 89358009..68fb628f 100644
--- a/src/app/pages/dates/dates.component.ts
+++ b/src/app/features/old-stuff/pages/dates/dates.component.ts
@@ -7,7 +7,7 @@ import { otherDefaultDates } from '../../config/defaultConfigs';
import { DateUtilities } from '../../config/DateUtilities';
@Component({
- selector: 'framadate-dates',
+ selector: 'app-dates',
templateUrl: './dates.component.html',
styleUrls: ['./dates.component.scss'],
})
@@ -38,7 +38,7 @@ export class DatesComponent extends BaseComponent implements OnInit {
/**
* set the interval options
*/
- ngOnInit() {
+ ngOnInit(): void {
const dateCurrent = new Date();
const dateJson = dateCurrent.toISOString();
this.startDateInterval = dateJson.substring(0, 10);
diff --git a/src/app/pages/end-confirmation/end-confirmation.component.html b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html
similarity index 90%
rename from src/app/pages/end-confirmation/end-confirmation.component.html
rename to src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html
index 709efe03..3c7d44a7 100644
--- a/src/app/pages/end-confirmation/end-confirmation.component.html
+++ b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.html
@@ -19,7 +19,7 @@
Pour accéder au sondage et à tous ses paramètres :
{{ config.urlAdmin }}
-
+
Voir le sondage coté administrateur·ice
@@ -34,7 +34,7 @@
Pour accéder au sondage :
{{ config.urlPublic }}
-
+
Voir le sondage
diff --git a/src/app/pages/end-confirmation/end-confirmation.component.scss b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.scss
similarity index 100%
rename from src/app/pages/end-confirmation/end-confirmation.component.scss
rename to src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.scss
diff --git a/src/app/pages/end-confirmation/end-confirmation.component.spec.ts b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.spec.ts
similarity index 100%
rename from src/app/pages/end-confirmation/end-confirmation.component.spec.ts
rename to src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.spec.ts
diff --git a/src/app/pages/end-confirmation/end-confirmation.component.ts b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.ts
similarity index 93%
rename from src/app/pages/end-confirmation/end-confirmation.component.ts
rename to src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.ts
index 97e0afc6..c42fa16a 100644
--- a/src/app/pages/end-confirmation/end-confirmation.component.ts
+++ b/src/app/features/old-stuff/pages/end-confirmation/end-confirmation.component.ts
@@ -5,7 +5,7 @@ import { ConfigService } from '../../services/config.service';
import { MessageService } from 'primeng/api';
@Component({
- selector: 'framadate-end-confirmation',
+ selector: 'app-end-confirmation',
templateUrl: './end-confirmation.component.html',
styleUrls: ['./end-confirmation.component.scss'],
})
@@ -17,7 +17,7 @@ export class EndConfirmationComponent extends BaseComponent implements OnInit {
this.mailToRecieve = this.config.myEmail;
}
- ngOnInit() {}
+ ngOnInit(): void {}
copyLink(str: any) {
this.messageService.add({
diff --git a/src/app/pages/example/base-page/base.component.html b/src/app/features/old-stuff/pages/example/base-page/base.component.html
similarity index 57%
rename from src/app/pages/example/base-page/base.component.html
rename to src/app/features/old-stuff/pages/example/base-page/base.component.html
index 1571aa12..86001560 100644
--- a/src/app/pages/example/base-page/base.component.html
+++ b/src/app/features/old-stuff/pages/example/base-page/base.component.html
@@ -1,4 +1,4 @@
Ce composant est celui de base pour les pages
-
+
{{ 'config.perfect' | translate }}
diff --git a/src/app/ui/navigation/two-links/two-links.component.scss b/src/app/features/old-stuff/pages/example/base-page/base.component.scss
similarity index 100%
rename from src/app/ui/navigation/two-links/two-links.component.scss
rename to src/app/features/old-stuff/pages/example/base-page/base.component.scss
diff --git a/src/app/pages/example/base-page/base.component.spec.ts b/src/app/features/old-stuff/pages/example/base-page/base.component.spec.ts
similarity index 100%
rename from src/app/pages/example/base-page/base.component.spec.ts
rename to src/app/features/old-stuff/pages/example/base-page/base.component.spec.ts
diff --git a/src/app/pages/example/base-page/base.component.ts b/src/app/features/old-stuff/pages/example/base-page/base.component.ts
similarity index 79%
rename from src/app/pages/example/base-page/base.component.ts
rename to src/app/features/old-stuff/pages/example/base-page/base.component.ts
index a270d7af..8eac5a09 100644
--- a/src/app/pages/example/base-page/base.component.ts
+++ b/src/app/features/old-stuff/pages/example/base-page/base.component.ts
@@ -1,8 +1,9 @@
import { Component, OnInit } from '@angular/core';
+
import { ConfigService } from '../../../services/config.service';
@Component({
- selector: 'framadate-base-page',
+ selector: 'app-base-page',
templateUrl: './base.component.html',
styleUrls: ['./base.component.scss'],
})
@@ -12,15 +13,15 @@ import { ConfigService } from '../../../services/config.service';
export class BaseComponent implements OnInit {
constructor(public config: ConfigService) {}
- ngOnInit() {}
+ ngOnInit(): void {}
- checkValidity() {
+ public checkValidity(): boolean {
// TODO with form controls
this.config.todo();
return true;
}
- displayErrorMessage() {
+ public displayErrorMessage(): boolean {
// TODO
this.config.todo();
return true;
diff --git a/src/app/pages/example/kind/kind.component.html b/src/app/features/old-stuff/pages/example/kind/kind.component.html
similarity index 93%
rename from src/app/pages/example/kind/kind.component.html
rename to src/app/features/old-stuff/pages/example/kind/kind.component.html
index 736b17a8..a1dec45c 100644
--- a/src/app/pages/example/kind/kind.component.html
+++ b/src/app/features/old-stuff/pages/example/kind/kind.component.html
@@ -3,7 +3,7 @@
cette étape est en cours de développement.
S'inspirer de la page de Home pour réaliser d'autres pages
-C'est parfait!
+C'est parfait!
Atoms
@@ -17,14 +17,14 @@
Links
-
+
C'est parti !
@@ -47,7 +47,7 @@
-
+
primary - outline - default
@@ -186,13 +186,13 @@
Molecules
-
+
Useful classes
Align right
-
+
C'est parti !
diff --git a/src/app/pages/example/kind/kind.component.scss b/src/app/features/old-stuff/pages/example/kind/kind.component.scss
similarity index 100%
rename from src/app/pages/example/kind/kind.component.scss
rename to src/app/features/old-stuff/pages/example/kind/kind.component.scss
diff --git a/src/app/pages/example/kind/kind.component.spec.ts b/src/app/features/old-stuff/pages/example/kind/kind.component.spec.ts
similarity index 100%
rename from src/app/pages/example/kind/kind.component.spec.ts
rename to src/app/features/old-stuff/pages/example/kind/kind.component.spec.ts
diff --git a/src/app/pages/example/kind/kind.component.ts b/src/app/features/old-stuff/pages/example/kind/kind.component.ts
similarity index 89%
rename from src/app/pages/example/kind/kind.component.ts
rename to src/app/features/old-stuff/pages/example/kind/kind.component.ts
index 204c4632..26ac05b4 100644
--- a/src/app/pages/example/kind/kind.component.ts
+++ b/src/app/features/old-stuff/pages/example/kind/kind.component.ts
@@ -3,7 +3,7 @@ import { BaseComponent } from '../base-page/base.component';
import { ConfigService } from '../../../services/config.service';
@Component({
- selector: 'framadate-page-kind',
+ selector: 'app-page-kind',
templateUrl: './kind.component.html',
styleUrls: ['./kind.component.scss'],
})
@@ -12,5 +12,5 @@ export class KindComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/pages/example/pictures/pictures.component.html b/src/app/features/old-stuff/pages/example/pictures/pictures.component.html
similarity index 51%
rename from src/app/pages/example/pictures/pictures.component.html
rename to src/app/features/old-stuff/pages/example/pictures/pictures.component.html
index 394de610..c57b6112 100644
--- a/src/app/pages/example/pictures/pictures.component.html
+++ b/src/app/features/old-stuff/pages/example/pictures/pictures.component.html
@@ -2,4 +2,4 @@
Images
-ok
+
ok
diff --git a/src/app/ui/selector/language/language.component.scss b/src/app/features/old-stuff/pages/example/pictures/pictures.component.scss
similarity index 100%
rename from src/app/ui/selector/language/language.component.scss
rename to src/app/features/old-stuff/pages/example/pictures/pictures.component.scss
diff --git a/src/app/pages/example/pictures/pictures.component.spec.ts b/src/app/features/old-stuff/pages/example/pictures/pictures.component.spec.ts
similarity index 100%
rename from src/app/pages/example/pictures/pictures.component.spec.ts
rename to src/app/features/old-stuff/pages/example/pictures/pictures.component.spec.ts
diff --git a/src/app/pages/example/pictures/pictures.component.ts b/src/app/features/old-stuff/pages/example/pictures/pictures.component.ts
similarity index 89%
rename from src/app/pages/example/pictures/pictures.component.ts
rename to src/app/features/old-stuff/pages/example/pictures/pictures.component.ts
index 243b1852..3ae5f225 100644
--- a/src/app/pages/example/pictures/pictures.component.ts
+++ b/src/app/features/old-stuff/pages/example/pictures/pictures.component.ts
@@ -3,7 +3,7 @@ import { ConfigService } from '../../../services/config.service';
import { BaseComponent } from '../base-page/base.component';
@Component({
- selector: 'framadate-pictures',
+ selector: 'app-pictures',
templateUrl: './pictures.component.html',
styleUrls: ['./pictures.component.scss'],
})
@@ -12,5 +12,5 @@ export class PicturesComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/pages/home/home.component.html b/src/app/features/old-stuff/pages/home/home.component.html
similarity index 74%
rename from src/app/pages/home/home.component.html
rename to src/app/features/old-stuff/pages/home/home.component.html
index bc83f09f..1eec32ce 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/features/old-stuff/pages/home/home.component.html
@@ -32,7 +32,7 @@
placeholder="{{ 'creation.choose_title_placeholder' | translate }}"
type="name"
/>
-
+
@@ -44,13 +44,13 @@
placeholder="{{ 'creation.name_placeholder' | translate }}"
type="name"
/>
-
+
-
+
-
+
Continuer
-
+
Continuer
-
+
Retour
diff --git a/src/app/ui/selector/selector.component.scss b/src/app/features/old-stuff/pages/home/home.component.scss
similarity index 100%
rename from src/app/ui/selector/selector.component.scss
rename to src/app/features/old-stuff/pages/home/home.component.scss
diff --git a/src/app/features/old-stuff/pages/home/home.component.spec.ts b/src/app/features/old-stuff/pages/home/home.component.spec.ts
new file mode 100644
index 00000000..85666544
--- /dev/null
+++ b/src/app/features/old-stuff/pages/home/home.component.spec.ts
@@ -0,0 +1,24 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { HomeComponent } from './home.component';
+
+describe('HomeComponent', () => {
+ let component: HomeComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [HomeComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(HomeComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/pages/home/home.component.ts b/src/app/features/old-stuff/pages/home/home.component.ts
similarity index 90%
rename from src/app/pages/home/home.component.ts
rename to src/app/features/old-stuff/pages/home/home.component.ts
index 6fd4fb26..6cb3d1fc 100644
--- a/src/app/pages/home/home.component.ts
+++ b/src/app/features/old-stuff/pages/home/home.component.ts
@@ -3,7 +3,7 @@ import { ConfigService } from '../../services/config.service';
import { BaseComponent } from '../example/base-page/base.component';
@Component({
- selector: 'framadate-home',
+ selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.scss'],
})
@@ -13,5 +13,5 @@ export class HomeComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/pages/password/password.component.html b/src/app/features/old-stuff/pages/password/password.component.html
similarity index 100%
rename from src/app/pages/password/password.component.html
rename to src/app/features/old-stuff/pages/password/password.component.html
diff --git a/src/app/pages/password/password.component.scss b/src/app/features/old-stuff/pages/password/password.component.scss
similarity index 100%
rename from src/app/pages/password/password.component.scss
rename to src/app/features/old-stuff/pages/password/password.component.scss
diff --git a/src/app/pages/password/password.component.spec.ts b/src/app/features/old-stuff/pages/password/password.component.spec.ts
similarity index 100%
rename from src/app/pages/password/password.component.spec.ts
rename to src/app/features/old-stuff/pages/password/password.component.spec.ts
diff --git a/src/app/pages/password/password.component.ts b/src/app/features/old-stuff/pages/password/password.component.ts
similarity index 89%
rename from src/app/pages/password/password.component.ts
rename to src/app/features/old-stuff/pages/password/password.component.ts
index 028c8afc..b8bca6e8 100644
--- a/src/app/pages/password/password.component.ts
+++ b/src/app/features/old-stuff/pages/password/password.component.ts
@@ -3,7 +3,7 @@ import { BaseComponent } from '../example/base-page/base.component';
import { ConfigService } from '../../services/config.service';
@Component({
- selector: 'framadate-password',
+ selector: 'app-password',
templateUrl: './password.component.html',
styleUrls: ['./password.component.scss'],
})
@@ -12,5 +12,5 @@ export class PasswordComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/pages/poll/poll-display/poll-display.component.html b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.html
similarity index 78%
rename from src/app/pages/poll/poll-display/poll-display.component.html
rename to src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.html
index 83b5c306..c6b4bbc8 100644
--- a/src/app/pages/poll/poll-display/poll-display.component.html
+++ b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.html
@@ -12,17 +12,17 @@
-
+
@@ -38,7 +38,7 @@
-
+
Exporter/Imprimer
diff --git a/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.scss b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.scss
new file mode 100644
index 00000000..5ab410dc
--- /dev/null
+++ b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.scss
@@ -0,0 +1 @@
+@import '../../../../../../styles/variables';
diff --git a/src/app/pages/poll/poll-display/poll-display.component.spec.ts b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.spec.ts
similarity index 100%
rename from src/app/pages/poll/poll-display/poll-display.component.spec.ts
rename to src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.spec.ts
diff --git a/src/app/pages/poll/poll-display/poll-display.component.ts b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.ts
similarity index 87%
rename from src/app/pages/poll/poll-display/poll-display.component.ts
rename to src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.ts
index 691bc6d1..d78f0337 100644
--- a/src/app/pages/poll/poll-display/poll-display.component.ts
+++ b/src/app/features/old-stuff/pages/poll/poll-display/poll-display.component.ts
@@ -1,13 +1,13 @@
import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '../../example/base-page/base.component';
import { ConfigService } from '../../../services/config.service';
-import { mockComments } from '../../../mocks/mock-comments';
+import { mockComments } from '../../../../../mocks/mock-comments';
import { ActivatedRoute, Router } from '@angular/router';
-import { environment } from '../../../../environments/environment';
-import { mockPoll3 } from '../../../mocks/mock-poll3';
+import { environment } from '../../../../../../environments/environment';
+import { mockPoll3 } from '../../../../../mocks/mock-poll3';
@Component({
- selector: 'framadate-poll-display',
+ selector: 'app-poll-display',
templateUrl: './poll-display.component.html',
styleUrls: ['./poll-display.component.scss'],
})
@@ -26,7 +26,7 @@ export class PollDisplayComponent extends BaseComponent implements OnInit {
});
}
- ngOnInit() {}
+ ngOnInit(): void {}
// fetch poll with its ID or slug.
fetchPoll() {
diff --git a/src/app/pages/poll/poll-graphic/poll-graphic.component.html b/src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.html
similarity index 100%
rename from src/app/pages/poll/poll-graphic/poll-graphic.component.html
rename to src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.html
diff --git a/src/app/pages/poll/poll-graphic/poll-graphic.component.scss b/src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.scss
similarity index 100%
rename from src/app/pages/poll/poll-graphic/poll-graphic.component.scss
rename to src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.scss
diff --git a/src/app/pages/poll/poll-graphic/poll-graphic.component.spec.ts b/src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.spec.ts
similarity index 100%
rename from src/app/pages/poll/poll-graphic/poll-graphic.component.spec.ts
rename to src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.spec.ts
diff --git a/src/app/pages/poll/poll-graphic/poll-graphic.component.ts b/src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.ts
similarity index 94%
rename from src/app/pages/poll/poll-graphic/poll-graphic.component.ts
rename to src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.ts
index 8bd83d3e..a68cefcb 100644
--- a/src/app/pages/poll/poll-graphic/poll-graphic.component.ts
+++ b/src/app/features/old-stuff/pages/poll/poll-graphic/poll-graphic.component.ts
@@ -1,12 +1,12 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Chart } from 'chart.js';
import { DOCUMENT } from '@angular/common';
-import { mockGraphConfig } from '../../../mocks/mock-graph';
+import { mockGraphConfig } from '../../../../../mocks/mock-graph';
import { ConfigService } from '../../../services/config.service';
-import { mockPoll3 } from '../../../mocks/mock-poll3';
+import { mockPoll3 } from '../../../../../mocks/mock-poll3';
@Component({
- selector: 'framadate-poll-graphic',
+ selector: 'app-poll-graphic',
templateUrl: './poll-graphic.component.html',
styleUrls: ['./poll-graphic.component.scss'],
})
diff --git a/src/app/pages/resume/resume.component.html b/src/app/features/old-stuff/pages/resume/resume.component.html
similarity index 87%
rename from src/app/pages/resume/resume.component.html
rename to src/app/features/old-stuff/pages/resume/resume.component.html
index 5a9f2025..6188de00 100644
--- a/src/app/pages/resume/resume.component.html
+++ b/src/app/features/old-stuff/pages/resume/resume.component.html
@@ -1,6 +1,4 @@
-
- Récapitulatif
-
+
Aperçu
{{ config.title }}
@@ -57,15 +55,15 @@
-
+
C'est parfait!
diff --git a/src/app/pages/resume/resume.component.scss b/src/app/features/old-stuff/pages/resume/resume.component.scss
similarity index 100%
rename from src/app/pages/resume/resume.component.scss
rename to src/app/features/old-stuff/pages/resume/resume.component.scss
diff --git a/src/app/pages/resume/resume.component.spec.ts b/src/app/features/old-stuff/pages/resume/resume.component.spec.ts
similarity index 100%
rename from src/app/pages/resume/resume.component.spec.ts
rename to src/app/features/old-stuff/pages/resume/resume.component.spec.ts
diff --git a/src/app/pages/resume/resume.component.ts b/src/app/features/old-stuff/pages/resume/resume.component.ts
similarity index 93%
rename from src/app/pages/resume/resume.component.ts
rename to src/app/features/old-stuff/pages/resume/resume.component.ts
index f39b802b..16f1398f 100644
--- a/src/app/pages/resume/resume.component.ts
+++ b/src/app/features/old-stuff/pages/resume/resume.component.ts
@@ -4,7 +4,7 @@ import { ConfigService } from '../../services/config.service';
import { Router } from '@angular/router';
@Component({
- selector: 'framadate-resume',
+ selector: 'app-resume',
templateUrl: './resume.component.html',
styleUrls: ['./resume.component.scss'],
})
diff --git a/src/app/pages/visibility/visibility.component.html b/src/app/features/old-stuff/pages/visibility/visibility.component.html
similarity index 93%
rename from src/app/pages/visibility/visibility.component.html
rename to src/app/features/old-stuff/pages/visibility/visibility.component.html
index 0bf89a1a..b59e98b1 100644
--- a/src/app/pages/visibility/visibility.component.html
+++ b/src/app/features/old-stuff/pages/visibility/visibility.component.html
@@ -102,10 +102,10 @@
{{ 'visibility.access_instructions' | translate }}
diff --git a/src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.scss b/src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/pages/voting/choices-list/choices-list.component.spec.ts b/src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.spec.ts
similarity index 100%
rename from src/app/pages/voting/choices-list/choices-list.component.spec.ts
rename to src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.spec.ts
diff --git a/src/app/pages/voting/choices-list/choices-list.component.ts b/src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.ts
similarity index 89%
rename from src/app/pages/voting/choices-list/choices-list.component.ts
rename to src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.ts
index 2c7a4836..bc7e3edc 100644
--- a/src/app/pages/voting/choices-list/choices-list.component.ts
+++ b/src/app/features/old-stuff/pages/voting/choices-list/choices-list.component.ts
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { ConfigService } from '../../../services/config.service';
@Component({
- selector: 'framadate-choices-list',
+ selector: 'app-choices-list',
templateUrl: './choices-list.component.html',
styleUrls: ['./choices-list.component.scss'],
})
diff --git a/src/app/pages/voting/comments-list/comments-list.component.html b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.html
similarity index 89%
rename from src/app/pages/voting/comments-list/comments-list.component.html
rename to src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.html
index 741ab2a4..94f6e71c 100644
--- a/src/app/pages/voting/comments-list/comments-list.component.html
+++ b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.html
@@ -28,7 +28,6 @@
(click)="config.addComment()"
/>
diff --git a/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.scss b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/pages/voting/comments-list/comments-list.component.spec.ts b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.spec.ts
similarity index 100%
rename from src/app/pages/voting/comments-list/comments-list.component.spec.ts
rename to src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.spec.ts
diff --git a/src/app/pages/voting/comments-list/comments-list.component.ts b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.ts
similarity index 88%
rename from src/app/pages/voting/comments-list/comments-list.component.ts
rename to src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.ts
index 0a37d4de..f679e95d 100644
--- a/src/app/pages/voting/comments-list/comments-list.component.ts
+++ b/src/app/features/old-stuff/pages/voting/comments-list/comments-list.component.ts
@@ -2,7 +2,7 @@ import { Component } from '@angular/core';
import { ConfigService } from '../../../services/config.service';
@Component({
- selector: 'framadate-comments-list',
+ selector: 'app-comments-list',
templateUrl: './comments-list.component.html',
styleUrls: ['./comments-list.component.scss'],
})
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.html b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.html
similarity index 99%
rename from src/app/pages/voting/voting-choice/voting-choice.component.html
rename to src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.html
index ca2d2ff8..3be623df 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.html
+++ b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.html
@@ -5,7 +5,7 @@
class="btn btn--primary manage"
(click)="choice.simpleAnswer = !choice.simpleAnswer"
>
-
+
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.scss b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.scss
similarity index 99%
rename from src/app/pages/voting/voting-choice/voting-choice.component.scss
rename to src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.scss
index 94a53856..4b2f821e 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.scss
+++ b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.scss
@@ -5,7 +5,7 @@
// -- IMPORTS
// ----------------------------
-@import '../../../../assets/scss/variables';
+@import '../../../../../../styles/variables';
// -- VARIABLES
// ----------------------------
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.spec.ts
similarity index 95%
rename from src/app/pages/voting/voting-choice/voting-choice.component.spec.ts
rename to src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.spec.ts
index 0df40949..9370c38a 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.spec.ts
+++ b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.spec.ts
@@ -7,8 +7,8 @@ import { ConfirmationService, MessageService } from 'primeng';
import { Router } from '@angular/router';
import { ConfigService } from '../../../services/config.service';
import { VotingChoiceComponent } from './voting-choice.component';
-import { mockChoice } from '../../../mocks/choice';
-import { mockPoll3 } from '../../../mocks/mock-poll3';
+import { mockChoice } from '../../../../../mocks/choice';
+import { mockPoll3 } from '../../../../../mocks/mock-poll3';
const routerSpy = jest.fn({ navigateByUrl: jest.fn() });
diff --git a/src/app/pages/voting/voting-choice/voting-choice.component.ts b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.ts
similarity index 97%
rename from src/app/pages/voting/voting-choice/voting-choice.component.ts
rename to src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.ts
index 664eb457..74693cfc 100644
--- a/src/app/pages/voting/voting-choice/voting-choice.component.ts
+++ b/src/app/features/old-stuff/pages/voting/voting-choice/voting-choice.component.ts
@@ -20,7 +20,7 @@ interface VoteChoice {
* this component is used to select a date choice, or a name answer
*/
@Component({
- selector: 'framadate-voting-choice',
+ selector: 'app-voting-choice',
templateUrl: './voting-choice.component.html',
styleUrls: ['./voting-choice.component.scss'],
})
diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.html b/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.html
similarity index 100%
rename from src/app/pages/voting/voting-comment/voting-comment.component.html
rename to src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.html
diff --git a/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.scss b/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.spec.ts b/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.spec.ts
similarity index 100%
rename from src/app/pages/voting/voting-comment/voting-comment.component.spec.ts
rename to src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.spec.ts
diff --git a/src/app/pages/voting/voting-comment/voting-comment.component.ts b/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.ts
similarity index 70%
rename from src/app/pages/voting/voting-comment/voting-comment.component.ts
rename to src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.ts
index a12cef00..8c3bdc6a 100644
--- a/src/app/pages/voting/voting-comment/voting-comment.component.ts
+++ b/src/app/features/old-stuff/pages/voting/voting-comment/voting-comment.component.ts
@@ -1,8 +1,8 @@
import { Component, Input, OnInit } from '@angular/core';
-import { mockComments } from '../../../mocks/mock-comments';
+import { mockComments } from '../../../../../mocks/mock-comments';
@Component({
- selector: 'framadate-voting-comment',
+ selector: 'app-voting-comment',
templateUrl: './voting-comment.component.html',
styleUrls: ['./voting-comment.component.scss'],
})
@@ -11,5 +11,5 @@ export class VotingCommentComponent implements OnInit {
constructor() {}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.html b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.html
new file mode 100644
index 00000000..4538ee13
--- /dev/null
+++ b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.html
@@ -0,0 +1,2 @@
+
Graphique
+
diff --git a/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.scss b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/pages/voting/voting-graph/voting-graph.component.spec.ts b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.spec.ts
similarity index 100%
rename from src/app/pages/voting/voting-graph/voting-graph.component.spec.ts
rename to src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.spec.ts
diff --git a/src/app/pages/voting/voting-graph/voting-graph.component.ts b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.ts
similarity index 89%
rename from src/app/pages/voting/voting-graph/voting-graph.component.ts
rename to src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.ts
index fdc0aa9f..c0798ef5 100644
--- a/src/app/pages/voting/voting-graph/voting-graph.component.ts
+++ b/src/app/features/old-stuff/pages/voting/voting-graph/voting-graph.component.ts
@@ -3,7 +3,7 @@ import { BaseComponent } from '../../example/base-page/base.component';
import { ConfigService } from '../../../services/config.service';
@Component({
- selector: 'framadate-voting-graph',
+ selector: 'app-voting-graph',
templateUrl: './voting-graph.component.html',
styleUrls: ['./voting-graph.component.scss'],
})
@@ -12,5 +12,5 @@ export class VotingGraphComponent extends BaseComponent implements OnInit {
super(config);
}
- ngOnInit() {}
+ ngOnInit(): void {}
}
diff --git a/src/app/pages/voting/voting-navigation/voting-navigation.component.html b/src/app/features/old-stuff/pages/voting/voting-navigation/voting-navigation.component.html
similarity index 84%
rename from src/app/pages/voting/voting-navigation/voting-navigation.component.html
rename to src/app/features/old-stuff/pages/voting/voting-navigation/voting-navigation.component.html
index b1612ea1..a0ad3065 100644
--- a/src/app/pages/voting/voting-navigation/voting-navigation.component.html
+++ b/src/app/features/old-stuff/pages/voting/voting-navigation/voting-navigation.component.html
@@ -2,23 +2,23 @@