forked from tykayn/funky-framadate-front
upgrade archi with modules
This commit is contained in:
parent
3997dd090e
commit
7029368ab1
@ -1,4 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
stories: ['../src/**/*.stories.ts'],
|
|
||||||
addons: ['@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-notes'],
|
|
||||||
};
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
4
.storybook/typings.d.ts
vendored
4
.storybook/typings.d.ts
vendored
@ -1,4 +0,0 @@
|
|||||||
declare module '*.md' {
|
|
||||||
const content: string;
|
|
||||||
export default content;
|
|
||||||
}
|
|
43
README.md
43
README.md
@ -1,27 +1,26 @@
|
|||||||
## LIBRARIES USED
|
## LIBRARIES USED
|
||||||
|
|
||||||
| lib name | usage |
|
| status | lib name | usage |
|
||||||
| ------------------------------------------------------------------ | -------------------------------------- |
|
| ------- | -------------------------------------------------------------- | -------------------------------------- |
|
||||||
| [axios](https://github.com/axios/axios) | http client |
|
| | [axios](https://github.com/axios/axios) | http client |
|
||||||
| [bulma](https://bulma.io/) | CSS framework |
|
| | [bulma](https://bulma.io/) | CSS framework |
|
||||||
| [chart.js](https://www.chartjs.org/) | Generate beautiful graphs |
|
| | [chart.js](https://www.chartjs.org/) | Display graphs. (Commes with MomentJS) |
|
||||||
| [compodoc](https://compodoc.app/) | Generate technic documentation |
|
| | [compodoc](https://compodoc.app/) | Generate technic documentation |
|
||||||
| [date-fns](https://date-fns.org) | manipulate dates |
|
| | [date-fns](https://date-fns.org) | manipulate dates |
|
||||||
| ESlint, Prettier, Lint-staged | Format & lint code |
|
| | ESlint, Prettier, Lint-staged | Format & lint code |
|
||||||
| [font-awesome](https://github.com/FortAwesome/angular-fontawesome) | Icons collection |
|
| | [fork-awesome](https://forkaweso.me) | Icons collection |
|
||||||
| [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
|
| | [fullcalendar](https://fullcalendar.io/docs/initialize-es6) | Manage & display calendars |
|
||||||
| [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
|
| | [husky](https://www.npmjs.com/package/husky) | Hook actions on commit |
|
||||||
| [jest](https://jestjs.io/) | test engine |
|
| | [jest](https://jestjs.io/) | test engine |
|
||||||
| [locale-enum](https://www.npmjs.com/package/locale-enum) | enum of all locales |
|
| 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-clipboard](https://www.npmjs.com/package/ngx-clipboard) | Handle clipboard |
|
||||||
| [ngx-markdown](https://www.npmjs.com/package/ngx-markdown) | markdown parser |
|
| | [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 |
|
||||||
| [ngx-webstorage](https://www.npmjs.com/package/ngx-webstorage) | handle localStorage & webStorage |
|
| | [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
|
||||||
| [primeNG](https://www.primefaces.org/primeng/) | UI components collection |
|
| | [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
|
||||||
| [quill](https://www.npmjs.com/package/quill) | powerful rich text editor. WYSIWYG. |
|
| removed | [storybook](https://storybook.js.org/) | StyleGuide UI |
|
||||||
| [storybook](https://storybook.js.org/) | StyleGuide UI |
|
| | [ts-mockito](https://www.npmjs.com/package/ts-mockito) | Mocks for testing. |
|
||||||
| [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 |
|
||||||
| [uuid](https://www.npmjs.com/package/uuid) | handle client-side generation of uuids |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
"aot": true,
|
|
||||||
"assets": ["src/favicon.ico", "src/assets"],
|
"assets": ["src/favicon.ico", "src/assets"],
|
||||||
"styles": [
|
"styles": [
|
||||||
"node_modules/fork-awesome/css/fork-awesome.min.css",
|
"node_modules/fork-awesome/css/fork-awesome.min.css",
|
||||||
@ -50,9 +49,11 @@
|
|||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"extractCss": true,
|
"extractCss": true,
|
||||||
"namedChunks": false,
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
"extractLicenses": true,
|
"extractLicenses": true,
|
||||||
"vendorChunk": false,
|
"vendorChunk": false,
|
||||||
"buildOptimizer": true,
|
"buildOptimizer": true,
|
||||||
|
"crossOrigin": "anonymous",
|
||||||
"budgets": [
|
"budgets": [
|
||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
// 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}
|
|
||||||
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}
|
|
||||||
-------------------------- -------- -------- ------ ------------------------------------------------
|
|
||||||
*/
|
|
46
backend-api-endpoints-doc.txt
Normal file
46
backend-api-endpoints-doc.txt
Normal file
@ -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}
|
||||||
|
-------------------------- -------- -------- ------ ------------------------------------------------
|
||||||
|
*/
|
@ -1,13 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "../tsconfig.json",
|
"extends": "../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"outDir": "../out-tsc/e2e",
|
"outDir": "../out-tsc/e2e",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"types": [
|
"types": ["jasmine", "jasminewd2", "node"]
|
||||||
"jasmine",
|
}
|
||||||
"jasminewd2",
|
|
||||||
"node"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
30
package.json
30
package.json
@ -5,11 +5,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"compodoc": "compodoc -p tsconfig.json",
|
"build": "ng build --prod --progress=true",
|
||||||
"build": "ng build --crossOrigin=anonymous --prod",
|
"build-prod-stats": "ng build --prod --stats-json",
|
||||||
"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",
|
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watch",
|
"test:watch": "jest --watch",
|
||||||
"test:ci": "jest --runInBand",
|
"test:ci": "jest --runInBand",
|
||||||
@ -18,13 +15,12 @@
|
|||||||
"format:check": "prettier --list-different \"src/{app,environments,assets}/**/*{.ts,.js,.json,.css,.scss}\"",
|
"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}\"",
|
"format:all": "prettier --write \"src/**/*.{js,jsx,ts,tsx,md,html,css,scss}\"",
|
||||||
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
|
"trans": "ng xi18n --output-path=src/locale --i18n-locale=fr",
|
||||||
"storybook": "start-storybook -p 6006",
|
"compodoc": "compodoc -p tsconfig.app.json"
|
||||||
"build-storybook": "build-storybook"
|
|
||||||
},
|
},
|
||||||
"private": false,
|
"private": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^9.1.1",
|
"@angular/animations": "^9.1.1",
|
||||||
"@angular/cdk": "^9.2.0",
|
"@angular/cdk": "^9.2.2",
|
||||||
"@angular/common": "^9.0.7",
|
"@angular/common": "^9.0.7",
|
||||||
"@angular/compiler": "^9.0.7",
|
"@angular/compiler": "^9.0.7",
|
||||||
"@angular/core": "^9.0.7",
|
"@angular/core": "^9.0.7",
|
||||||
@ -39,13 +35,11 @@
|
|||||||
"angular-date-value-accessor": "^1.0.2",
|
"angular-date-value-accessor": "^1.0.2",
|
||||||
"axios": "^0.19.2",
|
"axios": "^0.19.2",
|
||||||
"bulma": "^0.8.2",
|
"bulma": "^0.8.2",
|
||||||
"chart.js": "^2.8.0",
|
"chart.js": "^2.9.3",
|
||||||
"date-fns": "^2.12.0",
|
"date-fns": "^2.12.0",
|
||||||
"fork-awesome": "^1.1.7",
|
"fork-awesome": "^1.1.7",
|
||||||
"locale-enum": "^1.1.0",
|
|
||||||
"ngx-clipboard": "^13.0.0",
|
"ngx-clipboard": "^13.0.0",
|
||||||
"ngx-markdown": "^9.0.0",
|
"ngx-markdown": "^9.0.0",
|
||||||
"ngx-toaster": "^1.0.1",
|
|
||||||
"ngx-webstorage": "^5.0.0",
|
"ngx-webstorage": "^5.0.0",
|
||||||
"primeicons": "^2.0.0",
|
"primeicons": "^2.0.0",
|
||||||
"primeng": "^9.0.6",
|
"primeng": "^9.0.6",
|
||||||
@ -53,7 +47,7 @@
|
|||||||
"rxjs": "^6.5.5",
|
"rxjs": "^6.5.5",
|
||||||
"rxjs-compat": "^6.5.5",
|
"rxjs-compat": "^6.5.5",
|
||||||
"tslib": "^1.11.1",
|
"tslib": "^1.11.1",
|
||||||
"uuid": "^7.0.3",
|
"uuid": "^8.0.0",
|
||||||
"zone.js": "^0.10.3"
|
"zone.js": "^0.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -64,25 +58,19 @@
|
|||||||
"@angular/language-service": "^9.0.7",
|
"@angular/language-service": "^9.0.7",
|
||||||
"@babel/core": "^7.9.0",
|
"@babel/core": "^7.9.0",
|
||||||
"@babel/preset-env": "^7.9.5",
|
"@babel/preset-env": "^7.9.5",
|
||||||
"@storybook/addon-actions": "^5.3.18",
|
"@babel/preset-typescript": "^7.9.0",
|
||||||
"@storybook/addon-links": "^5.3.18",
|
"@compodoc/compodoc": "^1.1.11",
|
||||||
"@storybook/addon-notes": "^5.3.18",
|
|
||||||
"@storybook/addons": "^5.3.18",
|
|
||||||
"@storybook/angular": "^5.3.18",
|
|
||||||
"@types/jest": "^25.2.1",
|
"@types/jest": "^25.2.1",
|
||||||
"@types/node": "^13.13.2",
|
"@types/node": "^13.13.2",
|
||||||
"@types/uuid": "^7.0.2",
|
"@types/uuid": "^7.0.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
"@typescript-eslint/eslint-plugin": "^2.27.0",
|
||||||
"@typescript-eslint/parser": "^2.27.0",
|
"@typescript-eslint/parser": "^2.27.0",
|
||||||
"babel-jest": "^25.4.0",
|
"babel-jest": "^25.4.0",
|
||||||
"babel-loader": "^8.1.0",
|
|
||||||
"babel-polyfill": "^6.26.0",
|
|
||||||
"compodoc": "^0.0.41",
|
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"eslint-plugin-prettier": "^3.1.3",
|
"eslint-plugin-prettier": "^3.1.3",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jest": "^25.4.0",
|
"jest": "^25.5.1",
|
||||||
"jest-environment-jsdom-sixteen": "^1.0.3",
|
"jest-environment-jsdom-sixteen": "^1.0.3",
|
||||||
"jest-preset-angular": "^8.1.3",
|
"jest-preset-angular": "^8.1.3",
|
||||||
"lint-staged": "^10.1.7",
|
"lint-staged": "^10.1.7",
|
||||||
|
@ -1,45 +1,13 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule, Routes } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { PageNotFoundComponent } from './core/components/page-not-found/page-not-found.component';
|
import { HomeComponent } from './core/components/home/home.component';
|
||||||
import { AdminComponent } from './pages/admin/admin.component';
|
import { LoginComponent } from './core/components/login/login.component';
|
||||||
import { AnswersComponent } from './pages/answers/answers.component';
|
import { PageNotFoundComponent } from './shared/components/page-not-found/page-not-found.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 = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: 'step/creation', pathMatch: 'full' },
|
{ path: '', component: HomeComponent },
|
||||||
{ path: 'admin/:token', component: AdminComponent }, // http://localhost:4200/#/admin/srfdgedsTGETHRYJtujTUjTUkTIUKTK
|
{ path: 'login', component: LoginComponent },
|
||||||
{ 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: 'administration',
|
path: 'administration',
|
||||||
loadChildren: () =>
|
loadChildren: () =>
|
||||||
@ -49,11 +17,19 @@ const routes: Routes = [
|
|||||||
path: 'participation',
|
path: 'participation',
|
||||||
loadChildren: () => import('./features/participation/participation.module').then((m) => m.ParticipationModule),
|
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 },
|
{ path: '**', component: PageNotFoundComponent },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes, { useHash: true, anchorScrolling: 'enabled' })],
|
imports: [
|
||||||
|
RouterModule.forRoot(routes, {
|
||||||
|
// enableTracing: true, // <-- debugging purposes only
|
||||||
|
}),
|
||||||
|
],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
})
|
})
|
||||||
export class AppRoutingModule {}
|
export class AppRoutingModule {}
|
||||||
|
@ -1,42 +1,15 @@
|
|||||||
<div id="big_container" [class]="themeClass">
|
<div id="big_container" [class]="themeClass">
|
||||||
<header class="big-header">
|
<app-header [isSidebarOpened]="isSidebarOpened" (toggleSidebarEE)="toggleSidebar($event)"></app-header>
|
||||||
<div class="container">
|
|
||||||
<div class="columns is-mobile is-vcentered">
|
|
||||||
<div class="column is-pulled-left has-addons">
|
|
||||||
<img
|
|
||||||
(click)="toggleMenu()"
|
|
||||||
alt="menu icon"
|
|
||||||
class="menu_icon clickable"
|
|
||||||
src="assets/img/icone-menu.svg"
|
|
||||||
/>
|
|
||||||
<br />
|
|
||||||
<span (click)="toggleMenu()" class="menu_label">Menu</span>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<app-logo></app-logo>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<app-theme-selector></app-theme-selector>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<app-language-selector></app-language-selector>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="container">
|
<router-outlet></router-outlet>
|
||||||
<div class="columns is-mobile">
|
|
||||||
<div class="column is-one-quarter togglable-menu" *ngIf="config.menuVisible">
|
|
||||||
<app-navigation [step]="step"></app-navigation>
|
|
||||||
<app-debugger *ngIf="isDebugMode"></app-debugger>
|
|
||||||
</div>
|
|
||||||
<div class="column">
|
|
||||||
<router-outlet></router-outlet>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</main>
|
</main>
|
||||||
<p-toast position="top-right"></p-toast>
|
|
||||||
|
<app-footer></app-footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p-toast position="bottom-center"></p-toast>
|
||||||
|
|
||||||
|
<p-sidebar [(visible)]="isSidebarOpened">
|
||||||
|
<app-navigation></app-navigation>
|
||||||
|
</p-sidebar>
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
@charset "UTF-8";
|
|
||||||
|
|
||||||
.big-header {
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.language-selector {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
@ -1,14 +1,12 @@
|
|||||||
import { DOCUMENT } from '@angular/common';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { Component, Inject, OnInit, OnDestroy } from '@angular/core';
|
|
||||||
import { Title } from '@angular/platform-browser';
|
import { Title } from '@angular/platform-browser';
|
||||||
import { NavigationStart, Router } from '@angular/router';
|
import { Subscription } from 'rxjs';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
|
||||||
import { filter } from 'rxjs/operators';
|
|
||||||
|
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { Theme } from './core/enums/theme.enum';
|
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';
|
import { ThemeService } from './core/services/theme.service';
|
||||||
import { ConfigService } from './services/config.service';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -18,24 +16,19 @@ import { ConfigService } from './services/config.service';
|
|||||||
export class AppComponent implements OnInit, OnDestroy {
|
export class AppComponent implements OnInit, OnDestroy {
|
||||||
public appTitle: string = environment.appTitle;
|
public appTitle: string = environment.appTitle;
|
||||||
public themeClass: string;
|
public themeClass: string;
|
||||||
public isDebugMode = false;
|
public isSidebarOpened = false;
|
||||||
private themeSubscription: Subscription;
|
private themeSubscription: Subscription;
|
||||||
|
|
||||||
public step: string;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private titleService: Title,
|
private titleService: Title,
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
public config: ConfigService,
|
private mockingService: MockingService
|
||||||
@Inject(DOCUMENT) private document,
|
|
||||||
private router: Router
|
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
this.isDebugMode = true;
|
this.appTitle += ' [DEV]';
|
||||||
this.appTitle += ' | DEV';
|
this.mockingService.loadUser(UserRole.REGISTERED);
|
||||||
console.info(' ######### framadate | DEV ######### we are NOT in production env, filling with mock values');
|
|
||||||
}
|
}
|
||||||
this.titleService.setTitle(this.appTitle);
|
this.titleService.setTitle(this.appTitle);
|
||||||
this.themeSubscription = this.themeService.theme.subscribe((theme: Theme) => {
|
this.themeSubscription = this.themeService.theme.subscribe((theme: Theme) => {
|
||||||
@ -50,8 +43,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
this.themeClass = 'theme-light-watermelon';
|
this.themeClass = 'theme-light-watermelon';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.detectCurrentTabOnRouteChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
@ -60,30 +51,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public detectCurrentTabOnRouteChange(): void {
|
public toggleSidebar(status: boolean): void {
|
||||||
this.router.events
|
this.isSidebarOpened = status === true;
|
||||||
.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);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public scrollGoToTop(): void {
|
|
||||||
this.document.documentElement.scrollTop = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public updateCurrentTab(event): void {
|
|
||||||
if (event.url) {
|
|
||||||
const tab: string[] = event.url.split('/');
|
|
||||||
this.step = tab && tab[2] ? tab[2] : 'home';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public toggleMenu(): void {
|
|
||||||
// TODO: move this logic elsewhere, probably in Navbar component
|
|
||||||
this.config.menuVisible = !this.config.menuVisible;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,48 +15,13 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
|||||||
import { ClipboardModule } from 'ngx-clipboard';
|
import { ClipboardModule } from 'ngx-clipboard';
|
||||||
import { MarkdownModule } from 'ngx-markdown';
|
import { MarkdownModule } from 'ngx-markdown';
|
||||||
import { NgxWebstorageModule } from 'ngx-webstorage';
|
import { NgxWebstorageModule } from 'ngx-webstorage';
|
||||||
import { ConfirmationService, MessageModule, MessageService } from 'primeng';
|
|
||||||
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
||||||
import { DialogModule } from 'primeng/dialog';
|
|
||||||
import { ToastModule } from 'primeng/toast';
|
|
||||||
|
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { CoreModule } from './core/core.module';
|
import { CoreModule } from './core/core.module';
|
||||||
import { DateValueAccessorModule } from './custom-lib/date-value-accessor';
|
import { OldStuffModule } from './features/old-stuff/old-stuff.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 { SharedModule } from './shared/shared.module';
|
import { SharedModule } from './shared/shared.module';
|
||||||
import { CopyTextComponent } from './ui/copy-text/copy-text.component';
|
|
||||||
import { DebuggerComponent } from './ui/debugger/debugger.component';
|
|
||||||
import { ResettableInputDirective } from './ui/directives/resettable-input.directive';
|
|
||||||
import { ErasableInputComponent } from './ui/erasable-input/erasable-input.component';
|
|
||||||
import { NavigationComponent } from './ui/navigation/navigation.component';
|
|
||||||
import { TwoLinksComponent } from './ui/navigation/two-links/two-links.component';
|
|
||||||
import { LanguageSelectorComponent } from './ui/selectors/language-selector/language-selector.component';
|
|
||||||
import { ThemeSelectorComponent } from './ui/selectors/theme-selector/theme-selector.component';
|
|
||||||
|
|
||||||
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
export class MyMissingTranslationHandler implements MissingTranslationHandler {
|
||||||
public handle(params: MissingTranslationHandlerParams): string {
|
public handle(params: MissingTranslationHandlerParams): string {
|
||||||
@ -69,56 +34,19 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [AppComponent],
|
||||||
AdminComponent,
|
|
||||||
AnswersComponent,
|
|
||||||
AppComponent,
|
|
||||||
BaseComponent,
|
|
||||||
ChoicesListComponent,
|
|
||||||
CommentsListComponent,
|
|
||||||
CopyTextComponent,
|
|
||||||
CreateOrRetrieveComponent,
|
|
||||||
DatesComponent,
|
|
||||||
DebuggerComponent,
|
|
||||||
EndConfirmationComponent,
|
|
||||||
ErasableInputComponent,
|
|
||||||
HomeComponent,
|
|
||||||
KindComponent,
|
|
||||||
NavigationComponent,
|
|
||||||
PasswordComponent,
|
|
||||||
PicturesComponent,
|
|
||||||
PollDisplayComponent,
|
|
||||||
PollGraphicComponent,
|
|
||||||
ResettableInputDirective,
|
|
||||||
ResumeComponent,
|
|
||||||
ThemeSelectorComponent,
|
|
||||||
TwoLinksComponent,
|
|
||||||
VisibilityComponent,
|
|
||||||
VotingChoiceComponent,
|
|
||||||
VotingGraphComponent,
|
|
||||||
VotingComponent,
|
|
||||||
VotingCommentComponent,
|
|
||||||
VotingSummaryComponent,
|
|
||||||
VotingNavigationComponent,
|
|
||||||
LanguageSelectorComponent,
|
|
||||||
],
|
|
||||||
imports: [
|
imports: [
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
ClipboardModule,
|
ClipboardModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
ConfirmDialogModule,
|
|
||||||
CoreModule,
|
CoreModule,
|
||||||
DateValueAccessorModule,
|
|
||||||
DialogModule,
|
|
||||||
FormsModule,
|
FormsModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
MarkdownModule.forRoot(),
|
MarkdownModule.forRoot(),
|
||||||
MessageModule,
|
|
||||||
NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
|
NgxWebstorageModule.forRoot({ prefix: environment.localStorage.key }),
|
||||||
SharedModule,
|
SharedModule,
|
||||||
ToastModule,
|
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
@ -131,8 +59,9 @@ export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
|||||||
},
|
},
|
||||||
useDefaultLang: false,
|
useDefaultLang: false,
|
||||||
}),
|
}),
|
||||||
|
OldStuffModule,
|
||||||
],
|
],
|
||||||
providers: [ConfigService, ConfirmationService, MessageService, Title, TranslateService],
|
providers: [Title, TranslateService],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
export class AppModule {}
|
export class AppModule {}
|
||||||
|
@ -1 +1,9 @@
|
|||||||
<p>footer works!</p>
|
<footer class="footer">
|
||||||
|
<div class="content has-text-centered">
|
||||||
|
<p>
|
||||||
|
<strong>Bulma</strong> by <a href="https://jgthms.com">Jeremy Thomas</a>. The source code is licensed
|
||||||
|
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. The website content is licensed
|
||||||
|
<a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY NC SA 4.0</a>.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
74
src/app/core/components/header/header.component.html
Normal file
74
src/app/core/components/header/header.component.html
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<header>
|
||||||
|
<nav class="navbar" role="navigation" aria-label="main navigation">
|
||||||
|
<div class="navbar-brand">
|
||||||
|
<a class="navbar-item">
|
||||||
|
<a class="navbar-item" role="button" (click)="toggleSidebarOpening()"> Dev menu </a>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
role="button"
|
||||||
|
class="navbar-burger burger"
|
||||||
|
aria-label="menu"
|
||||||
|
aria-expanded="false"
|
||||||
|
data-target="navbarBasicExample"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="navbarBasicExample" class="navbar-menu">
|
||||||
|
<div class="navbar-start">
|
||||||
|
<a class="navbar-item" routerLink="/" routerLinkActive="is-active">
|
||||||
|
Home
|
||||||
|
</a>
|
||||||
|
<div class="navbar-item has-dropdown is-hoverable">
|
||||||
|
<a class="navbar-link"> Menu </a>
|
||||||
|
<div class="navbar-dropdown">
|
||||||
|
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
|
||||||
|
Créer un sondage
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" routerLink="administration/profile" routerLinkActive="is-active">
|
||||||
|
Mes sondages
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-item has-dropdown is-hoverable">
|
||||||
|
<a class="navbar-link"> Modules </a>
|
||||||
|
<div class="navbar-dropdown">
|
||||||
|
<a class="navbar-item" routerLink="administration" routerLinkActive="is-active">
|
||||||
|
Administration
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" routerLink="participation" routerLinkActive="is-active">
|
||||||
|
Participation
|
||||||
|
</a>
|
||||||
|
<a class="navbar-item" routerLink="oldstuff" routerLinkActive="is-active">
|
||||||
|
Old stuff
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-item">
|
||||||
|
<app-theme-selector></app-theme-selector>
|
||||||
|
</div>
|
||||||
|
<div class="navbar-item">
|
||||||
|
<app-language-selector></app-language-selector>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="navbar-end">
|
||||||
|
<div class="navbar-item">
|
||||||
|
<div class="buttons">
|
||||||
|
<a class="button is-primary">
|
||||||
|
<strong>Sign up</strong>
|
||||||
|
</a>
|
||||||
|
<a class="button is-light">
|
||||||
|
Log in
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</header>
|
@ -1,19 +1,19 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { NavbarComponent } from './navbar.component';
|
import { HeaderComponent } from './header.component';
|
||||||
|
|
||||||
describe('NavbarComponent', () => {
|
describe('HeaderComponent', () => {
|
||||||
let component: NavbarComponent;
|
let component: HeaderComponent;
|
||||||
let fixture: ComponentFixture<NavbarComponent>;
|
let fixture: ComponentFixture<HeaderComponent>;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [NavbarComponent],
|
declarations: [HeaderComponent],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(NavbarComponent);
|
fixture = TestBed.createComponent(HeaderComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
16
src/app/core/components/header/header.component.ts
Normal file
16
src/app/core/components/header/header.component.ts
Normal file
@ -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<boolean>();
|
||||||
|
|
||||||
|
public toggleSidebarOpening(): void {
|
||||||
|
this.isSidebarOpened = !this.isSidebarOpened;
|
||||||
|
this.toggleSidebarEE.emit(this.isSidebarOpened);
|
||||||
|
}
|
||||||
|
}
|
19
src/app/core/components/home/home.component.html
Normal file
19
src/app/core/components/home/home.component.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<section class="hero">
|
||||||
|
<div class="hero-body">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="title">
|
||||||
|
Bienvenue sur Framasondage
|
||||||
|
</h1>
|
||||||
|
<h2 class="subtitle">
|
||||||
|
Se consulter simplement pour s’organiser collectivement.
|
||||||
|
</h2>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<a role="button" class="button is-fullwidth" routerLink="administration">
|
||||||
|
Créer un nouveau sondage
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
12
src/app/core/components/home/home.component.ts
Normal file
12
src/app/core/components/home/home.component.ts
Normal file
@ -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 {}
|
||||||
|
}
|
1
src/app/core/components/login/login.component.html
Normal file
1
src/app/core/components/login/login.component.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<p>login works!</p>
|
@ -1,19 +1,19 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { DebuggerComponent } from './debugger.component';
|
import { LoginComponent } from './login.component';
|
||||||
|
|
||||||
describe('DebuggerComponent', () => {
|
describe('LoginComponent', () => {
|
||||||
let component: DebuggerComponent;
|
let component: LoginComponent;
|
||||||
let fixture: ComponentFixture<DebuggerComponent>;
|
let fixture: ComponentFixture<LoginComponent>;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [DebuggerComponent],
|
declarations: [LoginComponent],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(DebuggerComponent);
|
fixture = TestBed.createComponent(LoginComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
12
src/app/core/components/login/login.component.ts
Normal file
12
src/app/core/components/login/login.component.ts
Normal file
@ -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 {}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<div class="home_link">
|
<div class="home_link">
|
||||||
<a class="button" routerLink="/home" aria-roledescription="home">
|
<a class="button" routerLink="/" aria-roledescription="home">
|
||||||
<h1>
|
<h1>
|
||||||
<span class="logo_first">Frama</span>
|
<span class="logo_first">Frama</span>
|
||||||
<span class="logo_second">Sondage</span>
|
<span class="logo_second">Sondage</span>
|
||||||
|
@ -1 +0,0 @@
|
|||||||
<p>navbar works!</p>
|
|
@ -1,12 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-navbar',
|
|
||||||
templateUrl: './navbar.component.html',
|
|
||||||
styleUrls: ['./navbar.component.scss'],
|
|
||||||
})
|
|
||||||
export class NavbarComponent implements OnInit {
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<div class="hero">
|
|
||||||
This page doesn't exist.
|
|
||||||
</div>
|
|
@ -1,8 +1,8 @@
|
|||||||
import { Component, DoCheck, OnInit } from '@angular/core';
|
import { Component, DoCheck, OnInit } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { Language } from '../../../core/enums/language.enum';
|
import { Language } from '../../../enums/language.enum';
|
||||||
import { StorageService } from '../../../core/services/storage.service';
|
import { StorageService } from '../../../services/storage.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-language-selector',
|
selector: 'app-language-selector',
|
@ -1,8 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { Theme } from '../../../core/enums/theme.enum';
|
import { Theme } from '../../../enums/theme.enum';
|
||||||
import { ThemeService } from '../../../core/services/theme.service';
|
import { ThemeService } from '../../../services/theme.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-theme-selector',
|
selector: 'app-theme-selector',
|
@ -0,0 +1,23 @@
|
|||||||
|
<nav>
|
||||||
|
<a class="button" routerLink="administration" routerLinkActive="active"> AdministrationModule</a>
|
||||||
|
<a class="button" routerLink="participation/poll/SuperCustomSlug" routerLinkActive="active">
|
||||||
|
Participate to poll/SuperCustomSlug
|
||||||
|
</a>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a class="button" routerLink="oldstuff/home" routerLinkActive="active"> <i class="fa fa-home"></i> Accueil </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/creation" routerLinkActive="active"> Création </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/date" routerLinkActive="active"> Les Dates </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/answers" routerLinkActive="active"> Réponses </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/visibility" routerLinkActive="active"> Visibilité </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/resume" routerLinkActive="active"> Résumé </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/end" routerLinkActive="active"> Confirmation </a>
|
||||||
|
<a class="button" routerLink="oldstuff/step/admin"> Administration </a>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<a class="button" routerLink="oldstuff/step/kind" routerLinkActive="active"> Page démo </a>
|
||||||
|
<a class="button" routerLink="oldstuff/vote/poll/id/1" routerLinkActive="active"> Sondage 1 </a>
|
||||||
|
<a class="button" routerLink="oldstuff/vote/poll/id/2" routerLinkActive="active"> Sondage 2 </a>
|
||||||
|
<a class="button" routerLink="oldstuff/vote/poll/id/3" routerLinkActive="active"> Sondage 3 (dessins animés) </a>
|
||||||
|
<a class="button" routerLink="oldstuff/graphic/toto" routerLinkActive="active"> Graphique </a>
|
||||||
|
</nav>
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,32 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
import { NgModule, Optional, SkipSelf } from '@angular/core';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { FooterComponent } from './components/footer/footer.component';
|
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 { LogoComponent } from './components/logo/logo.component';
|
||||||
import { NavbarComponent } from './components/navbar/navbar.component';
|
import { LanguageSelectorComponent } from './components/selectors/language-selector/language-selector.component';
|
||||||
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.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';
|
import { throwIfAlreadyLoaded } from './guards/module-import.guard';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
|
declarations: [
|
||||||
imports: [CommonModule, RouterModule],
|
FooterComponent,
|
||||||
exports: [FooterComponent, LogoComponent, NavbarComponent, PageNotFoundComponent],
|
HeaderComponent,
|
||||||
|
HomeComponent,
|
||||||
|
LanguageSelectorComponent,
|
||||||
|
LoginComponent,
|
||||||
|
LogoComponent,
|
||||||
|
NavigationComponent,
|
||||||
|
ThemeSelectorComponent,
|
||||||
|
],
|
||||||
|
imports: [CommonModule, FormsModule, RouterModule, TranslateModule],
|
||||||
|
exports: [HeaderComponent, FooterComponent, NavigationComponent, LoginComponent, LogoComponent],
|
||||||
})
|
})
|
||||||
export class CoreModule {
|
export class CoreModule {
|
||||||
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
constructor(@Optional() @SkipSelf() parentModule: CoreModule) {
|
||||||
|
6
src/app/core/enums/message-severity.enum.ts
Normal file
6
src/app/core/enums/message-severity.enum.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export enum MessageSeverity {
|
||||||
|
SUCCESS = 'success',
|
||||||
|
INFO = 'info',
|
||||||
|
WARN = 'warn',
|
||||||
|
ERROR = 'error',
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
export enum PollType {
|
|
||||||
CLASSIC = 'CLASSIC',
|
|
||||||
DATES = 'DATES',
|
|
||||||
}
|
|
5
src/app/core/enums/user-role.enum.ts
Normal file
5
src/app/core/enums/user-role.enum.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export enum UserRole {
|
||||||
|
ANONYMOUS = 'ANONYMOUS',
|
||||||
|
REGISTERED = 'ADMIN',
|
||||||
|
ADMIN = 'ADMIN',
|
||||||
|
}
|
5
src/app/core/enums/workflow-step.enum.ts
Normal file
5
src/app/core/enums/workflow-step.enum.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export enum WorkflowStep {
|
||||||
|
DESCRIPTION = 'DESCRIPTION',
|
||||||
|
OPTIONS = 'OPTIONS',
|
||||||
|
CONFIGURATION = 'CONFIGURATION',
|
||||||
|
}
|
@ -1,19 +1,23 @@
|
|||||||
import { PollType } from '../enums/poll-type.enum';
|
|
||||||
import { Answer } from './answer.model';
|
import { Answer } from './answer.model';
|
||||||
import { PollConfig } from './poll-config.model';
|
import { PollConfig } from './poll-config.model';
|
||||||
import { PollOption } from './poll-options.model';
|
import { PollOption } from './poll-options.model';
|
||||||
import { User } from './user.model';
|
import { User } from './user.model';
|
||||||
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
export class Poll {
|
export class Poll {
|
||||||
constructor(
|
constructor(
|
||||||
public id: string,
|
public isDateType: boolean,
|
||||||
public slug: string,
|
|
||||||
public type: PollType,
|
|
||||||
public title: string,
|
public title: string,
|
||||||
public description: string,
|
public description: string,
|
||||||
public owner: User,
|
public slug: string,
|
||||||
public config: PollConfig,
|
public id: string,
|
||||||
|
public owner?: User,
|
||||||
|
public config?: PollConfig,
|
||||||
public options: PollOption[] = [],
|
public options: PollOption[] = [],
|
||||||
public answers: Answer[] = []
|
public answers: Answer[] = []
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
public getUrl(): string {
|
||||||
|
return `${environment.api.baseHref}/${this.slug}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { Poll } from './poll.model';
|
import { Poll } from './poll.model';
|
||||||
|
import { UserRole } from '../enums/user-role.enum';
|
||||||
|
|
||||||
export class User {
|
export class User {
|
||||||
constructor(
|
constructor(
|
||||||
|
public role: UserRole = UserRole.ANONYMOUS,
|
||||||
public isOwner: boolean = false,
|
public isOwner: boolean = false,
|
||||||
public pseudo?: string,
|
public pseudo?: string,
|
||||||
public email?: string,
|
public email?: string,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import axios, { AxiosResponse } from 'axios';
|
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
import { Poll } from '../models/poll.model';
|
import { Poll } from '../models/poll.model';
|
||||||
@ -9,14 +9,26 @@ import { User } from '../models/user.model';
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ApiService {
|
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 //
|
// CREATE //
|
||||||
////////////
|
////////////
|
||||||
public async savePoll(poll: Poll): Promise<void> {
|
public async savePoll(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await axios.post(`${environment.api.baseHref}${environment.api.endpoints.poll.name}`, {
|
await this.axiosInstance.post(`${this.pollsEndpoint}`, { params: { config: poll.config } });
|
||||||
params: { config: poll.config },
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -25,10 +37,9 @@ export class ApiService {
|
|||||||
public async saveVote(poll: Poll): Promise<void> {
|
public async saveVote(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: add the votestack in the params
|
// TODO: add the votestack in the params
|
||||||
await axios.post(
|
await this.axiosInstance.post(`${this.pollsEndpoint}/${poll.id}${this.votesEndpoint}`, {
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}/${poll.id}${environment.api.endpoints.poll.vote.name}`,
|
params: { voteStack: {} },
|
||||||
{ params: { voteStack: {} } }
|
});
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -37,10 +48,9 @@ export class ApiService {
|
|||||||
public async saveComment(poll: Poll, comment: string): Promise<void> {
|
public async saveComment(poll: Poll, comment: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: add the comment in the params
|
// TODO: add the comment in the params
|
||||||
await axios.post(
|
await this.axiosInstance.post(`${this.pollsEndpoint}/${poll.id}${this.commentsEndpoint}`, {
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}/${poll.id}${environment.api.endpoints.poll.comment.name}`,
|
params: { comment },
|
||||||
{ params: { comment } }
|
});
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -52,22 +62,27 @@ export class ApiService {
|
|||||||
public async isSlugAvailable(slug: string): Promise<boolean> {
|
public async isSlugAvailable(slug: string): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
// TODO: scenario should be : if we can get this slug, it exists. if not, it doesn't. It's just a GET.
|
// 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(
|
const response: AxiosResponse = await this.axiosInstance.get(
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.slug.name}/${slug}`
|
`${this.pollsEndpoint}${this.slugsEndpoint}/${slug}`
|
||||||
);
|
);
|
||||||
return response && response.status === 404 ? true : false;
|
if (response?.status !== 404) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
if (error.response?.status === 404) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
this.handleError(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async sendEmailToUserOfItsPollsList(email: string): Promise<Poll[]> {
|
public async sendEmailToUserOfItsPollsList(user: User): Promise<void> {
|
||||||
// If user is not authenticated: the list of polls is send to user's email by the backend.
|
// If user is not authenticated: the list of polls is send to user's email by the backend.
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse<Poll[]> = await axios.get<Poll[]>(
|
await this.axiosInstance.get<Poll[]>(
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.user.polls.sendEmail.name}/${email}`
|
`${this.usersEndpoint}/${user.email}${this.usersPollsEndpoint}${this.usersPollsSendEmailEndpoint}`
|
||||||
);
|
);
|
||||||
return response ? response.data : [];
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -77,35 +92,28 @@ export class ApiService {
|
|||||||
// If user is authenticated : retrieve polls & display directly in frontend.
|
// If user is authenticated : retrieve polls & display directly in frontend.
|
||||||
// TODO: Backend should handle this case. Actually the endpoint doesn't exist in backend.
|
// TODO: Backend should handle this case. Actually the endpoint doesn't exist in backend.
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse<Poll[]> = await axios.get<Poll[]>(
|
const response: AxiosResponse<Poll[]> = await this.axiosInstance.get<Poll[]>(
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.user.polls.name}/${user.email}`
|
`${this.usersEndpoint}/${user.email}${this.usersPollsEndpoint}`
|
||||||
);
|
);
|
||||||
return response ? response.data : [];
|
return response?.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async getPollsByUrl(url: string): Promise<Poll[]> {
|
public async getPollByIdentifier(identifier: string): Promise<Poll | undefined> {
|
||||||
|
// TODO: identifier should be decided according to backend : Id || Slug ?
|
||||||
try {
|
try {
|
||||||
const response: AxiosResponse<Poll[]> = await axios.get<Poll[]>(
|
const response: AxiosResponse<Poll> = await this.axiosInstance.get<Poll>(
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}/${url}`
|
`${this.pollsEndpoint}/${identifier}`
|
||||||
);
|
);
|
||||||
return response ? response.data : [];
|
return response?.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
if (error.response?.status === 404) {
|
||||||
}
|
return undefined;
|
||||||
}
|
} else {
|
||||||
|
this.handleError(error);
|
||||||
public async getPollById(id: string, password?: string): Promise<Poll[]> {
|
}
|
||||||
try {
|
|
||||||
const response: AxiosResponse<Poll[]> = await axios.get<Poll[]>(
|
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}/${id}`,
|
|
||||||
password ? { params: { password } } : {}
|
|
||||||
);
|
|
||||||
return response ? response.data : [];
|
|
||||||
} catch (error) {
|
|
||||||
this.handleError(error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +123,7 @@ export class ApiService {
|
|||||||
public async updatePoll(poll: Poll): Promise<void> {
|
public async updatePoll(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: implement the params when entities are finalized.
|
// 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: '' },
|
params: { voteStack: {}, token: '' },
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -126,12 +134,9 @@ export class ApiService {
|
|||||||
public async updateVote(voteStack: any): Promise<void> {
|
public async updateVote(voteStack: any): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: implement the params when entities are finalized.
|
// TODO: implement the params when entities are finalized.
|
||||||
await axios.patch(
|
await this.axiosInstance.patch(`${this.votesStacksEndpoint}/${voteStack.id}`, {
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.vote.name}/${voteStack.id}`,
|
params: { voteStack: {}, token: '' },
|
||||||
{
|
});
|
||||||
params: { voteStack: {}, token: '' },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -143,7 +148,7 @@ export class ApiService {
|
|||||||
|
|
||||||
public async deletePoll(poll: Poll): Promise<void> {
|
public async deletePoll(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await axios.delete(`${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}`, {});
|
await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}`, {});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -152,9 +157,7 @@ export class ApiService {
|
|||||||
public async deletePollVotes(poll: Poll): Promise<void> {
|
public async deletePollVotes(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: update endpoint in Backend
|
// TODO: update endpoint in Backend
|
||||||
await axios.delete(
|
await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}${this.votesEndpoint}`);
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}${environment.api.endpoints.poll.vote.name}`
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
@ -163,9 +166,7 @@ export class ApiService {
|
|||||||
public async deletePollComments(poll: Poll): Promise<void> {
|
public async deletePollComments(poll: Poll): Promise<void> {
|
||||||
try {
|
try {
|
||||||
// TODO: modify endpoint in Backend
|
// TODO: modify endpoint in Backend
|
||||||
await axios.delete(
|
await this.axiosInstance.delete(`${this.pollsEndpoint}${poll.id}${this.commentsEndpoint}`);
|
||||||
`${environment.api.baseHref}${environment.api.endpoints.poll.name}${poll.id}${environment.api.endpoints.poll.comment.name}`
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.handleError(error);
|
this.handleError(error);
|
||||||
}
|
}
|
||||||
|
16
src/app/core/services/message-displayer.service.spec.ts
Normal file
16
src/app/core/services/message-displayer.service.spec.ts
Normal file
@ -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();
|
||||||
|
});
|
||||||
|
});
|
19
src/app/core/services/message-displayer.service.ts
Normal file
19
src/app/core/services/message-displayer.service.ts
Normal file
@ -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,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
16
src/app/core/services/mocking.service.spec.ts
Normal file
16
src/app/core/services/mocking.service.spec.ts
Normal file
@ -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();
|
||||||
|
});
|
||||||
|
});
|
37
src/app/core/services/mocking.service.ts
Normal file
37
src/app/core/services/mocking.service.ts
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,10 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { MessageSeverity } from '../enums/message-severity.enum';
|
||||||
import { Poll } from '../models/poll.model';
|
import { Poll } from '../models/poll.model';
|
||||||
import { ApiService } from './api.service';
|
import { ApiService } from './api.service';
|
||||||
|
import { MessageDisplayerService } from './message-displayer.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
@ -11,29 +13,44 @@ export class PollService {
|
|||||||
private _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined);
|
private _poll: BehaviorSubject<Poll | undefined> = new BehaviorSubject<Poll | undefined>(undefined);
|
||||||
public readonly poll: Observable<Poll | undefined> = this._poll.asObservable();
|
public readonly poll: Observable<Poll | undefined> = this._poll.asObservable();
|
||||||
|
|
||||||
constructor(private apiService: ApiService) {}
|
constructor(private apiService: ApiService, private messageService: MessageDisplayerService) {}
|
||||||
|
|
||||||
public updateCurrentPoll(poll: Poll): void {
|
public updateCurrentPoll(poll: Poll): void {
|
||||||
this._poll.next(poll);
|
this._poll.next(poll);
|
||||||
}
|
}
|
||||||
|
|
||||||
public savePoll(poll: Poll): void {
|
// SAVE
|
||||||
this.apiService.savePoll(poll);
|
public async savePoll(poll: Poll): Promise<void> {
|
||||||
|
await this.apiService.savePoll(poll);
|
||||||
|
this.messageService.display(MessageSeverity.SUCCESS, 'Le sondage a été créé.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveVote(poll: Poll): void {
|
public async saveVote(poll: Poll): Promise<void> {
|
||||||
this.apiService.saveVote(poll);
|
await this.apiService.saveVote(poll);
|
||||||
|
this.messageService.display(MessageSeverity.SUCCESS, 'Votre participation au sondage a été enregistrée.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveComment(poll: Poll, comment: string): void {
|
public async saveComment(poll: Poll, comment: string): Promise<void> {
|
||||||
this.apiService.saveComment(poll, comment);
|
await this.apiService.saveComment(poll, comment);
|
||||||
|
this.messageService.display(MessageSeverity.SUCCESS, 'Votre commentaire a été enregistré.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public deletePollVotes(poll: Poll): void {
|
// GET
|
||||||
this.apiService.deletePollVotes(poll);
|
public async getPollByIdentifier(slug: string): Promise<void> {
|
||||||
|
this.updateCurrentPoll(await this.apiService.getPollByIdentifier(slug));
|
||||||
}
|
}
|
||||||
|
|
||||||
public deletePollComments(poll: Poll): void {
|
// DELETE
|
||||||
this.apiService.deletePollComments(poll);
|
public async deletePollVotes(poll: Poll): Promise<void> {
|
||||||
|
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<void> {
|
||||||
|
await this.apiService.deletePollComments(poll);
|
||||||
|
this.messageService.display(MessageSeverity.SUCCESS, 'Les commentaires de ce sondage ont été supprimés.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { Theme } from '../enums/theme.enum';
|
|||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class ThemeService {
|
export class ThemeService {
|
||||||
private _theme: BehaviorSubject<Theme> = new BehaviorSubject<Theme>(Theme.LIGHT);
|
private _theme: BehaviorSubject<Theme> = new BehaviorSubject<Theme>(Theme.RED);
|
||||||
public readonly theme: Observable<Theme> = this._theme.asObservable();
|
public readonly theme: Observable<Theme> = this._theme.asObservable();
|
||||||
|
|
||||||
public selectTheme(theme: Theme): void {
|
public selectTheme(theme: Theme): void {
|
||||||
|
@ -2,15 +2,31 @@ import { Injectable } from '@angular/core';
|
|||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
|
|
||||||
import { User } from '../models/user.model';
|
import { User } from '../models/user.model';
|
||||||
|
import { ApiService } from './api.service';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class UserService {
|
export class UserService {
|
||||||
private _user: BehaviorSubject<User | undefined> = new BehaviorSubject<User | undefined>(undefined);
|
public anonymous: User = new User();
|
||||||
public readonly user: Observable<User | undefined> = this._user.asObservable();
|
private _user: BehaviorSubject<User> = new BehaviorSubject<User>(this.anonymous);
|
||||||
|
public readonly user: Observable<User> = this._user.asObservable();
|
||||||
|
|
||||||
|
constructor(private apiService: ApiService) {}
|
||||||
|
|
||||||
public updateUser(user: User): void {
|
public updateUser(user: User): void {
|
||||||
this._user.next(user);
|
this._user.next(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET
|
||||||
|
public async getUserPolls(): Promise<void> {
|
||||||
|
const currentUser: User = this._user.getValue();
|
||||||
|
currentUser.polls = await this.apiService.getPollsByUserEmail(currentUser);
|
||||||
|
this.updateUser(currentUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
// POST
|
||||||
|
public async sendEmailToUserTheListOfItsPolls(): Promise<void> {
|
||||||
|
await this.apiService.sendEmailToUserOfItsPollsList(this._user.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
16
src/app/core/services/workflow.service.spec.ts
Normal file
16
src/app/core/services/workflow.service.spec.ts
Normal file
@ -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();
|
||||||
|
});
|
||||||
|
});
|
30
src/app/core/services/workflow.service.ts
Normal file
30
src/app/core/services/workflow.service.ts
Normal file
@ -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<WorkflowStep> = new BehaviorSubject<WorkflowStep>(WorkflowStep[0]);
|
||||||
|
public readonly currentStep: Observable<WorkflowStep> = 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;
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ export class PollUtilsService {
|
|||||||
* make a uniq slug for the current poll creation
|
* make a uniq slug for the current poll creation
|
||||||
* @param str
|
* @param str
|
||||||
*/
|
*/
|
||||||
public makeSlug(config: PollConfig): string {
|
public makeSlug(config: any): string {
|
||||||
let str = '';
|
let str = '';
|
||||||
str =
|
str =
|
||||||
config.creationDate.getFullYear() +
|
config.creationDate.getFullYear() +
|
||||||
|
@ -1,9 +1,32 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { AdministrationComponent } from './administration.component';
|
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: '', component: AdministrationComponent }];
|
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({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
@ -1 +1,12 @@
|
|||||||
<p>administration works!</p>
|
<div class="container has-text-centered">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<app-stepper></app-stepper>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { Poll } from '../../core/models/poll.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-administration',
|
selector: 'app-administration',
|
||||||
templateUrl: './administration.component.html',
|
templateUrl: './administration.component.html',
|
||||||
styleUrls: ['./administration.component.scss'],
|
styleUrls: ['./administration.component.scss'],
|
||||||
})
|
})
|
||||||
export class AdministrationComponent implements OnInit {
|
export class AdministrationComponent implements OnInit {
|
||||||
|
public poll: Poll;
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
|
@ -1,13 +1,34 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { ReactiveFormsModule } from '@angular/forms';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { AdministrationRoutingModule } from './administration-routing.module';
|
import { AdministrationRoutingModule } from './administration-routing.module';
|
||||||
import { AdministrationComponent } from './administration.component';
|
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({
|
@NgModule({
|
||||||
declarations: [AdministrationComponent],
|
declarations: [
|
||||||
imports: [CommonModule, AdministrationRoutingModule, SharedModule, TranslateModule.forChild({ extend: true })],
|
AdministrationComponent,
|
||||||
|
PollEditComponent,
|
||||||
|
StepperComponent,
|
||||||
|
ProfileComponent,
|
||||||
|
EditDescriptionComponent,
|
||||||
|
EditOptionsComponent,
|
||||||
|
EditConfigurationComponent,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
AdministrationRoutingModule,
|
||||||
|
CommonModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
SharedModule,
|
||||||
|
TranslateModule.forChild({ extend: true }),
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class AdministrationModule {}
|
export class AdministrationModule {}
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
<p>edit-configuration works!</p>
|
@ -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<EditConfigurationComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [EditConfigurationComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EditConfigurationComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -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 {}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<div>
|
||||||
|
<p>Form Status: {{ pollForm.status }}</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<form [formGroup]="pollForm" (ngSubmit)="onSubmit()">
|
||||||
|
<div class="field">
|
||||||
|
<label for="primeType">Sondage concerne des dates ?</label>
|
||||||
|
<p-inputSwitch id="primeType" formControlName="type"></p-inputSwitch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="title">
|
||||||
|
Intitulé
|
||||||
|
<input class="input" type="text" formControlName="title" placeholder="Intitulé" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="description">
|
||||||
|
Description
|
||||||
|
<textarea pInputTextarea formControlName="description" placeholder="Description"></textarea>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="slug">
|
||||||
|
Url personnalisée
|
||||||
|
<input class="input" type="text" formControlName="slug" placeholder="Url" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="button is-fullwidth" type="submit" [disabled]="!pollForm.valid">Créer</button>
|
||||||
|
</form>
|
@ -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<EditDescriptionComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [EditDescriptionComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EditDescriptionComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<p>edit-options works!</p>
|
@ -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<EditOptionsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [EditOptionsComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(EditOptionsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -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 {}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<div>
|
||||||
|
<p>Form Status: {{ pollForm.status }}</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<form [formGroup]="pollForm" (ngSubmit)="onSubmit()">
|
||||||
|
<div class="field">
|
||||||
|
<label for="primeType">Sondage concerne des dates ?</label>
|
||||||
|
<p-inputSwitch id="primeType" formControlName="type"></p-inputSwitch>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="title">
|
||||||
|
Intitulé
|
||||||
|
<input class="input" type="text" formControlName="title" placeholder="Intitulé" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="description">
|
||||||
|
Description
|
||||||
|
<textarea pInputTextarea formControlName="description" placeholder="Description"></textarea>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<label class="label" for="slug">
|
||||||
|
Url personnalisée
|
||||||
|
<input class="input" type="text" formControlName="slug" placeholder="Url" />
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="button is-fullwidth" type="submit" [disabled]="!pollForm.valid">Créer</button>
|
||||||
|
</form>
|
@ -0,0 +1,24 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { PollEditComponent } from './poll-edit.component';
|
||||||
|
|
||||||
|
describe('PollEditComponent', () => {
|
||||||
|
let component: PollEditComponent;
|
||||||
|
let fixture: ComponentFixture<PollEditComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [PollEditComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PollEditComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
<div class="container has-text-centered">
|
||||||
|
<ng-container *ngIf="['REGISTERED', 'ADMIN'].includes((_user | async)?.role)">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<h1>Mes sondages</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<table class="table is-bordered is-striped is-narrow is-hoverable is-fullwidth">
|
||||||
|
<thead></thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let poll of (_user | async)?.polls">
|
||||||
|
<th>{{ poll.title }}</th>
|
||||||
|
<td>
|
||||||
|
<a routerLink="{{ '/administration/edit/description/' + poll.slug }}">
|
||||||
|
{{ poll.getUrl() }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
<ng-container *ngIf="['ANONYMOUS'].includes((_user | async)?.role)">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<a class="button is-primary" role="button" routerLink="/login">
|
||||||
|
J’ai un compte, je me connecte
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<span>OU</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<button class="button is-primary" (click)="toggleModal()">
|
||||||
|
Je n’ai pas de compte : envoyez-moi la liste par email
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal" [class.is-active]="isModalOpened">
|
||||||
|
<div class="modal-background" (click)="toggleModal()"></div>
|
||||||
|
<div class="modal-content has-background-light">
|
||||||
|
<div class="field">
|
||||||
|
<div class="control">
|
||||||
|
<input class="input" type="email" placeholder="Email" />
|
||||||
|
<button class="button is-primary is-fullwidth">Envoyez le mail !</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -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<ProfileComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ProfileComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ProfileComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
24
src/app/features/administration/profile/profile.component.ts
Normal file
24
src/app/features/administration/profile/profile.component.ts
Normal file
@ -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<User>;
|
||||||
|
public isModalOpened = false;
|
||||||
|
|
||||||
|
constructor(private userService: UserService) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this._user = this.userService.user;
|
||||||
|
}
|
||||||
|
public toggleModal(): void {
|
||||||
|
this.isModalOpened = !this.isModalOpened;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
<p-steps [model]="items" [readonly]="false" [(activeIndex)]="activeIndex"></p-steps>
|
@ -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<StepperComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [StepperComponent],
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(StepperComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
51
src/app/features/administration/stepper/stepper.component.ts
Normal file
51
src/app/features/administration/stepper/stepper.component.ts
Normal file
@ -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<WorkflowStep>;
|
||||||
|
|
||||||
|
constructor(private workflowService: WorkflowService) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
// this.activeStep = this.workflowService.currentStep;
|
||||||
|
|
||||||
|
this.items = [this.itemDescription, this.itemOptions, this.itemConfiguration];
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* une option de date dans les sondages spéciaux
|
* 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';
|
import { DateChoice, defaultAnswers, otherDefaultDates, PollAnswer } from './defaultConfigs';
|
||||||
|
|
||||||
export interface DateOption {
|
export interface DateOption {
|
||||||
@ -57,8 +57,8 @@ export class PollConfig {
|
|||||||
customUrl = ''; // custom slug in the url, must be unique
|
customUrl = ''; // custom slug in the url, must be unique
|
||||||
customUrlIsUnique = null; // given by the backend
|
customUrlIsUnique = null; // given by the backend
|
||||||
urlSlugPublic = null;
|
urlSlugPublic = null;
|
||||||
urlPublic = environment.production ? '' : document.location.href + '/#/poll/id/4';
|
urlPublic = environment.production ? '' : document.location.href + '/poll/id/4';
|
||||||
urlAdmin = document.location.href + '/#/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
urlAdmin = document.location.href + '/admin/d65es45fd45sdf45sd345f312sdf31sgfd345';
|
||||||
adminKey = ''; // key to change config of the poll
|
adminKey = ''; // key to change config of the poll
|
||||||
owner_modifier_token = ''; // key to change a vote stack
|
owner_modifier_token = ''; // key to change a vote stack
|
||||||
canModifyAnswers = true; // bool for the frontend selector
|
canModifyAnswers = true; // bool for the frontend selector
|
46
src/app/features/old-stuff/old-stuff-routing.module.ts
Normal file
46
src/app/features/old-stuff/old-stuff-routing.module.ts
Normal file
@ -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 {}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user